diff --git a/firmware/controllers/algo/accel_enrichment.cpp b/firmware/controllers/algo/accel_enrichment.cpp index 20d213a581..b5cfcf5183 100644 --- a/firmware/controllers/algo/accel_enrichment.cpp +++ b/firmware/controllers/algo/accel_enrichment.cpp @@ -31,10 +31,9 @@ floatms_t TpsAccelEnrichment::getTpsEnrichment() { int maxDeltaIndex = getMaxDeltaIndex(); -// FuelSchedule *fs = engineConfiguration->injectionEvents; - percent_t tpsTo = cb.get(maxDeltaIndex); - percent_t tpsFrom = cb.get(maxDeltaIndex - 1); - percent_t deltaTps = tpsTo - tpsFrom; + tpsTo = cb.get(maxDeltaIndex); + tpsFrom = cb.get(maxDeltaIndex - 1); + deltaTps = tpsTo - tpsFrom; isAboveAccelThreshold = deltaTps > engineConfiguration->tpsAccelEnrichmentThreshold; isBelowDecelThreshold = deltaTps < -engineConfiguration->tpsDecelEnleanmentThreshold; @@ -122,7 +121,8 @@ void TpsAccelEnrichment::onEngineCycleTps() { int TpsAccelEnrichment::getMaxDeltaIndex() { int len = minI(cb.getSize(), cb.getCount()); - if (len < 2) + tooShort = len < 2; + if (tooShort) return 0; int ci = cb.currentIndex - 1; float maxValue = cb.get(ci) - cb.get(ci - 1); diff --git a/firmware/controllers/algo/tps_accel_state.txt b/firmware/controllers/algo/tps_accel_state.txt index d3ebc69fb9..d8cbbaf4e5 100644 --- a/firmware/controllers/algo/tps_accel_state.txt +++ b/firmware/controllers/algo/tps_accel_state.txt @@ -14,6 +14,7 @@ bit isBelowDecelThreshold; bit isTimeToResetAccumulator bit isFractionalEnrichment bit belowEpsilon; +bit tooShort; float fractionalInjFuel diff --git a/firmware/controllers/algo/tps_accel_state_generated.h b/firmware/controllers/algo/tps_accel_state_generated.h index ecb5820da0..eab977c087 100644 --- a/firmware/controllers/algo/tps_accel_state_generated.h +++ b/firmware/controllers/algo/tps_accel_state_generated.h @@ -1,4 +1,4 @@ -// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/tps_accel_state.txt Thu Dec 02 05:01:51 UTC 2021 +// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/tps_accel_state.txt Sun Jan 02 13:40:19 EST 2022 // by class com.rusefi.output.CHeaderConsumer // begin #pragma once @@ -42,85 +42,85 @@ struct tps_accel_state_s { bool belowEpsilon : 1 {}; /** offset 20 bit 5 */ - bool unusedBit_10_5 : 1 {}; + bool tooShort : 1 {}; /** offset 20 bit 6 */ - bool unusedBit_10_6 : 1 {}; + bool unusedBit_11_6 : 1 {}; /** offset 20 bit 7 */ - bool unusedBit_10_7 : 1 {}; + bool unusedBit_11_7 : 1 {}; /** offset 20 bit 8 */ - bool unusedBit_10_8 : 1 {}; + bool unusedBit_11_8 : 1 {}; /** offset 20 bit 9 */ - bool unusedBit_10_9 : 1 {}; + bool unusedBit_11_9 : 1 {}; /** offset 20 bit 10 */ - bool unusedBit_10_10 : 1 {}; + bool unusedBit_11_10 : 1 {}; /** offset 20 bit 11 */ - bool unusedBit_10_11 : 1 {}; + bool unusedBit_11_11 : 1 {}; /** offset 20 bit 12 */ - bool unusedBit_10_12 : 1 {}; + bool unusedBit_11_12 : 1 {}; /** offset 20 bit 13 */ - bool unusedBit_10_13 : 1 {}; + bool unusedBit_11_13 : 1 {}; /** offset 20 bit 14 */ - bool unusedBit_10_14 : 1 {}; + bool unusedBit_11_14 : 1 {}; /** offset 20 bit 15 */ - bool unusedBit_10_15 : 1 {}; + bool unusedBit_11_15 : 1 {}; /** offset 20 bit 16 */ - bool unusedBit_10_16 : 1 {}; + bool unusedBit_11_16 : 1 {}; /** offset 20 bit 17 */ - bool unusedBit_10_17 : 1 {}; + bool unusedBit_11_17 : 1 {}; /** offset 20 bit 18 */ - bool unusedBit_10_18 : 1 {}; + bool unusedBit_11_18 : 1 {}; /** offset 20 bit 19 */ - bool unusedBit_10_19 : 1 {}; + bool unusedBit_11_19 : 1 {}; /** offset 20 bit 20 */ - bool unusedBit_10_20 : 1 {}; + bool unusedBit_11_20 : 1 {}; /** offset 20 bit 21 */ - bool unusedBit_10_21 : 1 {}; + bool unusedBit_11_21 : 1 {}; /** offset 20 bit 22 */ - bool unusedBit_10_22 : 1 {}; + bool unusedBit_11_22 : 1 {}; /** offset 20 bit 23 */ - bool unusedBit_10_23 : 1 {}; + bool unusedBit_11_23 : 1 {}; /** offset 20 bit 24 */ - bool unusedBit_10_24 : 1 {}; + bool unusedBit_11_24 : 1 {}; /** offset 20 bit 25 */ - bool unusedBit_10_25 : 1 {}; + bool unusedBit_11_25 : 1 {}; /** offset 20 bit 26 */ - bool unusedBit_10_26 : 1 {}; + bool unusedBit_11_26 : 1 {}; /** offset 20 bit 27 */ - bool unusedBit_10_27 : 1 {}; + bool unusedBit_11_27 : 1 {}; /** offset 20 bit 28 */ - bool unusedBit_10_28 : 1 {}; + bool unusedBit_11_28 : 1 {}; /** offset 20 bit 29 */ - bool unusedBit_10_29 : 1 {}; + bool unusedBit_11_29 : 1 {}; /** offset 20 bit 30 */ - bool unusedBit_10_30 : 1 {}; + bool unusedBit_11_30 : 1 {}; /** offset 20 bit 31 */ - bool unusedBit_10_31 : 1 {}; + bool unusedBit_11_31 : 1 {}; /** * offset 24 */ @@ -149,4 +149,4 @@ struct tps_accel_state_s { }; // end -// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/tps_accel_state.txt Thu Dec 02 05:01:51 UTC 2021 +// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/tps_accel_state.txt Sun Jan 02 13:40:19 EST 2022 diff --git a/java_console/models/src/main/java/com/rusefi/config/generated/TpsAccelState.java b/java_console/models/src/main/java/com/rusefi/config/generated/TpsAccelState.java index 93931b500c..43ef7a2a22 100644 --- a/java_console/models/src/main/java/com/rusefi/config/generated/TpsAccelState.java +++ b/java_console/models/src/main/java/com/rusefi/config/generated/TpsAccelState.java @@ -1,6 +1,6 @@ package com.rusefi.config.generated; -// this file was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/tps_accel_state.txt Sun Oct 31 02:30:53 UTC 2021 +// this file was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/tps_accel_state.txt Sun Jan 02 13:40:19 EST 2022 // by class com.rusefi.output.FileJavaFieldsConsumer import com.rusefi.config.*; @@ -16,33 +16,33 @@ public class TpsAccelState { 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 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 TOOSHORT = Field.create("TOOSHORT", 20, FieldType.BIT, 5); + public static final Field UNUSEDBIT_11_6 = Field.create("UNUSEDBIT_11_6", 20, FieldType.BIT, 6); + public static final Field UNUSEDBIT_11_7 = Field.create("UNUSEDBIT_11_7", 20, FieldType.BIT, 7); + public static final Field UNUSEDBIT_11_8 = Field.create("UNUSEDBIT_11_8", 20, FieldType.BIT, 8); + public static final Field UNUSEDBIT_11_9 = Field.create("UNUSEDBIT_11_9", 20, FieldType.BIT, 9); + public static final Field UNUSEDBIT_11_10 = Field.create("UNUSEDBIT_11_10", 20, FieldType.BIT, 10); + public static final Field UNUSEDBIT_11_11 = Field.create("UNUSEDBIT_11_11", 20, FieldType.BIT, 11); + public static final Field UNUSEDBIT_11_12 = Field.create("UNUSEDBIT_11_12", 20, FieldType.BIT, 12); + public static final Field UNUSEDBIT_11_13 = Field.create("UNUSEDBIT_11_13", 20, FieldType.BIT, 13); + public static final Field UNUSEDBIT_11_14 = Field.create("UNUSEDBIT_11_14", 20, FieldType.BIT, 14); + public static final Field UNUSEDBIT_11_15 = Field.create("UNUSEDBIT_11_15", 20, FieldType.BIT, 15); + public static final Field UNUSEDBIT_11_16 = Field.create("UNUSEDBIT_11_16", 20, FieldType.BIT, 16); + public static final Field UNUSEDBIT_11_17 = Field.create("UNUSEDBIT_11_17", 20, FieldType.BIT, 17); + public static final Field UNUSEDBIT_11_18 = Field.create("UNUSEDBIT_11_18", 20, FieldType.BIT, 18); + public static final Field UNUSEDBIT_11_19 = Field.create("UNUSEDBIT_11_19", 20, FieldType.BIT, 19); + public static final Field UNUSEDBIT_11_20 = Field.create("UNUSEDBIT_11_20", 20, FieldType.BIT, 20); + public static final Field UNUSEDBIT_11_21 = Field.create("UNUSEDBIT_11_21", 20, FieldType.BIT, 21); + public static final Field UNUSEDBIT_11_22 = Field.create("UNUSEDBIT_11_22", 20, FieldType.BIT, 22); + public static final Field UNUSEDBIT_11_23 = Field.create("UNUSEDBIT_11_23", 20, FieldType.BIT, 23); + public static final Field UNUSEDBIT_11_24 = Field.create("UNUSEDBIT_11_24", 20, FieldType.BIT, 24); + public static final Field UNUSEDBIT_11_25 = Field.create("UNUSEDBIT_11_25", 20, FieldType.BIT, 25); + public static final Field UNUSEDBIT_11_26 = Field.create("UNUSEDBIT_11_26", 20, FieldType.BIT, 26); + public static final Field UNUSEDBIT_11_27 = Field.create("UNUSEDBIT_11_27", 20, FieldType.BIT, 27); + public static final Field UNUSEDBIT_11_28 = Field.create("UNUSEDBIT_11_28", 20, FieldType.BIT, 28); + public static final Field UNUSEDBIT_11_29 = Field.create("UNUSEDBIT_11_29", 20, FieldType.BIT, 29); + public static final Field UNUSEDBIT_11_30 = Field.create("UNUSEDBIT_11_30", 20, FieldType.BIT, 30); + public static final Field UNUSEDBIT_11_31 = Field.create("UNUSEDBIT_11_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); @@ -60,33 +60,33 @@ public class TpsAccelState { ISTIMETORESETACCUMULATOR, ISFRACTIONALENRICHMENT, 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, + TOOSHORT, + UNUSEDBIT_11_6, + UNUSEDBIT_11_7, + UNUSEDBIT_11_8, + UNUSEDBIT_11_9, + UNUSEDBIT_11_10, + UNUSEDBIT_11_11, + UNUSEDBIT_11_12, + UNUSEDBIT_11_13, + UNUSEDBIT_11_14, + UNUSEDBIT_11_15, + UNUSEDBIT_11_16, + UNUSEDBIT_11_17, + UNUSEDBIT_11_18, + UNUSEDBIT_11_19, + UNUSEDBIT_11_20, + UNUSEDBIT_11_21, + UNUSEDBIT_11_22, + UNUSEDBIT_11_23, + UNUSEDBIT_11_24, + UNUSEDBIT_11_25, + UNUSEDBIT_11_26, + UNUSEDBIT_11_27, + UNUSEDBIT_11_28, + UNUSEDBIT_11_29, + UNUSEDBIT_11_30, + UNUSEDBIT_11_31, FRACTIONALINJFUEL, ACCUMULATEDVALUE, MAXEXTRAPERCYCLE,