diff --git a/firmware/controllers/trigger/decoders/trigger_misc.cpp b/firmware/controllers/trigger/decoders/trigger_misc.cpp index 9cd06d3782..c23a5a3585 100644 --- a/firmware/controllers/trigger/decoders/trigger_misc.cpp +++ b/firmware/controllers/trigger/decoders/trigger_misc.cpp @@ -25,3 +25,27 @@ void configureFiatIAQ_P8(TriggerWaveform * s) { s->setTriggerSynchronizationGap(3); } + +void configureDaihatsu4(TriggerWaveform * s) { + s->initialize(FOUR_STROKE_CAM_SENSOR); + + s->isSynchronizationNeeded = true; + + int width = 10; + + s->setTriggerSynchronizationGap(0.125); + + s->addEvent720(30 - width, T_PRIMARY, TV_RISE); + s->addEvent720(30, T_PRIMARY, TV_FALL); + + + s->addEvent720(s->getCycleDuration() / 3 - width, T_PRIMARY, TV_RISE); + s->addEvent720(s->getCycleDuration() / 3, T_PRIMARY, TV_FALL); + + s->addEvent720(s->getCycleDuration() / 3 * 2 - width, T_PRIMARY, TV_RISE); + s->addEvent720(s->getCycleDuration() / 3 * 2, T_PRIMARY, TV_FALL); + + s->addEvent720(s->getCycleDuration() - width, T_PRIMARY, TV_RISE); + s->addEvent720(s->getCycleDuration(), T_PRIMARY, TV_FALL); + +} diff --git a/firmware/controllers/trigger/decoders/trigger_misc.h b/firmware/controllers/trigger/decoders/trigger_misc.h index 98ef4eaadd..38be33cef4 100644 --- a/firmware/controllers/trigger/decoders/trigger_misc.h +++ b/firmware/controllers/trigger/decoders/trigger_misc.h @@ -10,4 +10,5 @@ #include "trigger_structure.h" void configureFiatIAQ_P8(TriggerWaveform * s); +void configureDaihatsu4(TriggerWaveform * s); diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index b9bd129304..7c556ec39d 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -543,6 +543,9 @@ void TriggerWaveform::initializeTriggerWaveform(Logging *logger, operation_mode_ break; case TT_TT_DAIHATSU: + configureDaihatsu4(this); + break; + case TT_VVT_JZ: setToothedWheelConfiguration(this, 3, 0, ambiguousOperationMode); break; diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index ed2aa217af..c2b9021138 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -555,7 +555,7 @@ void printAllTriggers() { engine->initializeTriggerWaveform(NULL PASS_ENGINE_PARAMETER_SUFFIX); if (shape->shapeDefinitionError) { - printf("Trigger error %d\r\n", triggerId); + printf("Trigger shapeDefinitionError %d\r\n", triggerId); exit(-1); } diff --git a/unit_tests/main.cpp b/unit_tests/main.cpp index eddf61a638..ec33a75362 100644 --- a/unit_tests/main.cpp +++ b/unit_tests/main.cpp @@ -32,13 +32,15 @@ efitick_t getTimeNowNt(void) { LoggingWithStorage sharedLogger("main"); extern bool printTriggerDebug; +extern bool printTriggerTrace; bool verboseMode = false; GTEST_API_ int main(int argc, char **argv) { // printTriggerDebug = true; +// printTriggerTrace = true; // resizeMap(); - printf("Success 20200510\r\n"); + printf("Success 20201203\r\n"); printAllTriggers(); testing::InitGoogleTest(&argc, argv);