GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 91.4% 139 / 0 / 152
Functions: 100.0% 15 / 0 / 15
Branches: 81.5% 132 / 0 / 162
Decisions: 78.0% 64 / - / 82

firmware/controllers/limp_manager.cpp
Line Branch Decision Exec Source
1 #include "pch.h"
2
3 #include "limp_manager.h"
4 #include "fuel_math.h"
5 #include "main_trigger_callback.h"
6
7 #if EFI_ENGINE_CONTROL
8
9 #define CLEANUP_MODE_TPS 90
10
11 #if EFI_SHAFT_POSITION_INPUT
12 91185 static bool noFiringUntilVvtSync() {
13 91185 auto operationMode = getEngineRotationState()->getOperationMode();
14
15
2/2
✓ Branch 0 taken 14514 times.
✓ Branch 1 taken 76671 times.
2/2
✓ Decision 'true' taken 14514 times.
✓ Decision 'false' taken 76671 times.
91185 if (engineConfiguration->isPhaseSyncRequiredForIgnition) {
16 // in rare cases engines do not like random sequential mode
17 14514 return true;
18 }
19 76671 if (isGdiEngine()) {
20 #if EFI_PROD_CODE
21 criticalError("For GDI please configure CAM and require sync for ignition");
22 #endif
23 }
24
25
2/2
✓ Branch 0 taken 41111 times.
✓ Branch 1 taken 35560 times.
2/2
✓ Decision 'true' taken 41111 times.
✓ Decision 'false' taken 35560 times.
76671 if (engineConfiguration->ignitionMode == IM_ONE_COIL) {
26 // distributor routes to the correct cylinder, no need to worry about sync
27 41111 return false;
28 }
29
30 // Symmetrical crank modes require cam sync before firing
31 // non-symmetrical cranks can use faster spin-up mode (firing in wasted/batch before VVT sync)
32 // Examples include Nissan MR/VQ, Miata NB, etc
33 return
34
1/2
✓ Branch 0 taken 32074 times.
✗ Branch 1 not taken.
32074 operationMode == FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR ||
35
3/4
✓ Branch 0 taken 32074 times.
✓ Branch 1 taken 3486 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 32074 times.
67634 operationMode == FOUR_STROKE_THREE_TIMES_CRANK_SENSOR ||
36 35560 operationMode == FOUR_STROKE_TWELVE_TIMES_CRANK_SENSOR;
37 }
38 #endif // EFI_SHAFT_POSITION_INPUT
39
40 91142 void LimpManager::onFastCallback() {
41 91142 updateState(Sensor::getOrZero(SensorType::Rpm), getTimeNowNt());
42 91142 }
43
44 182325 void LimpManager::updateRevLimit(float rpm) {
45 // User-configured hard RPM limit, either constant or CLT-lookup
46 364650 m_revLimit = engineConfiguration->useCltBasedRpmLimit
47
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 182319 times.
182325 ? interpolate2d(Sensor::getOrZero(SensorType::Clt), config->cltRevLimitRpmBins, config->cltRevLimitRpm)
48 182319 : (float)engineConfiguration->rpmHardLimit;
49
50 // Require configurable rpm drop before resuming
51 182325 resumeRpm = m_revLimit - engineConfiguration->rpmHardLimitHyst;
52
53 182325 m_timingRetard = interpolateClamped(resumeRpm, 0, m_revLimit, engineConfiguration->rpmSoftLimitTimingRetard, rpm);
54
55 182325 percent_t fuelAdded = interpolateClamped(resumeRpm, 0, m_revLimit, engineConfiguration->rpmSoftLimitFuelAdded, rpm);
56 182325 m_fuelCorrection = 1.0f + fuelAdded / 100;
57 182325 }
58
59 91185 void LimpManager::updateState(float rpm, efitick_t nowNt) {
60 91185 Clearable allowFuel = engineConfiguration->isInjectionEnabled;
61 91185 Clearable allowSpark = engineConfiguration->isIgnitionEnabled;
62
63 #if EFI_SHAFT_POSITION_INPUT && !EFI_UNIT_TEST
64 if (!m_ignitionOn
65 && !engine->triggerCentral.directSelfStimulation // useful to try things on real ECU even without ignition voltage
66 ) {
67 allowFuel.clear(ClearReason::IgnitionOff);
68 allowSpark.clear(ClearReason::IgnitionOff);
69 }
70 #endif
71
72
5/7
✓ Branch 1 taken 91185 times.
✓ Branch 3 taken 185 times.
✓ Branch 4 taken 91000 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 185 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 91185 times.
1/2
✗ Decision 'true' not taken.
✓ Decision 'false' taken 91185 times.
91185 if (isGdiEngine() && engineConfiguration->externalRusEfiGdiModule) {
73 if (externalGdiCanBusComms.getElapsedSeconds() > 1) {
74 allowFuel.clear(ClearReason::GdiComms);
75 }
76 }
77
78
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 91185 times.
1/2
✗ Decision 'true' not taken.
✓ Decision 'false' taken 91185 times.
91185 if (engine->engineState.lua.luaIgnCut) {
79 allowSpark.clear(ClearReason::Lua);
80 }
81
82
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 91185 times.
1/2
✗ Decision 'true' not taken.
✓ Decision 'false' taken 91185 times.
91185 if (engine->engineState.lua.luaFuelCut) {
83 allowFuel.clear(ClearReason::Lua);
84 }
85
86
1/1
✓ Branch 1 taken 91185 times.
91185 updateRevLimit(rpm);
87
3/3
✓ Branch 1 taken 91185 times.
✓ Branch 3 taken 112 times.
✓ Branch 4 taken 91073 times.
2/2
✓ Decision 'true' taken 112 times.
✓ Decision 'false' taken 91073 times.
91185 if (m_revLimitHysteresis.test(rpm, m_revLimit, resumeRpm)) {
88
1/2
✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
1/2
✓ Decision 'true' taken 112 times.
✗ Decision 'false' not taken.
112 if (engineConfiguration->cutFuelOnHardLimit) {
89 112 allowFuel.clear(ClearReason::HardLimit);
90 }
91
92
1/2
✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
1/2
✓ Decision 'true' taken 112 times.
✗ Decision 'false' not taken.
112 if (engineConfiguration->cutSparkOnHardLimit) {
93 112 allowSpark.clear(ClearReason::HardLimit);
94 }
95 }
96
97 #if EFI_SHAFT_POSITION_INPUT
98
2/3
✓ Branch 1 taken 91185 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 91185 times.
1/2
✗ Decision 'true' not taken.
✓ Decision 'false' taken 91185 times.
91185 if (engine->lambdaMonitor.isCut()) {
99 allowFuel.clear(ClearReason::LambdaProtection);
100 }
101
102
1/1
✓ Branch 1 taken 91185 times.
2/2
✓ Decision 'true' taken 8602 times.
✓ Decision 'false' taken 82583 times.
91185 if (noFiringUntilVvtSync()
103
6/6
✓ Branch 0 taken 18000 times.
✓ Branch 1 taken 73185 times.
✓ Branch 3 taken 8602 times.
✓ Branch 4 taken 9398 times.
✓ Branch 5 taken 8602 times.
✓ Branch 6 taken 82583 times.
91185 && !engine->triggerCentral.triggerState.hasSynchronizedPhase()) {
104 // Any engine that requires cam-assistance for a full crank sync (symmetrical crank) can't schedule until we have cam sync
105 // examples:
106 // NB2, Nissan VQ/MR: symmetrical crank wheel and we need to make sure no spark happens out of sync
107 // VTwin Harley: uneven firing order, so we need "cam" MAP sync to make sure no spark happens out of sync
108 8602 allowFuel.clear(ClearReason::EnginePhase);
109 8602 allowSpark.clear(ClearReason::EnginePhase);
110 }
111
112 // Force fuel limiting on the fault rev limit
113
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 91185 times.
1/2
✗ Decision 'true' not taken.
✓ Decision 'false' taken 91185 times.
91185 if (rpm > m_faultRevLimit) {
114 allowFuel.clear(m_rpmLimitReason);
115 }
116
117 // Limit fuel only on boost pressure (limiting spark bends valves)
118 91185 float mapCut = engineConfiguration->boostCutPressure;
119
2/2
✓ Branch 0 taken 91184 times.
✓ Branch 1 taken 1 time.
2/2
✓ Decision 'true' taken 91184 times.
✓ Decision 'false' taken 1 time.
91185 if (mapCut != 0) {
120 // require drop of 'boostCutPressureHyst' kPa to resume fuel
121
4/4
✓ Branch 2 taken 91184 times.
✓ Branch 5 taken 91184 times.
✓ Branch 7 taken 4 times.
✓ Branch 8 taken 91180 times.
2/2
✓ Decision 'true' taken 4 times.
✓ Decision 'false' taken 91180 times.
91184 if (m_boostCutHysteresis.checkIfLimitIsExceeded(Sensor::getOrZero(SensorType::Map), mapCut, engineConfiguration->boostCutPressureHyst)) {
122 4 allowFuel.clear(ClearReason::BoostCut);
123 }
124 }
125
126
3/3
✓ Branch 1 taken 91185 times.
✓ Branch 3 taken 20876 times.
✓ Branch 4 taken 70309 times.
2/2
✓ Decision 'true' taken 20876 times.
✓ Decision 'false' taken 70309 times.
91185 if (engine->rpmCalculator.isRunning()) {
127
1/1
✓ Branch 1 taken 20876 times.
20876 bool hasOilpSensor = Sensor::hasSensor(SensorType::OilPressure);
128
1/1
✓ Branch 2 taken 20876 times.
20876 auto oilp = Sensor::get(SensorType::OilPressure);
129 20876 uint16_t minOilPressure = engineConfiguration->minOilPressureAfterStart;
130
131 // Only check if the setting is enabled and you have an oil pressure sensor
132
3/4
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 20867 times.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
2/2
✓ Decision 'true' taken 9 times.
✓ Decision 'false' taken 20867 times.
20876 if (minOilPressure > 0 && hasOilpSensor) {
133 // Has it been long enough we should have pressure?
134
1/1
✓ Branch 1 taken 9 times.
9 bool isTimedOut = engine->rpmCalculator.getSecondsSinceEngineStart(nowNt) > 5.0f;
135
136 // Only check before timed out
137
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 4 times.
2/2
✓ Decision 'true' taken 5 times.
✓ Decision 'false' taken 4 times.
9 if (!isTimedOut) {
138
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
1/2
✓ Decision 'true' taken 5 times.
✗ Decision 'false' not taken.
5 if (oilp) {
139 // We had oil pressure! Set the flag.
140
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 4 times.
2/2
✓ Decision 'true' taken 1 time.
✓ Decision 'false' taken 4 times.
5 if (oilp.Value > minOilPressure) {
141 1 m_hadOilPressureAfterStart = true;
142 }
143 }
144 }
145
146 // If time is up, the sensor works, and no pressure, kill the engine.
147
4/4
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 2 times.
2/2
✓ Decision 'true' taken 2 times.
✓ Decision 'false' taken 7 times.
9 if (isTimedOut && !m_hadOilPressureAfterStart) {
148 2 allowFuel.clear(ClearReason::OilPressure);
149 }
150 }
151
152
6/6
✓ Branch 1 taken 19 times.
✓ Branch 2 taken 20857 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 14 times.
✓ Branch 5 taken 5 times.
✓ Branch 6 taken 20871 times.
2/2
✓ Decision 'true' taken 5 times.
✓ Decision 'false' taken 20871 times.
20876 if (oilp && engineConfiguration->enableOilPressureProtect) {
153
1/1
✓ Branch 1 taken 5 times.
5 float minPressure = interpolate2d(rpm, config->minimumOilPressureBins, config->minimumOilPressureValues);
154 5 bool isPressureSufficient = oilp.Value > minPressure;
155
156
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
2/2
✓ Decision 'true' taken 3 times.
✓ Decision 'false' taken 2 times.
5 if (isPressureSufficient) {
157
1/1
✓ Branch 1 taken 3 times.
3 m_lowOilPressureTimer.reset(nowNt);
158 }
159
160
3/3
✓ Branch 2 taken 5 times.
✓ Branch 4 taken 1 time.
✓ Branch 5 taken 4 times.
2/2
✓ Decision 'true' taken 1 time.
✓ Decision 'false' taken 4 times.
5 if (m_lowOilPressureTimer.hasElapsedSec(engineConfiguration->minimumOilPressureTimeout)) {
161 1 allowFuel.clear(ClearReason::OilPressure);
162 }
163 }
164
165 // check the maximum oil pressure
166
1/1
✓ Branch 1 taken 20876 times.
20876 float maxOilPressure = interpolate2d(rpm, config->maximumOilPressureBins, config->maximumOilPressureValues);
167
3/4
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 20871 times.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
2/2
✓ Decision 'true' taken 5 times.
✓ Decision 'false' taken 20871 times.
20876 if (maxOilPressure > 0 && hasOilpSensor) {
168
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
2/2
✓ Decision 'true' taken 3 times.
✓ Decision 'false' taken 2 times.
5 if (oilp.Value < maxOilPressure) {
169
1/1
✓ Branch 1 taken 3 times.
3 m_highOilPressureTimer.reset(nowNt);
170 }
171
3/3
✓ Branch 2 taken 5 times.
✓ Branch 4 taken 1 time.
✓ Branch 5 taken 4 times.
2/2
✓ Decision 'true' taken 1 time.
✓ Decision 'false' taken 4 times.
5 if (m_highOilPressureTimer.hasElapsedSec(engineConfiguration->maxOilPressureTimeout)) {
172 1 allowFuel.clear(ClearReason::OilPressure);
173 }
174 }
175
176 } else {
177 // reset state in case of stalled engine
178 70309 m_hadOilPressureAfterStart = false;
179
1/1
✓ Branch 1 taken 70309 times.
70309 m_lowOilPressureTimer.reset(nowNt);
180 }
181
182 // If we're in engine stop mode, inhibit fuel
183
2/3
✓ Branch 1 taken 91185 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 91185 times.
1/2
✗ Decision 'true' not taken.
✓ Decision 'false' taken 91185 times.
91185 if (shutdownController.isEngineStop(nowNt)) {
184 /**
185 * todo: we need explicit clarification on why do we cut fuel but do not cut spark here!
186 */
187 allowFuel.clear(ClearReason::StopRequested);
188 }
189
190 {
191 // todo: we need to add some tests of this?
192 // If duty cycle is high, impose a fuel cut rev limiter.
193 // This is safer than attempting to limp along with injectors or a pump that are out of flow.
194 // Two conditions will trigger a cut:
195 // - An instantaneous excursion above maxInjectorDutyInstant
196 // - A sustained excursion above maxInjectorDutySustained for a duration of >= maxInjectorDutySustainedTimeout
197 // Only reset once below 20% duty to force the driver to lift off the pedal
198
199
1/1
✓ Branch 1 taken 91185 times.
91185 auto injDutyCycle = getInjectorDutyCycle(rpm);
200 91185 bool isOverInstantDutyCycle = injDutyCycle > engineConfiguration->maxInjectorDutyInstant;
201 91185 bool isOverSustainedDutyCycle = injDutyCycle > engineConfiguration->maxInjectorDutySustained;
202 91185 bool isUnderLowDuty = injDutyCycle < 20;
203
204
1/2
✓ Branch 0 taken 91185 times.
✗ Branch 1 not taken.
1/2
✓ Decision 'true' taken 91185 times.
✗ Decision 'false' not taken.
91185 if (!isOverSustainedDutyCycle) {
205 // Duty cycle is OK, reset timer.
206
1/1
✓ Branch 1 taken 91185 times.
91185 m_injectorDutySustainedTimer.reset(nowNt);
207 }
208
209 // True if isOverSustainedDutyCycle has been true for longer than the timeout
210
1/1
✓ Branch 2 taken 91185 times.
91185 bool sustainedLimitTimedOut = m_injectorDutySustainedTimer.hasElapsedSec(engineConfiguration->maxInjectorDutySustainedTimeout);
211
212
2/4
✓ Branch 0 taken 91185 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 91185 times.
91185 bool someLimitTripped = isOverInstantDutyCycle || sustainedLimitTimedOut;
213
214
2/3
✓ Branch 1 taken 91185 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 91185 times.
1/2
✗ Decision 'true' not taken.
✓ Decision 'false' taken 91185 times.
91185 if (m_injectorDutyCutHysteresis.test(someLimitTripped, isUnderLowDuty)) {
215 allowFuel.clear(ClearReason::InjectorDutyCycle);
216 warning(ObdCode::CUSTOM_TOO_LONG_FUEL_INJECTION, "Injector duty cycle cut %.1f", injDutyCycle);
217 }
218 }
219
220 {
221 // GDI Fuel cut
222 91185 bool isGDIDriverInjectorTimeTooLong = engine->engineState.injectionDuration > engineConfiguration->mc33_t_hold_tot;
223
224
7/7
✓ Branch 1 taken 91185 times.
✓ Branch 3 taken 185 times.
✓ Branch 4 taken 91000 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 184 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 91184 times.
2/2
✓ Decision 'true' taken 1 time.
✓ Decision 'false' taken 91184 times.
91185 if (isGdiEngine() && isGDIDriverInjectorTimeTooLong) {
225 1 allowFuel.clear(ClearReason::GdiLimits);
226
1/1
✓ Branch 1 taken 1 time.
1 warning(ObdCode::CUSTOM_TOO_LONG_FUEL_INJECTION, "Injection duration excess PT2001 limits time: %.4f", engine->engineState.injectionDuration);
227 }
228 }
229
230 // If the pedal is pushed while not running, cut fuel to clear a flood condition.
231
1/1
✓ Branch 1 taken 91185 times.
1/2
✗ Decision 'true' not taken.
✓ Decision 'false' taken 91185 times.
91185 if (!engine->rpmCalculator.isRunning() &&
232
4/6
✓ Branch 0 taken 70309 times.
✓ Branch 1 taken 20876 times.
✓ Branch 2 taken 70309 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 91185 times.
161494 engineConfiguration->isCylinderCleanupEnabled &&
233
2/3
✓ Branch 1 taken 70309 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 70309 times.
70309 Sensor::getOrZero(SensorType::DriverThrottleIntent) > CLEANUP_MODE_TPS) {
234 allowFuel.clear(ClearReason::FloodClear);
235 }
236 #endif // EFI_SHAFT_POSITION_INPUT
237
238 #if EFI_LAUNCH_CONTROL
239 // Fuel cut if launch control engaged
240
2/3
✓ Branch 1 taken 91185 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 91185 times.
1/2
✗ Decision 'true' not taken.
✓ Decision 'false' taken 91185 times.
91185 if (engine->launchController.isLaunchFuelRpmRetardCondition()) {
241 allowFuel.clear(ClearReason::LaunchCut);
242 }
243
244 // Spark cut if launch control engaged
245
3/3
✓ Branch 1 taken 91185 times.
✓ Branch 3 taken 608 times.
✓ Branch 4 taken 90577 times.
2/2
✓ Decision 'true' taken 608 times.
✓ Decision 'false' taken 90577 times.
91185 if (engine->launchController.isLaunchSparkRpmRetardCondition()) {
246 608 allowSpark.clear(ClearReason::LaunchCut);
247 }
248 #endif // EFI_LAUNCH_CONTROL
249
250 91185 m_transientAllowInjection = allowFuel;
251 91185 m_transientAllowIgnition = allowSpark;
252
253
6/6
✓ Branch 1 taken 71660 times.
✓ Branch 2 taken 19525 times.
✓ Branch 4 taken 909 times.
✓ Branch 5 taken 70751 times.
✓ Branch 6 taken 20434 times.
✓ Branch 7 taken 70751 times.
2/2
✓ Decision 'true' taken 20434 times.
✓ Decision 'false' taken 70751 times.
91185 if (!m_transientAllowInjection || !m_transientAllowIgnition) {
254 // Tracks the last time any cut happened
255
1/1
✓ Branch 1 taken 20434 times.
20434 m_lastCutTime.reset(nowNt);
256 }
257 91185 }
258
259 1 void LimpManager::onIgnitionStateChanged(bool ignitionOn) {
260 1 m_ignitionOn = ignitionOn;
261 1 }
262
263 1 void LimpManager::reportEtbJammed() {
264 1 m_allowEtb.clear(ClearReason::EtbProblem);
265 1 setFaultRevLimit(/*rpm*/1500, ClearReason::EtbJammedRevLimit);
266 1 }
267
268 2 void LimpManager::fatalError() {
269 2 m_allowEtb.clear(ClearReason::Fatal);
270 2 m_allowIgnition.clear(ClearReason::Fatal);
271 2 m_allowInjection.clear(ClearReason::Fatal);
272 2 m_allowTriggerInput.clear(ClearReason::Fatal);
273
274 2 setFaultRevLimit(/*rpm*/0, ClearReason::FatalErrorRevLimit);
275 2 }
276
277 3 void LimpManager::setFaultRevLimit(int limit, ClearReason rpmLimitReason) {
278 // Only allow decreasing the limit
279 // aka uses the limit of the worst fault to yet occur
280
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
1/2
✓ Decision 'true' taken 3 times.
✗ Decision 'false' not taken.
3 if (limit < m_faultRevLimit) {
281 3 m_faultRevLimit = limit;
282 3 m_rpmLimitReason = rpmLimitReason;
283 }
284 3 }
285
286 #if EFI_ELECTRONIC_THROTTLE_BODY
287 417 bool LimpManager::allowElectronicThrottle() const {
288
3/4
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
417 return m_allowEtb || engine->etbIgnoreJamProtection;
289 }
290 #endif // EFI_ELECTRONIC_THROTTLE_BODY
291
292 71954 bool LimpManager::allowTriggerInput() const {
293 71954 return m_allowTriggerInput;
294 }
295
296 33186 LimpState LimpManager::allowInjection() const {
297
2/2
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 33185 times.
2/2
✓ Decision 'true' taken 1 time.
✓ Decision 'false' taken 33185 times.
33186 if (!m_allowInjection) {
298 1 return {false, m_allowInjection.clearReason};
299 }
300
2/2
✓ Branch 1 taken 2240 times.
✓ Branch 2 taken 30945 times.
2/2
✓ Decision 'true' taken 2240 times.
✓ Decision 'false' taken 30945 times.
33185 if (!m_transientAllowInjection) {
301 2240 return {false, m_transientAllowInjection.clearReason};
302 }
303 30945 return {true, ClearReason::None};
304 }
305
306 32486 LimpState LimpManager::allowIgnition() const {
307
2/2
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 32485 times.
2/2
✓ Decision 'true' taken 1 time.
✓ Decision 'false' taken 32485 times.
32486 if (!m_allowIgnition) {
308 1 return {false, m_allowIgnition.clearReason};
309 }
310
2/2
✓ Branch 1 taken 221 times.
✓ Branch 2 taken 32264 times.
2/2
✓ Decision 'true' taken 221 times.
✓ Decision 'false' taken 32264 times.
32485 if (!m_transientAllowIgnition) {
311 221 return {false, m_transientAllowIgnition.clearReason};
312 }
313 32264 return {true, ClearReason::None};
314 }
315
316 81630 angle_t LimpManager::getLimitingTimingRetard() const {
317
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 81630 times.
1/2
✗ Decision 'true' not taken.
✓ Decision 'false' taken 81630 times.
81630 if (!engineConfiguration->cutSparkOnHardLimit)
318 return 0;
319 81630 return m_timingRetard;
320 }
321
322 61654 float LimpManager::getLimitingFuelCorrection() const {
323
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 61654 times.
1/2
✗ Decision 'true' not taken.
✓ Decision 'false' taken 61654 times.
61654 if (!engineConfiguration->cutFuelOnHardLimit)
324 return 1.0f; // no correction
325 61654 return m_fuelCorrection;
326 }
327
328 1 float LimpManager::getTimeSinceAnyCut() const {
329 1 return m_lastCutTime.getElapsedSeconds();
330 }
331 #endif // EFI_ENGINE_CONTROL
332