auto-sync

This commit is contained in:
rusEfi 2014-11-24 17:04:41 -06:00
parent fb131888bf
commit 0232c7cffe
3 changed files with 8 additions and 3 deletions

View File

@ -54,6 +54,8 @@ public:
*/ */
bool isCylinderCleanupMode; bool isCylinderCleanupMode;
uint32_t ignitionMathTime;
void updateSlowSensors(); void updateSlowSensors();
void watchdog(); void watchdog();

View File

@ -53,6 +53,7 @@
#include "LocalVersionHolder.h" #include "LocalVersionHolder.h"
#include "event_queue.h" #include "event_queue.h"
#include "engine.h" #include "engine.h"
#include "efilib2.h"
EXTERN_ENGINE EXTERN_ENGINE
; ;
@ -313,7 +314,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex, Eng
warning(OBD_Camshaft_Position_Sensor_Circuit_Range_Performance, "noisy trigger"); warning(OBD_Camshaft_Position_Sensor_Circuit_Range_Performance, "noisy trigger");
return; return;
} }
if (rpm > engine->engineConfiguration->rpmHardLimit) { if (rpm > engineConfiguration->rpmHardLimit) {
warning(OBD_PCM_Processor_Fault, "skipping stroke due to rpm=%d", rpm); warning(OBD_PCM_Processor_Fault, "skipping stroke due to rpm=%d", rpm);
return; return;
} }
@ -327,6 +328,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex, Eng
if (eventIndex == 0) { if (eventIndex == 0) {
if (localVersion.isOld()) if (localVersion.isOld())
prepareOutputSignals(engine); prepareOutputSignals(engine);
uint32_t beforeIgnitionMath = GET_TIMESTAMP();
/** /**
* TODO: warning. there is a bit of a hack here, todo: improve. * TODO: warning. there is a bit of a hack here, todo: improve.
@ -366,8 +368,9 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex, Eng
// todo: add some check for dwell overflow? like 4 times 6 ms while engine cycle is less then that // todo: add some check for dwell overflow? like 4 times 6 ms while engine cycle is less then that
initializeIgnitionActions(fixAngle(-advance PASS_ENGINE_PARAMETER), dwellAngle, initializeIgnitionActions(-advance, dwellAngle,
&engine->engineConfiguration2->ignitionEvents[revolutionIndex] PASS_ENGINE_PARAMETER); &engine->engineConfiguration2->ignitionEvents[revolutionIndex] PASS_ENGINE_PARAMETER);
engine->ignitionMathTime = GET_TIMESTAMP() - beforeIgnitionMath;
} }
triggerEventsQueue.executeAll(getCrankEventCounter()); triggerEventsQueue.executeAll(getCrankEventCounter());

View File

@ -217,7 +217,7 @@ static void triggerInfo(Engine *engine) {
scheduleMsg(&logger, "Template %s/%d trigger %d", getConfigurationName(engineConfiguration->engineType), scheduleMsg(&logger, "Template %s/%d trigger %d", getConfigurationName(engineConfiguration->engineType),
engineConfiguration->engineType, engineConfiguration->triggerConfig.triggerType); engineConfiguration->engineType, engineConfiguration->triggerConfig.triggerType);
scheduleMsg(&logger, "sn=%d", ts->isSynchronizationNeeded); scheduleMsg(&logger, "sn=%d ignitionMathTime=%d", ts->isSynchronizationNeeded, engine->ignitionMathTime);
scheduleMsg(&logger, "trigger event counters %d/%d/%d/%d", triggerCentral.getHwEventCounter(0), scheduleMsg(&logger, "trigger event counters %d/%d/%d/%d", triggerCentral.getHwEventCounter(0),
triggerCentral.getHwEventCounter(1), triggerCentral.getHwEventCounter(2), triggerCentral.getHwEventCounter(1), triggerCentral.getHwEventCounter(2),