Whatever we call it, no matter how we do it - we need live data / remote view into rusEFI actual state #3353

This commit is contained in:
Andrey 2021-10-30 22:20:29 -04:00
parent 1a13dd7463
commit ef413188ee
6 changed files with 98 additions and 88 deletions

View File

@ -251,9 +251,13 @@ static const void * getStructAddr(live_data_e structId) {
case LDS_IDLE_PID:
return static_cast<pid_state_s*>(getIdlePid());
#endif /* EFI_IDLE_CONTROL */
case LDS_IDLE:
return static_cast<idle_state_s*>(&engine->idle);
case LDS_TPS_ACCEL:
return static_cast<tps_accel_state_s*>(&engine->tpsAccelEnrichment);
default:
return NULL;
return nullptr;
}
}

View File

@ -153,7 +153,8 @@ void TpsAccelEnrichment::onEngineCycleTps(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
accumulatedValue += maxExtraPerPeriod;
// update the accumulated value every 'Period' engine cycles
if (--cycleCnt <= 0) {
isTimeToResetAccumulator = --cycleCnt <= 0;
if (isTimeToResetAccumulator) {
maxExtraPerPeriod = 0;
// we've injected this portion during the cycle, so we set what's left for the next cycle
@ -163,8 +164,10 @@ void TpsAccelEnrichment::onEngineCycleTps(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// it's an infinitely convergent series, so we set a limit at some point
// (also make sure that accumulatedValue is positive, for safety)
static const floatms_t smallEpsilon = 0.001f;
if (accumulatedValue < smallEpsilon)
belowEpsilon = accumulatedValue < smallEpsilon
if (belowEpsilon) {
accumulatedValue = 0;
}
// reset the counter
cycleCnt = CONFIG(tpsAccelFractionPeriod);

View File

@ -18,5 +18,7 @@ LDS_IDLE_PID,
LDS_ALTERNATOR_PID,
LDS_CJ125_PID,
LDS_TRIGGER_STATE,
LDS_AC_CONTROL
LDS_AC_CONTROL,
LDS_IDLE,
LDS_TPS_ACCEL
} live_data_e;

View File

@ -13,6 +13,7 @@ bit isAboveAccelThreshold;
bit isBelowDecelThreshold;
bit isTimeToResetAccumulator
bit isFractionalEnrichment
bit belowEpsilon;
float fractionalInjFuel

View File

@ -39,88 +39,88 @@ struct tps_accel_state_s {
bool isFractionalEnrichment : 1;
/**
offset 20 bit 4 */
bool unusedBit_9_4 : 1;
bool belowEpsilon : 1;
/**
offset 20 bit 5 */
bool unusedBit_9_5 : 1;
bool unusedBit_10_5 : 1;
/**
offset 20 bit 6 */
bool unusedBit_9_6 : 1;
bool unusedBit_10_6 : 1;
/**
offset 20 bit 7 */
bool unusedBit_9_7 : 1;
bool unusedBit_10_7 : 1;
/**
offset 20 bit 8 */
bool unusedBit_9_8 : 1;
bool unusedBit_10_8 : 1;
/**
offset 20 bit 9 */
bool unusedBit_9_9 : 1;
bool unusedBit_10_9 : 1;
/**
offset 20 bit 10 */
bool unusedBit_9_10 : 1;
bool unusedBit_10_10 : 1;
/**
offset 20 bit 11 */
bool unusedBit_9_11 : 1;
bool unusedBit_10_11 : 1;
/**
offset 20 bit 12 */
bool unusedBit_9_12 : 1;
bool unusedBit_10_12 : 1;
/**
offset 20 bit 13 */
bool unusedBit_9_13 : 1;
bool unusedBit_10_13 : 1;
/**
offset 20 bit 14 */
bool unusedBit_9_14 : 1;
bool unusedBit_10_14 : 1;
/**
offset 20 bit 15 */
bool unusedBit_9_15 : 1;
bool unusedBit_10_15 : 1;
/**
offset 20 bit 16 */
bool unusedBit_9_16 : 1;
bool unusedBit_10_16 : 1;
/**
offset 20 bit 17 */
bool unusedBit_9_17 : 1;
bool unusedBit_10_17 : 1;
/**
offset 20 bit 18 */
bool unusedBit_9_18 : 1;
bool unusedBit_10_18 : 1;
/**
offset 20 bit 19 */
bool unusedBit_9_19 : 1;
bool unusedBit_10_19 : 1;
/**
offset 20 bit 20 */
bool unusedBit_9_20 : 1;
bool unusedBit_10_20 : 1;
/**
offset 20 bit 21 */
bool unusedBit_9_21 : 1;
bool unusedBit_10_21 : 1;
/**
offset 20 bit 22 */
bool unusedBit_9_22 : 1;
bool unusedBit_10_22 : 1;
/**
offset 20 bit 23 */
bool unusedBit_9_23 : 1;
bool unusedBit_10_23 : 1;
/**
offset 20 bit 24 */
bool unusedBit_9_24 : 1;
bool unusedBit_10_24 : 1;
/**
offset 20 bit 25 */
bool unusedBit_9_25 : 1;
bool unusedBit_10_25 : 1;
/**
offset 20 bit 26 */
bool unusedBit_9_26 : 1;
bool unusedBit_10_26 : 1;
/**
offset 20 bit 27 */
bool unusedBit_9_27 : 1;
bool unusedBit_10_27 : 1;
/**
offset 20 bit 28 */
bool unusedBit_9_28 : 1;
bool unusedBit_10_28 : 1;
/**
offset 20 bit 29 */
bool unusedBit_9_29 : 1;
bool unusedBit_10_29 : 1;
/**
offset 20 bit 30 */
bool unusedBit_9_30 : 1;
bool unusedBit_10_30 : 1;
/**
offset 20 bit 31 */
bool unusedBit_9_31 : 1;
bool unusedBit_10_31 : 1;
/**
* offset 24
*/

View File

@ -15,34 +15,34 @@ public class TpsAccelState {
public static final Field ISBELOWDECELTHRESHOLD = Field.create("ISBELOWDECELTHRESHOLD", 20, FieldType.BIT, 1);
public static final Field ISTIMETORESETACCUMULATOR = Field.create("ISTIMETORESETACCUMULATOR", 20, FieldType.BIT, 2);
public static final Field ISFRACTIONALENRICHMENT = Field.create("ISFRACTIONALENRICHMENT", 20, FieldType.BIT, 3);
public static final Field UNUSEDBIT_9_4 = Field.create("UNUSEDBIT_9_4", 20, FieldType.BIT, 4);
public static final Field UNUSEDBIT_9_5 = Field.create("UNUSEDBIT_9_5", 20, FieldType.BIT, 5);
public static final Field UNUSEDBIT_9_6 = Field.create("UNUSEDBIT_9_6", 20, FieldType.BIT, 6);
public static final Field UNUSEDBIT_9_7 = Field.create("UNUSEDBIT_9_7", 20, FieldType.BIT, 7);
public static final Field UNUSEDBIT_9_8 = Field.create("UNUSEDBIT_9_8", 20, FieldType.BIT, 8);
public static final Field UNUSEDBIT_9_9 = Field.create("UNUSEDBIT_9_9", 20, FieldType.BIT, 9);
public static final Field UNUSEDBIT_9_10 = Field.create("UNUSEDBIT_9_10", 20, FieldType.BIT, 10);
public static final Field UNUSEDBIT_9_11 = Field.create("UNUSEDBIT_9_11", 20, FieldType.BIT, 11);
public static final Field UNUSEDBIT_9_12 = Field.create("UNUSEDBIT_9_12", 20, FieldType.BIT, 12);
public static final Field UNUSEDBIT_9_13 = Field.create("UNUSEDBIT_9_13", 20, FieldType.BIT, 13);
public static final Field UNUSEDBIT_9_14 = Field.create("UNUSEDBIT_9_14", 20, FieldType.BIT, 14);
public static final Field UNUSEDBIT_9_15 = Field.create("UNUSEDBIT_9_15", 20, FieldType.BIT, 15);
public static final Field UNUSEDBIT_9_16 = Field.create("UNUSEDBIT_9_16", 20, FieldType.BIT, 16);
public static final Field UNUSEDBIT_9_17 = Field.create("UNUSEDBIT_9_17", 20, FieldType.BIT, 17);
public static final Field UNUSEDBIT_9_18 = Field.create("UNUSEDBIT_9_18", 20, FieldType.BIT, 18);
public static final Field UNUSEDBIT_9_19 = Field.create("UNUSEDBIT_9_19", 20, FieldType.BIT, 19);
public static final Field UNUSEDBIT_9_20 = Field.create("UNUSEDBIT_9_20", 20, FieldType.BIT, 20);
public static final Field UNUSEDBIT_9_21 = Field.create("UNUSEDBIT_9_21", 20, FieldType.BIT, 21);
public static final Field UNUSEDBIT_9_22 = Field.create("UNUSEDBIT_9_22", 20, FieldType.BIT, 22);
public static final Field UNUSEDBIT_9_23 = Field.create("UNUSEDBIT_9_23", 20, FieldType.BIT, 23);
public static final Field UNUSEDBIT_9_24 = Field.create("UNUSEDBIT_9_24", 20, FieldType.BIT, 24);
public static final Field UNUSEDBIT_9_25 = Field.create("UNUSEDBIT_9_25", 20, FieldType.BIT, 25);
public static final Field UNUSEDBIT_9_26 = Field.create("UNUSEDBIT_9_26", 20, FieldType.BIT, 26);
public static final Field UNUSEDBIT_9_27 = Field.create("UNUSEDBIT_9_27", 20, FieldType.BIT, 27);
public static final Field UNUSEDBIT_9_28 = Field.create("UNUSEDBIT_9_28", 20, FieldType.BIT, 28);
public static final Field UNUSEDBIT_9_29 = Field.create("UNUSEDBIT_9_29", 20, FieldType.BIT, 29);
public static final Field UNUSEDBIT_9_30 = Field.create("UNUSEDBIT_9_30", 20, FieldType.BIT, 30);
public static final Field UNUSEDBIT_9_31 = Field.create("UNUSEDBIT_9_31", 20, FieldType.BIT, 31);
public static final Field BELOWEPSILON = Field.create("BELOWEPSILON", 20, FieldType.BIT, 4);
public static final Field UNUSEDBIT_10_5 = Field.create("UNUSEDBIT_10_5", 20, FieldType.BIT, 5);
public static final Field UNUSEDBIT_10_6 = Field.create("UNUSEDBIT_10_6", 20, FieldType.BIT, 6);
public static final Field UNUSEDBIT_10_7 = Field.create("UNUSEDBIT_10_7", 20, FieldType.BIT, 7);
public static final Field UNUSEDBIT_10_8 = Field.create("UNUSEDBIT_10_8", 20, FieldType.BIT, 8);
public static final Field UNUSEDBIT_10_9 = Field.create("UNUSEDBIT_10_9", 20, FieldType.BIT, 9);
public static final Field UNUSEDBIT_10_10 = Field.create("UNUSEDBIT_10_10", 20, FieldType.BIT, 10);
public static final Field UNUSEDBIT_10_11 = Field.create("UNUSEDBIT_10_11", 20, FieldType.BIT, 11);
public static final Field UNUSEDBIT_10_12 = Field.create("UNUSEDBIT_10_12", 20, FieldType.BIT, 12);
public static final Field UNUSEDBIT_10_13 = Field.create("UNUSEDBIT_10_13", 20, FieldType.BIT, 13);
public static final Field UNUSEDBIT_10_14 = Field.create("UNUSEDBIT_10_14", 20, FieldType.BIT, 14);
public static final Field UNUSEDBIT_10_15 = Field.create("UNUSEDBIT_10_15", 20, FieldType.BIT, 15);
public static final Field UNUSEDBIT_10_16 = Field.create("UNUSEDBIT_10_16", 20, FieldType.BIT, 16);
public static final Field UNUSEDBIT_10_17 = Field.create("UNUSEDBIT_10_17", 20, FieldType.BIT, 17);
public static final Field UNUSEDBIT_10_18 = Field.create("UNUSEDBIT_10_18", 20, FieldType.BIT, 18);
public static final Field UNUSEDBIT_10_19 = Field.create("UNUSEDBIT_10_19", 20, FieldType.BIT, 19);
public static final Field UNUSEDBIT_10_20 = Field.create("UNUSEDBIT_10_20", 20, FieldType.BIT, 20);
public static final Field UNUSEDBIT_10_21 = Field.create("UNUSEDBIT_10_21", 20, FieldType.BIT, 21);
public static final Field UNUSEDBIT_10_22 = Field.create("UNUSEDBIT_10_22", 20, FieldType.BIT, 22);
public static final Field UNUSEDBIT_10_23 = Field.create("UNUSEDBIT_10_23", 20, FieldType.BIT, 23);
public static final Field UNUSEDBIT_10_24 = Field.create("UNUSEDBIT_10_24", 20, FieldType.BIT, 24);
public static final Field UNUSEDBIT_10_25 = Field.create("UNUSEDBIT_10_25", 20, FieldType.BIT, 25);
public static final Field UNUSEDBIT_10_26 = Field.create("UNUSEDBIT_10_26", 20, FieldType.BIT, 26);
public static final Field UNUSEDBIT_10_27 = Field.create("UNUSEDBIT_10_27", 20, FieldType.BIT, 27);
public static final Field UNUSEDBIT_10_28 = Field.create("UNUSEDBIT_10_28", 20, FieldType.BIT, 28);
public static final Field UNUSEDBIT_10_29 = Field.create("UNUSEDBIT_10_29", 20, FieldType.BIT, 29);
public static final Field UNUSEDBIT_10_30 = Field.create("UNUSEDBIT_10_30", 20, FieldType.BIT, 30);
public static final Field UNUSEDBIT_10_31 = Field.create("UNUSEDBIT_10_31", 20, FieldType.BIT, 31);
public static final Field FRACTIONALINJFUEL = Field.create("FRACTIONALINJFUEL", 24, FieldType.FLOAT);
public static final Field ACCUMULATEDVALUE = Field.create("ACCUMULATEDVALUE", 28, FieldType.FLOAT);
public static final Field MAXEXTRAPERCYCLE = Field.create("MAXEXTRAPERCYCLE", 32, FieldType.FLOAT);
@ -59,34 +59,34 @@ public class TpsAccelState {
ISBELOWDECELTHRESHOLD,
ISTIMETORESETACCUMULATOR,
ISFRACTIONALENRICHMENT,
UNUSEDBIT_9_4,
UNUSEDBIT_9_5,
UNUSEDBIT_9_6,
UNUSEDBIT_9_7,
UNUSEDBIT_9_8,
UNUSEDBIT_9_9,
UNUSEDBIT_9_10,
UNUSEDBIT_9_11,
UNUSEDBIT_9_12,
UNUSEDBIT_9_13,
UNUSEDBIT_9_14,
UNUSEDBIT_9_15,
UNUSEDBIT_9_16,
UNUSEDBIT_9_17,
UNUSEDBIT_9_18,
UNUSEDBIT_9_19,
UNUSEDBIT_9_20,
UNUSEDBIT_9_21,
UNUSEDBIT_9_22,
UNUSEDBIT_9_23,
UNUSEDBIT_9_24,
UNUSEDBIT_9_25,
UNUSEDBIT_9_26,
UNUSEDBIT_9_27,
UNUSEDBIT_9_28,
UNUSEDBIT_9_29,
UNUSEDBIT_9_30,
UNUSEDBIT_9_31,
BELOWEPSILON,
UNUSEDBIT_10_5,
UNUSEDBIT_10_6,
UNUSEDBIT_10_7,
UNUSEDBIT_10_8,
UNUSEDBIT_10_9,
UNUSEDBIT_10_10,
UNUSEDBIT_10_11,
UNUSEDBIT_10_12,
UNUSEDBIT_10_13,
UNUSEDBIT_10_14,
UNUSEDBIT_10_15,
UNUSEDBIT_10_16,
UNUSEDBIT_10_17,
UNUSEDBIT_10_18,
UNUSEDBIT_10_19,
UNUSEDBIT_10_20,
UNUSEDBIT_10_21,
UNUSEDBIT_10_22,
UNUSEDBIT_10_23,
UNUSEDBIT_10_24,
UNUSEDBIT_10_25,
UNUSEDBIT_10_26,
UNUSEDBIT_10_27,
UNUSEDBIT_10_28,
UNUSEDBIT_10_29,
UNUSEDBIT_10_30,
UNUSEDBIT_10_31,
FRACTIONALINJFUEL,
ACCUMULATEDVALUE,
MAXEXTRAPERCYCLE,