GCC Code Coverage Report


Directory: ./
File: firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp
Date: 2025-10-03 00:57:22
Coverage Exec Excl Total
Lines: 100.0% 108 0 108
Functions: 100.0% 8 0 8
Branches: -% 0 0 0
Decisions: -% 0 - 0

Line Branch Decision Exec Source
1 /**
2 * @file trigger_mitsubishi.cpp
3 *
4 * @date Aug 5, 2014
5 * @author Andrey Belomutskiy, (c) 2012-2020
6 */
7
8 #include "pch.h"
9
10 #include "trigger_mitsubishi.h"
11 #include "trigger_universal.h"
12
13 9 void configureFordAspireTriggerWaveform(TriggerWaveform * s) {
14 9 s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::RiseOnly);
15 9 s->isSynchronizationNeeded = false;
16 9 s->isSecondWheelCam = true;
17
18 9 float x = 121.90;
19 9 float y = 110.86;
20
21 9 s->addEvent720(x + y - 180, TriggerValue::RISE, TriggerWheel::T_SECONDARY);
22 9 s->addEvent720(x, TriggerValue::FALL, TriggerWheel::T_SECONDARY);
23 9 s->addEvent720(x + y, TriggerValue::RISE, TriggerWheel::T_SECONDARY);
24 9 s->addEvent720(x + 180, TriggerValue::FALL, TriggerWheel::T_SECONDARY);
25 9 s->addEvent720(360, TriggerValue::RISE, TriggerWheel::T_PRIMARY);
26
27 9 s->addEvent720(x + 180 + y, TriggerValue::RISE, TriggerWheel::T_SECONDARY);
28 9 s->addEvent720(x + 360, TriggerValue::FALL, TriggerWheel::T_SECONDARY);
29 9 s->addEvent720(x + 360 + y, TriggerValue::RISE, TriggerWheel::T_SECONDARY);
30 9 s->addEvent720(x + 540, TriggerValue::FALL, TriggerWheel::T_SECONDARY);
31 9 s->addEvent720(720, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
32 9 }
33
34 3 void initializeMitsubishi4gSymmetricalCrank(TriggerWaveform *s) {
35 3 initializeSkippedToothTrigger(s, /* reality */2 * /* symmetrical*/0.5,
36 0, FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR, SyncEdge::RiseOnly);
37 #if EFI_UNIT_TEST
38 3 s->knownOperationMode = true; // this is always placed on crank, overriding 'initializeSkippedToothTrigger' value
39 #endif
40 3 }
41
42 // https://github.com/rusefi/rusefi/issues/5593
43 12 void initializeVvt6G72(TriggerWaveform *s) {
44 12 s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::Both);
45
46 //happy ratio 0.548387 @ 0
47 //happy ratio 0.941176 @ 1
48 //happy ratio 0.500000 @ 2
49 //happy ratio 3.750002 @ 3
50 //happy ratio 0.266667 @ 4
51 //happy ratio 3.250000 @ 5
52 //happy ratio 0.307692 @ 6
53 //happy ratio 3.875000 @ 7
54
55 // real working ranges for all of the engine states
56 12 s->setTriggerSynchronizationGap3(0, 1.3, 3.2);
57 12 s->setTriggerSynchronizationGap3(1, 0.3, 0.66);
58 12 s->setTriggerSynchronizationGap3(2, 1.3, 3.2);
59 12 s->setTriggerSynchronizationGap3(3, 0.3, 0.66);
60 12 s->setTriggerSynchronizationGap3(4, 1.3, 3.2);
61
62 12 s->addEvent360(52.5, TriggerValue::FALL);
63 12 s->addEvent360(82.5, TriggerValue::RISE);
64 12 s->addEvent360(112.5, TriggerValue::FALL);
65 12 s->addEvent360(177.5, TriggerValue::RISE);
66 12 s->addEvent360(207.5, TriggerValue::FALL);
67 12 s->addEvent360(262.5, TriggerValue::RISE);
68 12 s->addEvent360(292.5, TriggerValue::FALL);
69 12 s->addEvent360(360, TriggerValue::RISE);
70 12 }
71
72 5 void initializeMitsubishi4g63Cam(TriggerWaveform *s) {
73 5 s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::Both);
74
75 // nominal gap 0.5
76 5 s->setSecondTriggerSynchronizationGap2(0.2, 0.95);
77
78 // nominal gap 3.0
79 5 s->setTriggerSynchronizationGap2(2.0f, 5.0f);
80
81 // 131 deg before #1 TDC
82 // 49 deg after #1 TDC
83 5 s->addToothRiseFall(225, /*width*/90);
84
85 // 131 deg before #4 TDC
86 // 41 deg before #4 TDC
87 5 s->addToothRiseFall(360, /*width*/45);
88 5 }
89
90 2 void initialize36_2_1_1(TriggerWaveform *s) {
91 2 s->initialize(FOUR_STROKE_CRANK_SENSOR, SyncEdge::RiseOnly);
92 2 s->tdcPosition = 90;
93 2 int totalTeethCount = 36;
94
95 2 float engineCycle = FOUR_STROKE_ENGINE_CYCLE;
96 2 float toothWidth = 0.5;
97
98 2 float oneTooth = 720 / totalTeethCount;
99
100 2 float offset = (36 - 11 - 12 - 11) * oneTooth;
101
102 2 addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle,
103 2 NO_LEFT_FILTER, offset + 11 * oneTooth + 1);
104
105 2 offset += (11 + 1) * oneTooth;
106
107 2 addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle,
108 2 NO_LEFT_FILTER, offset + 11 * oneTooth + 1);
109
110
111 2 offset += (11 + 1) * oneTooth;
112
113 2 addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle,
114 2 NO_LEFT_FILTER, offset + 10 * oneTooth + 1);
115
116 2 s->setTriggerSynchronizationGap(3);
117 2 s->setSecondTriggerSynchronizationGap(1); // redundancy
118 2 }
119
120 // Mitsubishi 4B11
121 // https://github.com/rusefi/rusefi/wiki/All-Supported-Triggers#36-2-1
122 5 void initialize36_2_1(TriggerWaveform *s) {
123 5 s->initialize(FOUR_STROKE_CRANK_SENSOR, SyncEdge::RiseOnly);
124 5 s->tdcPosition = 90;
125 5 int totalTeethCount = 36;
126
127 5 float engineCycle = FOUR_STROKE_ENGINE_CYCLE;
128 5 float toothWidth = 0.5;
129
130 5 float oneTooth = 720 / totalTeethCount;
131
132 5 float offset = (36 - 16 - 2 - 17) * oneTooth;
133
134 5 addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle,
135 5 NO_LEFT_FILTER, offset + 16 * oneTooth + 1);
136
137 5 offset += (16 + 2) * oneTooth;
138
139 5 addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle,
140 5 NO_LEFT_FILTER, offset + 17 * oneTooth + 1);
141
142
143 5 s->setTriggerSynchronizationGap(3);
144 5 s->setSecondTriggerSynchronizationGap(1); // redundancy
145 5 }
146
147 4 void initializeVvt3A92(TriggerWaveform *s) {
148 4 s->initialize(FOUR_STROKE_CRANK_SENSOR, SyncEdge::RiseOnly);
149
150 4 int w = 5;
151 4 s->addToothRiseFall(120, w);
152
153 4 s->addToothRiseFall(12 + 120, w);
154
155 4 s->addToothRiseFall(240, w);
156
157 4 s->addToothRiseFall(360, w);
158
159 4 s->setTriggerSynchronizationGap(9);
160 4 s->setSecondTriggerSynchronizationGap(0.11); // redundancy
161 4 }
162
163 1 void initializeMitsubishi4G69Cam(TriggerWaveform *s) {
164 1 s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::RiseOnly);
165
166 1 int tooth = 5;
167
168 1 int extraTooth = 20;
169
170 1 s->addEvent360( 90 - tooth, TriggerValue::RISE, TriggerWheel::T_PRIMARY);
171 1 s->addEvent360( 90, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
172
173 1 s->addEvent360(180 - extraTooth - tooth, TriggerValue::RISE, TriggerWheel::T_PRIMARY);
174 1 s->addEvent360(180 - extraTooth, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
175
176 1 s->addEvent360(180 - tooth, TriggerValue::RISE, TriggerWheel::T_PRIMARY);
177 1 s->addEvent360(180, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
178
179 1 s->addEvent360(270 - extraTooth - tooth, TriggerValue::RISE, TriggerWheel::T_PRIMARY);
180 1 s->addEvent360(270 - extraTooth, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
181
182 1 s->addEvent360(270 - tooth, TriggerValue::RISE, TriggerWheel::T_PRIMARY);
183 1 s->addEvent360(270, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
184
185 1 s->addEvent360(360 - tooth, TriggerValue::RISE, TriggerWheel::T_PRIMARY);
186 1 s->addEvent360(360, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
187
188 1 s->setTriggerSynchronizationGap(1);
189 1 s->setSecondTriggerSynchronizationGap(4.5);
190 1 }
191