| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | /* | |||
| 2 | * @file trigger_honda.cpp | |||
| 3 | * | |||
| 4 | * @date May 27, 2016 | |||
| 5 | * @author Andrey Belomutskiy, (c) 2012-2020 | |||
| 6 | */ | |||
| 7 | ||||
| 8 | #include "pch.h" | |||
| 9 | ||||
| 10 | #include "trigger_honda.h" | |||
| 11 | #include "trigger_universal.h" | |||
| 12 | ||||
| 13 | 2 | void configureHondaCbr600(TriggerWaveform *s) { | ||
| 14 | 2 | s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::RiseOnly); | ||
| 15 | ||||
| 16 | 2 | s->tdcPosition = 0; // todo: hard-code TDC position once we know it | ||
| 17 | 2 | s->setTriggerSynchronizationGap2(/*from*/3.9, /*to*/8); | ||
| 18 | ||||
| 19 | 2 | s->addEvent720(350.0f, TriggerValue::FALL); | ||
| 20 | 2 | s->addEvent720(360.0f, TriggerValue::RISE); | ||
| 21 | ||||
| 22 | 2 | s->addEvent720(650.0f, TriggerValue::FALL); | ||
| 23 | 2 | s->addEvent720(660.0f, TriggerValue::RISE); | ||
| 24 | ||||
| 25 | 2 | s->addEvent720(710.0f, TriggerValue::FALL); | ||
| 26 | 2 | s->addEvent720(720.0f, TriggerValue::RISE); | ||
| 27 | 2 | } | ||
| 28 | ||||
| 29 | // TT_HONDA_K_CRANK_12_1 | |||
| 30 | 6 | void configureHondaK_12_1(TriggerWaveform *s) { | ||
| 31 | 6 | s->initialize(FOUR_STROKE_CRANK_SENSOR, SyncEdge::RiseOnly); | ||
| 32 | ||||
| 33 | // nominal gap 0.33 | |||
| 34 | 6 | s->setSecondTriggerSynchronizationGap2(0.2f, 0.7f); | ||
| 35 | // nominal gap 2.0 | |||
| 36 | 6 | s->setTriggerSynchronizationGap2(1.1f, 2.4f); | ||
| 37 | ||||
| 38 | 6 | int count = 12; | ||
| 39 | 6 | float tooth = 360 / count; // hint: tooth = 30 | ||
| 40 | ||||
| 41 | // for VR we only handle rises so width does not matter much | |||
| 42 | 6 | int width = 4; | ||
| 43 | ||||
| 44 | // Extra "+1" tooth happens 1/3 of the way between first two teeth | |||
| 45 | 6 | s->addToothRiseFall(tooth / 3, width); | ||
| 46 | ||||
| 47 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 6 times.
|
2/2✓ Decision 'true' taken 72 times.
✓ Decision 'false' taken 6 times.
|
78 | for (int i = 1; i <= count; i++) { |
| 48 | 72 | s->addToothRiseFall(tooth * i, width); | ||
| 49 | } | |||
| 50 | 6 | } | ||
| 51 | ||||
| 52 | /** | |||
| 53 | * Exhaust cam shaft, not variable on Honda K | |||
| 54 | * 2003 Honda Element | |||
| 55 | */ | |||
| 56 | 2 | void configureHondaK_4_1(TriggerWaveform *s) { | ||
| 57 | 2 | s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::RiseOnly); | ||
| 58 | ||||
| 59 | 2 | s->setTriggerSynchronizationGap3(/*gapIndex*/0, 1.5, 4.5); // nominal 2.27 | ||
| 60 | 2 | s->setTriggerSynchronizationGap3(/*gapIndex*/1, 0.1, 0.5); // nominal 0.28 | ||
| 61 | ||||
| 62 | 2 | angle_t end = 70.5; | ||
| 63 | 2 | int w = 15; | ||
| 64 | 2 | s->addToothRiseFall(end + 90 * 0, w); | ||
| 65 | 2 | s->addToothRiseFall(end + 90 * 1, w); | ||
| 66 | 2 | s->addToothRiseFall(end + 90 * 2, w); | ||
| 67 | 2 | s->addToothRiseFall(end + 90 * 3, w); | ||
| 68 | ||||
| 69 | 2 | s->addToothRiseFall(360, 7); | ||
| 70 | 2 | } | ||
| 71 | ||||
| 72 | 1 | void initialize_one_of_24_2_2(TriggerWaveform *s, int firstCount, int secondCount) { | ||
| 73 | 1 | s->initialize(FOUR_STROKE_CRANK_SENSOR, SyncEdge::RiseOnly); | ||
| 74 | ||||
| 75 | 1 | float narrow = 360 / 24; | ||
| 76 | 1 | float wide = narrow * 2; | ||
| 77 | ||||
| 78 | 1 | float base = 0; | ||
| 79 | ||||
| 80 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1 time.
|
2/2✓ Decision 'true' taken 6 times.
✓ Decision 'false' taken 1 time.
|
7 | for (int i = 0; i < firstCount; i++) { |
| 81 | 6 | s->addToothFallRise(base + narrow, narrow / 2); | ||
| 82 | 6 | base += narrow; | ||
| 83 | } | |||
| 84 | ||||
| 85 | 1 | s->addToothFallRise(base + wide, wide / 2); | ||
| 86 | 1 | base += wide; | ||
| 87 | ||||
| 88 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 1 time.
|
2/2✓ Decision 'true' taken 14 times.
✓ Decision 'false' taken 1 time.
|
15 | for (int i = 0; i < secondCount; i++) { |
| 89 | 14 | s->addToothFallRise(base + narrow, narrow / 2); | ||
| 90 | 14 | base += narrow; | ||
| 91 | } | |||
| 92 | ||||
| 93 | 1 | s->addToothFallRise(360, narrow/2); | ||
| 94 | 1 | } | ||
| 95 | ||||
| 96 | 1 | void configureHondaJ30A2_24_1_1(TriggerWaveform *s) { | ||
| 97 | 1 | initialize_one_of_24_2_2(s, 6, 14); | ||
| 98 | ||||
| 99 | 1 | size_t count = 6; | ||
| 100 | ||||
| 101 | 1 | s->tdcPosition = 0; | ||
| 102 | ||||
| 103 | 1 | s->setTriggerSynchronizationGap3(/*gapIndex*/0, 1.6, 4); | ||
| 104 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 time.
|
2/2✓ Decision 'true' taken 5 times.
✓ Decision 'false' taken 1 time.
|
6 | for (size_t i = 1 ; i < count ; i++) { |
| 105 | 5 | s->setTriggerSynchronizationGap3(/*gapIndex*/i, 0.65, 1.4); | ||
| 106 | } | |||
| 107 | 1 | s->setTriggerSynchronizationGap3(/*gapIndex*/count, 0.2, 0.55); | ||
| 108 | 1 | } | ||
| 109 |