auto-sync
This commit is contained in:
parent
cee0d25516
commit
c17a80040b
|
@ -91,6 +91,17 @@ typedef struct {
|
|||
|
||||
#define MAF_DECODING_CACHE_MULT (MAF_DECODING_CACHE_SIZE / 5.0)
|
||||
|
||||
typedef struct {
|
||||
uint32_t beforeIgnitionMath;
|
||||
uint32_t ignitionMathTime;
|
||||
|
||||
uint32_t beforeIgnitionSch;
|
||||
uint32_t ignitionSchTime;
|
||||
|
||||
uint32_t beforeInjectonSch;
|
||||
uint32_t injectonSchTime;
|
||||
} monitoring_timestamps_s;
|
||||
|
||||
class Engine {
|
||||
public:
|
||||
Engine();
|
||||
|
@ -159,12 +170,6 @@ public:
|
|||
*/
|
||||
int engineCycleEventCount;
|
||||
|
||||
uint32_t beforeIgnitionMath;
|
||||
uint32_t ignitionMathTime;
|
||||
|
||||
uint32_t beforeIgnitionSch;
|
||||
uint32_t ignitionSchTime;
|
||||
|
||||
/**
|
||||
* fast spark dwell time interpolation helper
|
||||
* todo: finish the implementation and
|
||||
|
@ -184,6 +189,8 @@ public:
|
|||
|
||||
IntListenerArray configurationListeners;
|
||||
|
||||
monitoring_timestamps_s m;
|
||||
|
||||
private:
|
||||
/**
|
||||
* By the way:
|
||||
|
|
|
@ -9,7 +9,10 @@
|
|||
|
||||
#include "engine_configuration.h"
|
||||
|
||||
#define PWM_PHASE_MAX_COUNT 250
|
||||
/**
|
||||
* this value should be dividable by four, see FuelSchedule.hasEvents
|
||||
*/
|
||||
#define PWM_PHASE_MAX_COUNT 252
|
||||
#define PWM_PHASE_MAX_WAVE_PER_PWM 3
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,6 +40,7 @@ void initializeIgnitionActions(angle_t advance, angle_t dwellAngle,
|
|||
|
||||
/**
|
||||
* @return float, time needed to rotate crankshaft by one degree, in microseconds.
|
||||
* See also engine->rpmCalculator.oneDegreeUs
|
||||
*/
|
||||
#define getOneDegreeTimeUs(rpm) (1000000.0f * 60 / 360 / (rpm))
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ static ALWAYS_INLINE void handleFuel(uint32_t eventIndex, int rpm DECLARE_ENGINE
|
|||
*/
|
||||
FuelSchedule *fs =
|
||||
isCrankingR(rpm) ?
|
||||
&engine->engineConfiguration2->crankingInjectionEvents : &engine->engineConfiguration2->injectionEvents;
|
||||
&ENGINE(engineConfiguration2)->crankingInjectionEvents : &engine->engineConfiguration2->injectionEvents;
|
||||
|
||||
ActuatorEventList *source = &fs->events;
|
||||
|
||||
|
@ -295,6 +295,9 @@ static void ignitionCalc(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
|||
engine->dwellAngle = dwellMs / getOneDegreeTimeMs(rpm);
|
||||
}
|
||||
|
||||
extern OutputSignalList runningInjectonSignals CCM_OPTIONAL;
|
||||
extern OutputSignalList crankingInjectonSignals CCM_OPTIONAL;
|
||||
|
||||
/**
|
||||
* This is the main trigger event handler.
|
||||
* Both injection and ignition are controlled from this method.
|
||||
|
@ -339,14 +342,14 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECL
|
|||
}
|
||||
|
||||
if (eventIndex == engineConfiguration->ignMathCalculateAtIndex) {
|
||||
engine->beforeIgnitionMath = GET_TIMESTAMP();
|
||||
engine->m.beforeIgnitionMath = GET_TIMESTAMP();
|
||||
ignitionCalc(rpm PASS_ENGINE_PARAMETER);
|
||||
engine->ignitionMathTime = GET_TIMESTAMP() - engine->beforeIgnitionMath;
|
||||
engine->m.ignitionMathTime = GET_TIMESTAMP() - engine->m.beforeIgnitionMath;
|
||||
}
|
||||
|
||||
if (eventIndex == 0) {
|
||||
|
||||
engine->beforeIgnitionSch = GET_TIMESTAMP();
|
||||
engine->m.beforeIgnitionSch = GET_TIMESTAMP();
|
||||
/**
|
||||
* TODO: warning. there is a bit of a hack here, todo: improve.
|
||||
* currently output signals/times signalTimerUp from the previous revolutions could be
|
||||
|
@ -372,7 +375,19 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECL
|
|||
}
|
||||
initializeIgnitionActions(engine->advance, engine->dwellAngle,
|
||||
&engine->engineConfiguration2->ignitionEvents[revolutionIndex] PASS_ENGINE_PARAMETER);
|
||||
engine->ignitionSchTime = GET_TIMESTAMP() - engine->beforeIgnitionSch;
|
||||
engine->m.ignitionSchTime = GET_TIMESTAMP() - engine->m.beforeIgnitionSch;
|
||||
|
||||
engine->m.beforeInjectonSch = GET_TIMESTAMP();
|
||||
|
||||
if(isCrankingR(rpm)) {
|
||||
ENGINE(engineConfiguration2)->crankingInjectionEvents.addFuelEvents(
|
||||
&crankingInjectonSignals,
|
||||
engineConfiguration->crankingInjectionMode PASS_ENGINE_PARAMETER);
|
||||
} else {
|
||||
ENGINE(engineConfiguration2)->injectionEvents.addFuelEvents(&runningInjectonSignals,
|
||||
engineConfiguration->injectionMode PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
engine->m.injectonSchTime = GET_TIMESTAMP() - engine->m.beforeInjectonSch;
|
||||
}
|
||||
|
||||
// triggerEventsQueue.executeAll(getCrankEventCounter());
|
||||
|
|
|
@ -265,8 +265,11 @@ void triggerInfo(Engine *engine) {
|
|||
#endif
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
scheduleMsg(logger, "sn=%s ignitionMathTime=%d schTime=%d triggerMaxDuration=%d",
|
||||
boolToString(ts->isSynchronizationNeeded), engine->ignitionMathTime, engine->ignitionSchTime,
|
||||
scheduleMsg(logger, "sn=%s ignitionMathTime=%d schTime=%d injectonSchTime=%d triggerMaxDuration=%d",
|
||||
boolToString(ts->isSynchronizationNeeded),
|
||||
engine->m.ignitionMathTime,
|
||||
engine->m.ignitionSchTime,
|
||||
engine->m.injectonSchTime,
|
||||
triggerMaxDuration);
|
||||
|
||||
triggerMaxDuration = 0;
|
||||
|
|
Loading…
Reference in New Issue