From 489e9d8c585cd66d506a530ffaa2358734d0ac0d Mon Sep 17 00:00:00 2001 From: rusEfi Date: Tue, 8 Nov 2016 22:02:47 -0500 Subject: [PATCH] auto-sync --- firmware/controllers/trigger/trigger_decoder.cpp | 8 +++++++- unit_tests/test_trigger_decoder.cpp | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 6a4cd193fa..cc1b8a6623 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -259,7 +259,13 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no enginePins.triggerDecoderErrorPin.setValue(isDecodingError); if (isDecodingError) { - warning(CUSTOM_SYNC_ERROR_2, "trigger not happy"); + warning(CUSTOM_SYNC_ERROR_2, "trigger not happy current %d/%d/%d expected %d/%d/%d", + currentCycle.eventCount[0], + currentCycle.eventCount[1], + currentCycle.eventCount[2], + TRIGGER_SHAPE(expectedEventCount[0]), + TRIGGER_SHAPE(expectedEventCount[1]), + TRIGGER_SHAPE(expectedEventCount[2])); lastDecodingErrorTime = getTimeNowNt(); someSortOfTriggerError = true; diff --git a/unit_tests/test_trigger_decoder.cpp b/unit_tests/test_trigger_decoder.cpp index 5eee022700..e6c26180cf 100644 --- a/unit_tests/test_trigger_decoder.cpp +++ b/unit_tests/test_trigger_decoder.cpp @@ -1241,7 +1241,7 @@ void testMissedSpark299(void) { EngineTestHelper eth(TEST_ENGINE); EXPAND_EngineTestHelper engineConfiguration->ignitionMode = IM_WASTED_SPARK; - engineConfiguration->useOnlyRisingEdgeForTrigger = true; + engineConfiguration->useOnlyRisingEdgeForTrigger = false; setTestBug299small(ð); engineConfiguration->isIgnitionEnabled = true; engineConfiguration->isInjectionEnabled = false; @@ -1262,7 +1262,7 @@ void testMissedSpark299(void) { printf("*************************************************** testMissedSpark299 start\r\n"); - assertEquals(6000, eth.engine.rpmCalculator.rpmValue); + assertEquals(3000, eth.engine.rpmCalculator.rpmValue); setWholeTimingTable(3 PASS_ENGINE_PARAMETER); eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_F); @@ -1282,10 +1282,16 @@ void testMissedSpark299(void) { timeNow += MS2US(20); eth.firePrimaryTriggerRise(); schedulingQueue.executeAll(timeNow); +// timeNow += MS2US(20); +// eth.firePrimaryTriggerFall(); +// schedulingQueue.executeAll(timeNow); timeNow += MS2US(20); eth.firePrimaryTriggerRise(); schedulingQueue.executeAll(timeNow); +// timeNow += MS2US(20); +// eth.firePrimaryTriggerFall(); +// schedulingQueue.executeAll(timeNow); assertEqualsM("warningCounter#1", 8, warningCounter); }