limp ClearReason

This commit is contained in:
rusefillc 2022-01-08 22:13:20 -05:00
parent c819f327ae
commit 177a5faa63
11 changed files with 168 additions and 106 deletions

View File

@ -194,6 +194,8 @@ entry = tps12Split, "tps12Split", float, "%.3f"
entry = accPedalSplit, "accPedalSplit", float, "%.3f"
entry = m_requested_pump, "DI: Pump Angle", float, "%.3f"
entry = boostControlTarget, "Pump Angle", float, "%.3f"
entry = sparkCutReason, "Spark Cut Code", int, "%d"
entry = fuelCutReason, "Fuel Cut Code", int, "%d"
entry = fuel_requested_percent, "DI: fuel_requested_percent", float, "%.3f"
entry = fuel_requested_percent_pi, "DI: fuel_requested_percent_pi", float, "%.3f"
entry = m_I_sum_percent, "DI: m_I_sum_percent", float, "%.3f"

View File

@ -194,7 +194,8 @@ tps12SplitGauge = tps12Split,"tps12Split", "%", 0.0,0.0, 0.0,0.0, 0.0,0.0, 0,0
accPedalSplitGauge = accPedalSplit,"accPedalSplit", "%", 0.0,0.0, 0.0,0.0, 0.0,0.0, 0,0
m_requested_pumpGauge = m_requested_pump,"DI: Pump Angle", "deg", 0.0,0.0, 0.0,0.0, 0.0,0.0, 0,0
boostControlTargetGauge = boostControlTarget,"Pump Angle", "deg", 0.0,0.0, 0.0,0.0, 0.0,0.0, 0,0
unusedHere1111Gauge = unusedHere1111,"Pump Angle", "deg", 0.0,0.0, 0.0,0.0, 0.0,0.0, 0,0
sparkCutReasonGauge = sparkCutReason,"Spark Cut Code", "code", 0.0,0.0, 0.0,0.0, 0.0,0.0, 0,0
fuelCutReasonGauge = fuelCutReason,"Fuel Cut Code", "code", 0.0,0.0, 0.0,0.0, 0.0,0.0, 0,0
fuel_requested_percentGauge = fuel_requested_percent,"DI: fuel_requested_percent", "v", 0.0,100.0, 0.0,100.0, 0.0,100.0, 0,0
fuel_requested_percent_piGauge = fuel_requested_percent_pi,"DI: fuel_requested_percent_pi", "v", 0.0,100.0, 0.0,100.0, 0.0,100.0, 0,0
m_I_sum_percentGauge = m_I_sum_percent,"DI: m_I_sum_percent", "v", 0.0,100.0, 0.0,100.0, 0.0,100.0, 0,0
@ -234,31 +235,31 @@ launchActivateSwitchConditionGauge = launchActivateSwitchCondition,"launchActiva
launchIsLaunchConditionGauge = launchIsLaunchCondition,"launchIsLaunchCondition", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
launchCombinedConditionsGauge = launchCombinedConditions,"launchCombinedConditions", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
launchActivatePinStateGauge = launchActivatePinState,"launchActivatePinState", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_7Gauge = unusedBit_178_7,"unusedBit_178_7", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_8Gauge = unusedBit_178_8,"unusedBit_178_8", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_9Gauge = unusedBit_178_9,"unusedBit_178_9", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_10Gauge = unusedBit_178_10,"unusedBit_178_10", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_11Gauge = unusedBit_178_11,"unusedBit_178_11", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_12Gauge = unusedBit_178_12,"unusedBit_178_12", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_13Gauge = unusedBit_178_13,"unusedBit_178_13", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_14Gauge = unusedBit_178_14,"unusedBit_178_14", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_15Gauge = unusedBit_178_15,"unusedBit_178_15", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_16Gauge = unusedBit_178_16,"unusedBit_178_16", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_17Gauge = unusedBit_178_17,"unusedBit_178_17", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_18Gauge = unusedBit_178_18,"unusedBit_178_18", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_19Gauge = unusedBit_178_19,"unusedBit_178_19", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_20Gauge = unusedBit_178_20,"unusedBit_178_20", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_21Gauge = unusedBit_178_21,"unusedBit_178_21", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_22Gauge = unusedBit_178_22,"unusedBit_178_22", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_23Gauge = unusedBit_178_23,"unusedBit_178_23", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_24Gauge = unusedBit_178_24,"unusedBit_178_24", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_25Gauge = unusedBit_178_25,"unusedBit_178_25", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_26Gauge = unusedBit_178_26,"unusedBit_178_26", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_27Gauge = unusedBit_178_27,"unusedBit_178_27", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_28Gauge = unusedBit_178_28,"unusedBit_178_28", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_29Gauge = unusedBit_178_29,"unusedBit_178_29", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_30Gauge = unusedBit_178_30,"unusedBit_178_30", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_178_31Gauge = unusedBit_178_31,"unusedBit_178_31", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_7Gauge = unusedBit_179_7,"unusedBit_179_7", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_8Gauge = unusedBit_179_8,"unusedBit_179_8", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_9Gauge = unusedBit_179_9,"unusedBit_179_9", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_10Gauge = unusedBit_179_10,"unusedBit_179_10", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_11Gauge = unusedBit_179_11,"unusedBit_179_11", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_12Gauge = unusedBit_179_12,"unusedBit_179_12", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_13Gauge = unusedBit_179_13,"unusedBit_179_13", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_14Gauge = unusedBit_179_14,"unusedBit_179_14", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_15Gauge = unusedBit_179_15,"unusedBit_179_15", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_16Gauge = unusedBit_179_16,"unusedBit_179_16", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_17Gauge = unusedBit_179_17,"unusedBit_179_17", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_18Gauge = unusedBit_179_18,"unusedBit_179_18", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_19Gauge = unusedBit_179_19,"unusedBit_179_19", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_20Gauge = unusedBit_179_20,"unusedBit_179_20", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_21Gauge = unusedBit_179_21,"unusedBit_179_21", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_22Gauge = unusedBit_179_22,"unusedBit_179_22", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_23Gauge = unusedBit_179_23,"unusedBit_179_23", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_24Gauge = unusedBit_179_24,"unusedBit_179_24", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_25Gauge = unusedBit_179_25,"unusedBit_179_25", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_26Gauge = unusedBit_179_26,"unusedBit_179_26", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_27Gauge = unusedBit_179_27,"unusedBit_179_27", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_28Gauge = unusedBit_179_28,"unusedBit_179_28", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_29Gauge = unusedBit_179_29,"unusedBit_179_29", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_30Gauge = unusedBit_179_30,"unusedBit_179_30", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
unusedBit_179_31Gauge = unusedBit_179_31,"unusedBit_179_31", "", -1.0,-1.0, -1.0,-1.0, -1.0,-1.0, -1,-1
TEMPLOG_MAP_AT_CYCLE_COUNTGauge = TEMPLOG_MAP_AT_CYCLE_COUNT,"TEMPLOG_MAP_AT_CYCLE_COUNT", "", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 3,3
boostControllerOutputGauge = boostControllerOutput,"boostControllerOutput", "", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 0,0
boostControllerClosedLoopPartGauge = boostControllerClosedLoopPart,"boostControllerClosedLoopPart", "", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 0,0

View File

@ -194,7 +194,8 @@ tps12Split = scalar, S16, 330, "%", 0.01, 0
accPedalSplit = scalar, S16, 332, "%", 0.01, 0
m_requested_pump = scalar, S16, 334, "deg", 0.02, 0
boostControlTarget = scalar, S16, 336, "deg", 0.03333333333333333, 0
unusedHere1111 = scalar, S16, 338, "deg", 0.03333333333333333, 0
sparkCutReason = scalar, S08, 338, "code", 1, 0
fuelCutReason = scalar, S08, 339, "code", 1, 0
fuel_requested_percent = scalar, F32, 340, "v", 1, 0
fuel_requested_percent_pi = scalar, F32, 344, "v", 1, 0
m_I_sum_percent = scalar, F32, 348, "v", 1, 0
@ -234,31 +235,31 @@ launchActivateSwitchCondition = bits, U32, 468, [3:3]
launchIsLaunchCondition = bits, U32, 468, [4:4]
launchCombinedConditions = bits, U32, 468, [5:5]
launchActivatePinState = bits, U32, 468, [6:6]
unusedBit_178_7 = bits, U32, 468, [7:7]
unusedBit_178_8 = bits, U32, 468, [8:8]
unusedBit_178_9 = bits, U32, 468, [9:9]
unusedBit_178_10 = bits, U32, 468, [10:10]
unusedBit_178_11 = bits, U32, 468, [11:11]
unusedBit_178_12 = bits, U32, 468, [12:12]
unusedBit_178_13 = bits, U32, 468, [13:13]
unusedBit_178_14 = bits, U32, 468, [14:14]
unusedBit_178_15 = bits, U32, 468, [15:15]
unusedBit_178_16 = bits, U32, 468, [16:16]
unusedBit_178_17 = bits, U32, 468, [17:17]
unusedBit_178_18 = bits, U32, 468, [18:18]
unusedBit_178_19 = bits, U32, 468, [19:19]
unusedBit_178_20 = bits, U32, 468, [20:20]
unusedBit_178_21 = bits, U32, 468, [21:21]
unusedBit_178_22 = bits, U32, 468, [22:22]
unusedBit_178_23 = bits, U32, 468, [23:23]
unusedBit_178_24 = bits, U32, 468, [24:24]
unusedBit_178_25 = bits, U32, 468, [25:25]
unusedBit_178_26 = bits, U32, 468, [26:26]
unusedBit_178_27 = bits, U32, 468, [27:27]
unusedBit_178_28 = bits, U32, 468, [28:28]
unusedBit_178_29 = bits, U32, 468, [29:29]
unusedBit_178_30 = bits, U32, 468, [30:30]
unusedBit_178_31 = bits, U32, 468, [31:31]
unusedBit_179_7 = bits, U32, 468, [7:7]
unusedBit_179_8 = bits, U32, 468, [8:8]
unusedBit_179_9 = bits, U32, 468, [9:9]
unusedBit_179_10 = bits, U32, 468, [10:10]
unusedBit_179_11 = bits, U32, 468, [11:11]
unusedBit_179_12 = bits, U32, 468, [12:12]
unusedBit_179_13 = bits, U32, 468, [13:13]
unusedBit_179_14 = bits, U32, 468, [14:14]
unusedBit_179_15 = bits, U32, 468, [15:15]
unusedBit_179_16 = bits, U32, 468, [16:16]
unusedBit_179_17 = bits, U32, 468, [17:17]
unusedBit_179_18 = bits, U32, 468, [18:18]
unusedBit_179_19 = bits, U32, 468, [19:19]
unusedBit_179_20 = bits, U32, 468, [20:20]
unusedBit_179_21 = bits, U32, 468, [21:21]
unusedBit_179_22 = bits, U32, 468, [22:22]
unusedBit_179_23 = bits, U32, 468, [23:23]
unusedBit_179_24 = bits, U32, 468, [24:24]
unusedBit_179_25 = bits, U32, 468, [25:25]
unusedBit_179_26 = bits, U32, 468, [26:26]
unusedBit_179_27 = bits, U32, 468, [27:27]
unusedBit_179_28 = bits, U32, 468, [28:28]
unusedBit_179_29 = bits, U32, 468, [29:29]
unusedBit_179_30 = bits, U32, 468, [30:30]
unusedBit_179_31 = bits, U32, 468, [31:31]
TEMPLOG_MAP_AT_CYCLE_COUNT = scalar, U08, 472, "", 1, 0
boostControllerOutput = scalar, U08, 473, "", 1, 0
boostControllerClosedLoopPart = scalar, U08, 474, "", 1, 0

View File

@ -261,7 +261,8 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 0, 0
int16_t autoscale m_requested_pump;"DI: Pump Angle";"deg",{1/@@PACK_MULT_ANGLE@@}, 0, 0, 0, 0
int16_t autoscale boostControlTarget;"Pump Angle";"deg",{1/@@PACK_MULT_PRESSURE@@}, 0, 0, 0, 0
int16_t autoscale unusedHere1111;"Pump Angle";"deg",{1/@@PACK_MULT_PRESSURE@@}, 0, 0, 0, 0
int8_t sparkCutReason;"Spark Cut Code";"code",1, 0, 0, 0, 0
int8_t fuelCutReason;"Fuel Cut Code";"code",1, 0, 0, 0, 0
float fuel_requested_percent;"DI: fuel_requested_percent";"v", 1, 0, 0, 100, 0
float fuel_requested_percent_pi;"DI: fuel_requested_percent_pi";"v", 1, 0, 0, 100, 0
float m_I_sum_percent;"DI: m_I_sum_percent";"v", 1, 0, 0, 100, 0

View File

@ -1,4 +1,4 @@
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) console/binary/output_channels.txt Wed Jan 05 06:47:26 UTC 2022
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) console/binary/output_channels.txt Sat Jan 08 21:38:58 EST 2022
// by class com.rusefi.output.CHeaderConsumer
// begin
#pragma once
@ -864,11 +864,17 @@ struct ts_outputs_s {
*/
scaled_channel<int16_t, 30, 1> boostControlTarget = (int16_t)0;
/**
* "Pump Angle"
deg
* "Spark Cut Code"
code
* offset 338
*/
scaled_channel<int16_t, 30, 1> unusedHere1111 = (int16_t)0;
int8_t sparkCutReason = (int8_t)0;
/**
* "Fuel Cut Code"
code
* offset 339
*/
int8_t fuelCutReason = (int8_t)0;
/**
* "DI: fuel_requested_percent"
v
@ -920,79 +926,79 @@ struct ts_outputs_s {
bool launchActivatePinState : 1 {};
/**
offset 468 bit 7 */
bool unusedBit_178_7 : 1 {};
bool unusedBit_179_7 : 1 {};
/**
offset 468 bit 8 */
bool unusedBit_178_8 : 1 {};
bool unusedBit_179_8 : 1 {};
/**
offset 468 bit 9 */
bool unusedBit_178_9 : 1 {};
bool unusedBit_179_9 : 1 {};
/**
offset 468 bit 10 */
bool unusedBit_178_10 : 1 {};
bool unusedBit_179_10 : 1 {};
/**
offset 468 bit 11 */
bool unusedBit_178_11 : 1 {};
bool unusedBit_179_11 : 1 {};
/**
offset 468 bit 12 */
bool unusedBit_178_12 : 1 {};
bool unusedBit_179_12 : 1 {};
/**
offset 468 bit 13 */
bool unusedBit_178_13 : 1 {};
bool unusedBit_179_13 : 1 {};
/**
offset 468 bit 14 */
bool unusedBit_178_14 : 1 {};
bool unusedBit_179_14 : 1 {};
/**
offset 468 bit 15 */
bool unusedBit_178_15 : 1 {};
bool unusedBit_179_15 : 1 {};
/**
offset 468 bit 16 */
bool unusedBit_178_16 : 1 {};
bool unusedBit_179_16 : 1 {};
/**
offset 468 bit 17 */
bool unusedBit_178_17 : 1 {};
bool unusedBit_179_17 : 1 {};
/**
offset 468 bit 18 */
bool unusedBit_178_18 : 1 {};
bool unusedBit_179_18 : 1 {};
/**
offset 468 bit 19 */
bool unusedBit_178_19 : 1 {};
bool unusedBit_179_19 : 1 {};
/**
offset 468 bit 20 */
bool unusedBit_178_20 : 1 {};
bool unusedBit_179_20 : 1 {};
/**
offset 468 bit 21 */
bool unusedBit_178_21 : 1 {};
bool unusedBit_179_21 : 1 {};
/**
offset 468 bit 22 */
bool unusedBit_178_22 : 1 {};
bool unusedBit_179_22 : 1 {};
/**
offset 468 bit 23 */
bool unusedBit_178_23 : 1 {};
bool unusedBit_179_23 : 1 {};
/**
offset 468 bit 24 */
bool unusedBit_178_24 : 1 {};
bool unusedBit_179_24 : 1 {};
/**
offset 468 bit 25 */
bool unusedBit_178_25 : 1 {};
bool unusedBit_179_25 : 1 {};
/**
offset 468 bit 26 */
bool unusedBit_178_26 : 1 {};
bool unusedBit_179_26 : 1 {};
/**
offset 468 bit 27 */
bool unusedBit_178_27 : 1 {};
bool unusedBit_179_27 : 1 {};
/**
offset 468 bit 28 */
bool unusedBit_178_28 : 1 {};
bool unusedBit_179_28 : 1 {};
/**
offset 468 bit 29 */
bool unusedBit_178_29 : 1 {};
bool unusedBit_179_29 : 1 {};
/**
offset 468 bit 30 */
bool unusedBit_178_30 : 1 {};
bool unusedBit_179_30 : 1 {};
/**
offset 468 bit 31 */
bool unusedBit_178_31 : 1 {};
bool unusedBit_179_31 : 1 {};
/**
* offset 472
*/
@ -1190,4 +1196,4 @@ struct ts_outputs_s {
};
// end
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) console/binary/output_channels.txt Wed Jan 05 06:47:26 UTC 2022
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) console/binary/output_channels.txt Sat Jan 08 21:38:58 EST 2022

View File

@ -656,8 +656,8 @@ static void updateFlags() {
engine->outputChannels.isFanOn = enginePins.fanRelay.getLogicValue();
engine->outputChannels.isFan2On = enginePins.fanRelay2.getLogicValue();
engine->outputChannels.isO2HeaterOn = enginePins.o2heater.getLogicValue();
engine->outputChannels.isIgnitionEnabledIndicator = engine->limpManager.allowIgnition();
engine->outputChannels.isInjectionEnabledIndicator = engine->limpManager.allowInjection();
engine->outputChannels.isIgnitionEnabledIndicator = engine->limpManager.allowIgnition().value;
engine->outputChannels.isInjectionEnabledIndicator = engine->limpManager.allowInjection().value;
engine->outputChannels.isCylinderCleanupActivated = engine->isCylinderCleanupMode;
#if EFI_LAUNCH_CONTROL

View File

@ -398,8 +398,13 @@ void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp) {
return;
}
bool limitedSpark = !engine->limpManager.allowIgnition();
bool limitedFuel = !engine->limpManager.allowInjection();
LimpState limitedSparkState = engine->limpManager.allowIgnition();
engine->outputChannels.sparkCutReason = (int8_t)limitedSparkState.reason;
bool limitedSpark = !limitedSparkState.value;
LimpState limitedFuelState = engine->limpManager.allowInjection();
engine->outputChannels.fuelCutReason = (int8_t)limitedFuelState.reason;
bool limitedFuel = !limitedFuelState.value;
#if EFI_LAUNCH_CONTROL
if (engine->launchController.isLaunchCondition && !limitedSpark && !limitedFuel) {

View File

@ -9,23 +9,23 @@ void LimpManager::updateState(int rpm, efitick_t nowNt) {
// User-configured hard RPM limit
if (rpm > engineConfiguration->rpmHardLimit) {
if (engineConfiguration->cutFuelOnHardLimit) {
allowFuel.clear();
allowFuel.clear(ClearReason::HardLimit);
}
if (engineConfiguration->cutSparkOnHardLimit) {
allowSpark.clear();
allowSpark.clear(ClearReason::HardLimit);
}
}
// Force fuel limiting on the fault rev limit
if (rpm > m_faultRevLimit) {
allowFuel.clear();
allowFuel.clear(ClearReason::FaultRevLimit);
}
// Limit fuel only on boost pressure (limiting spark bends valves)
if (engineConfiguration->boostCutPressure != 0) {
if (Sensor::getOrZero(SensorType::Map) > engineConfiguration->boostCutPressure) {
allowFuel.clear();
allowFuel.clear(ClearReason::BoostCut);
}
}
@ -51,7 +51,7 @@ void LimpManager::updateState(int rpm, efitick_t nowNt) {
// If time is up, the sensor works, and no pressure, kill the engine.
if (isTimedOut && !m_hadOilPressureAfterStart) {
allowFuel.clear();
allowFuel.clear(ClearReason::OilPressure);
}
}
} else {
@ -63,7 +63,7 @@ void LimpManager::updateState(int rpm, efitick_t nowNt) {
/**
* todo: we need explicit clarification on why do we cut fuel but do not cut spark here!
*/
allowFuel.clear();
allowFuel.clear(ClearReason::StopRequested);
}
if (!engine->isMainRelayEnabled()) {
@ -79,15 +79,15 @@ todo AndreiKA this change breaks 22 unit tests?
}
void LimpManager::etbProblem() {
m_allowEtb.clear();
m_allowEtb.clear(ClearReason::EtbProblem);
setFaultRevLimit(1500);
}
void LimpManager::fatalError() {
m_allowEtb.clear();
m_allowIgnition.clear();
m_allowInjection.clear();
m_allowTriggerInput.clear();
m_allowEtb.clear(ClearReason::Fatal);
m_allowIgnition.clear(ClearReason::Fatal);
m_allowInjection.clear(ClearReason::Fatal);
m_allowTriggerInput.clear(ClearReason::Fatal);
setFaultRevLimit(0);
}
@ -106,10 +106,22 @@ bool LimpManager::allowTriggerInput() const {
return m_allowTriggerInput;
}
bool LimpManager::allowInjection() const {
return m_transientAllowInjection && m_allowInjection;
LimpState LimpManager::allowInjection() const {
if (!m_allowInjection) {
return {false, m_allowInjection.clearReason};
}
if (!m_transientAllowInjection) {
return {false, ClearReason::Fatal};
}
return {true, ClearReason::None};
}
bool LimpManager::allowIgnition() const {
return m_transientAllowIgnition && m_allowIgnition;
LimpState LimpManager::allowIgnition() const {
if (!m_allowIgnition) {
return {false, m_allowIgnition.clearReason};
}
if (!m_transientAllowIgnition) {
return {false, ClearReason::Fatal};
}
return {true, ClearReason::None};
}

View File

@ -4,24 +4,52 @@
#include <cstdint>
enum class ClearReason : uint8_t {
None, // 0
Fatal,
Settings,
HardLimit,
FaultRevLimit,
BoostCut, // 5
OilPressure,
StopRequested,
EtbProblem,
};
// Only allows clearing the value, but never resetting it.
class Clearable {
public:
Clearable() : m_value(true) {}
Clearable(bool value) : m_value(value) {}
Clearable(bool value) : m_value(value) {
if (!m_value) {
clearReason = ClearReason::Settings;
}
}
void clear() {
void clear(ClearReason clearReason) {
m_value = false;
this->clearReason = clearReason;
}
operator bool() const {
return m_value;
}
ClearReason clearReason = ClearReason::None;
private:
bool m_value = true;
};
struct LimpState {
const bool value;
const ClearReason reason;
// Implicit conversion operator to bool, so you can do things like if (myResult) { ... }
constexpr explicit operator bool() const {
return value;
}
};
class LimpManager {
public:
// This is called from periodicFastCallback to update internal state
@ -30,8 +58,8 @@ public:
// Other subsystems call these APIs to determine their behavior
bool allowElectronicThrottle() const;
bool allowInjection() const;
bool allowIgnition() const;
LimpState allowInjection() const;
LimpState allowIgnition() const;
bool allowTriggerInput() const;

View File

@ -316,6 +316,10 @@ float getOutputValueByName(const char *name) {
return engine->outputChannels.m_requested_pump;
if (strEqualCaseInsensitive(name, "boostControlTarget"))
return engine->outputChannels.boostControlTarget;
if (strEqualCaseInsensitive(name, "sparkCutReason"))
return engine->outputChannels.sparkCutReason;
if (strEqualCaseInsensitive(name, "fuelCutReason"))
return engine->outputChannels.fuelCutReason;
if (strEqualCaseInsensitive(name, "fuel_requested_percent"))
return engine->outputChannels.fuel_requested_percent;
if (strEqualCaseInsensitive(name, "fuel_requested_percent_pi"))

View File

@ -1064,6 +1064,7 @@ gaugeCategory = VVT
vvtTargets4Gauge = vvtTargets4, @@GAUGE_NAME_VVT_TARGET_B2E@@, "deg", -60, 60, -60, -60, 60, 60, 0, 0
gaugeCategory = Ignition
sparkCutReasonGauge = sparkCutReason,"Spark Cut Code", "code", 0.0,0.0, 0.0,0.0, 0.0,0.0, 0,0
ignadvGauge = ignitionAdvance, "Ignition timing", "degrees", -100, 100, -999, -999, 999, 999, 1, 1
dwellGauge = sparkDwellValue, "Dwell", "mSec", 0, 10, 0.5, 1.0, 6.0, 8.0, 1, 1
coilDutyCycleGauge = coilDutyCycle, @@GAUGE_NAME_DWELL_DUTY@@, "%", 0, 110, 0, 0, 90, 100, 1, 1
@ -1077,6 +1078,7 @@ gaugeCategory = Acceleration Enrichment
gaugeCategory = Fueling
;Name Var Title Units Lo Hi LoD LoW HiW HiD vd ld
fuelCutReasonGauge = fuelCutReason,"Fuel Cut Code", "code", 0.0,0.0, 0.0,0.0, 0.0,0.0, 0,0
tChargeGauge = tCharge, @@GAUGE_NAME_FUEL_CHARGE_TEMP@@, "C", -40, 140, -15, 1, 95, 110, 1, 1
baroCorrectionGauge = baroCorrection,@@GAUGE_NAME_FUEL_BARO_CORR@@, "ratio", 0.5, 1.5, 0.6, 0.7, 1.3, 1.4, 1, 1
crankingFuelGauge = crankingFuelMs, @@GAUGE_NAME_FUEL_CRANKING@@, "mg", 0, 100, 0, 0, 100, 100, 3, 1