From 8f6ef7976c6803c0d637a18e428dc24b8378edb1 Mon Sep 17 00:00:00 2001 From: rusefi Date: Tue, 23 Jul 2019 19:22:40 -0400 Subject: [PATCH] CBR600 trigger progress --- firmware/controllers/engine_controller.cpp | 2 +- .../trigger/decoders/trigger_honda.cpp | 49 +++++- .../trigger/decoders/trigger_structure.cpp | 6 +- unit_tests/triggers.txt | 152 +++++++----------- 4 files changed, 108 insertions(+), 101 deletions(-) diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 2878801ebb..df01e2ee3c 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -812,6 +812,6 @@ int getRusEfiVersion(void) { if (initBootloader() != 0) return 123; #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ - return 20190721; + return 20190723; } #endif /* EFI_UNIT_TEST */ diff --git a/firmware/controllers/trigger/decoders/trigger_honda.cpp b/firmware/controllers/trigger/decoders/trigger_honda.cpp index 566c01e874..0d07aef98e 100644 --- a/firmware/controllers/trigger/decoders/trigger_honda.cpp +++ b/firmware/controllers/trigger/decoders/trigger_honda.cpp @@ -167,13 +167,58 @@ void configureHonda_1_4_24(TriggerShape *s, bool withOneEventSignal, bool withFo } void configureHondaCbr600(TriggerShape *s) { - // todo: finish this - setToothedWheelConfiguration(s, 24, 0, FOUR_STROKE_CRANK_SENSOR); + s->initialize(FOUR_STROKE_CAM_SENSOR, true); + s->useOnlyPrimaryForSync = true; + s->isSynchronizationNeeded = true; + s->setTriggerSynchronizationGap(6); + + // w = 15 + float w = 720 / 2 / 24; + + int totalTeethCount = 24; + int skippedCount = 0; + + addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, skippedCount, 0.5, 0, 720, + 0, 349); + + + //s->addEvent720(360 -w, T_SECONDARY, TV_RISE); + + //s->addEvent720(350 - 0.1, T_SECONDARY, TV_RISE); + + s->addEvent720(350.0f, T_PRIMARY, TV_FALL); + s->addEvent720(360.0f, T_PRIMARY, TV_RISE); + + s->addEvent720(360 + 0.2, T_SECONDARY, TV_FALL); + + addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, skippedCount, 0.5, 0, 720, + 361, 649); + + + + s->addEvent720(650.0f, T_PRIMARY, TV_FALL); + s->addEvent720(660.0f, T_PRIMARY, TV_RISE); + + s->addEvent720(660 + 0.2, T_SECONDARY, TV_FALL); + + + addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, skippedCount, 0.5, 0, 720, + 661, 709); + + +// exit(-1); + + s->addEvent720(710.0f, T_PRIMARY, TV_FALL); + + s->addEvent720(720.0f - 1, T_SECONDARY, TV_FALL); + + s->addEvent720(720.0f, T_PRIMARY, TV_RISE); } void configureHondaCbr600custom(TriggerShape *s) { + // w = 15 float w = 720 / 2 / 24; // s->initialize(FOUR_STROKE_CAM_SENSOR, false); s->initialize(FOUR_STROKE_CAM_SENSOR, true); diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index 0920b4c48f..6d5e808617 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -151,8 +151,12 @@ angle_t TriggerShape::getAngle(int index) const { } void TriggerShape::addEventClamped(angle_t angle, trigger_wheel_e const channelIndex, trigger_value_e const stateParam, float filterLeft, float filterRight) { - if (angle > filterLeft && angle < filterRight) + if (angle > filterLeft && angle < filterRight) { +#if EFI_UNIT_TEST +// printf("addEventClamped %f %s\r\n", angle, getTrigger_value_e(stateParam)); +#endif /* EFI_UNIT_TEST */ addEvent(angle / getEngineCycle(operationMode), channelIndex, stateParam); + } } operation_mode_e TriggerShape::getOperationMode() const { diff --git a/unit_tests/triggers.txt b/unit_tests/triggers.txt index e824d7eff8..984a2ad712 100644 --- a/unit_tests/triggers.txt +++ b/unit_tests/triggers.txt @@ -1807,104 +1807,62 @@ event 92 1 681.00 event 93 0 693.00 event 94 1 696.00 event 95 0 708.00 -TRIGGERTYPE 28 96 TT_HONDA_CBR_600 0.00 -# duty 0.50 0.00 +TRIGGERTYPE 28 54 TT_HONDA_CBR_600 0.00 +# duty 0.51 0.50 event 0 1 0.00 -event 1 0 7.50 -event 2 1 15.00 -event 3 0 22.50 -event 4 1 30.00 -event 5 0 37.50 -event 6 1 45.00 -event 7 0 52.50 -event 8 1 60.00 -event 9 0 67.50 -event 10 1 75.00 -event 11 0 82.50 -event 12 1 90.00 -event 13 0 97.50 -event 14 1 105.00 -event 15 0 112.50 -event 16 1 120.00 -event 17 0 127.50 -event 18 1 135.00 -event 19 0 142.50 -event 20 1 150.00 -event 21 0 157.50 -event 22 1 165.00 -event 23 0 172.50 -event 24 1 180.00 -event 25 0 187.50 -event 26 1 195.00 -event 27 0 202.50 -event 28 1 210.00 -event 29 0 217.50 -event 30 1 225.00 -event 31 0 232.50 -event 32 1 240.00 -event 33 0 247.50 -event 34 1 255.00 -event 35 0 262.50 -event 36 1 270.00 -event 37 0 277.50 -event 38 1 285.00 -event 39 0 292.50 -event 40 1 300.00 -event 41 0 307.50 -event 42 1 315.00 -event 43 0 322.50 -event 44 1 330.00 -event 45 0 337.50 -event 46 1 345.00 -event 47 0 352.50 -event 48 1 360.00 -event 49 0 367.50 -event 50 1 375.00 -event 51 0 382.50 -event 52 1 390.00 -event 53 0 397.50 -event 54 1 405.00 -event 55 0 412.50 -event 56 1 420.00 -event 57 0 427.50 -event 58 1 435.00 -event 59 0 442.50 -event 60 1 450.00 -event 61 0 457.50 -event 62 1 465.00 -event 63 0 472.50 -event 64 1 480.00 -event 65 0 487.50 -event 66 1 495.00 -event 67 0 502.50 -event 68 1 510.00 -event 69 0 517.50 -event 70 1 525.00 -event 71 0 532.50 -event 72 1 540.00 -event 73 0 547.50 -event 74 1 555.00 -event 75 0 562.50 -event 76 1 570.00 -event 77 0 577.50 -event 78 1 585.00 -event 79 0 592.50 -event 80 1 600.00 -event 81 0 607.50 -event 82 1 615.00 -event 83 0 622.50 -event 84 1 630.00 -event 85 0 637.50 -event 86 1 645.00 -event 87 0 652.50 -event 88 1 660.00 -event 89 0 667.50 -event 90 1 675.00 -event 91 0 682.50 -event 92 1 690.00 -event 93 0 697.50 -event 94 1 705.00 -event 95 0 712.50 +event 1 1000 0.20 +event 2 1001 15.00 +event 3 1000 30.00 +event 4 1001 45.00 +event 5 1000 60.00 +event 6 1001 75.00 +event 7 1000 90.00 +event 8 1001 105.00 +event 9 1000 120.00 +event 10 1001 135.00 +event 11 1000 150.00 +event 12 1001 165.00 +event 13 1000 180.00 +event 14 1001 195.00 +event 15 1000 210.00 +event 16 1001 225.00 +event 17 1000 240.00 +event 18 1001 255.00 +event 19 1000 270.00 +event 20 1001 285.00 +event 21 0 290.00 +event 22 1 300.00 +event 23 1000 300.20 +event 24 1001 315.00 +event 25 1000 330.00 +event 26 1001 345.00 +event 27 0 350.00 +event 28 1000 359.00 +event 29 1 360.00 +event 30 1001 375.00 +event 31 1000 390.00 +event 32 1001 405.00 +event 33 1000 420.00 +event 34 1001 435.00 +event 35 1000 450.00 +event 36 1001 465.00 +event 37 1000 480.00 +event 38 1001 495.00 +event 39 1000 510.00 +event 40 1001 525.00 +event 41 1000 540.00 +event 42 1001 555.00 +event 43 1000 570.00 +event 44 1001 585.00 +event 45 1000 600.00 +event 46 1001 615.00 +event 47 1000 630.00 +event 48 1001 645.00 +event 49 1000 660.00 +event 50 1001 675.00 +event 51 1000 690.00 +event 52 1001 705.00 +event 53 0 710.00 TRIGGERTYPE 29 50 TT_2JZ_1_12 0.00 # duty 0.01 0.50 event 0 1001 0.00