ETB target is using integer values #945

refactoring
This commit is contained in:
rusefi 2019-09-22 08:44:51 -04:00
parent a20ff91abf
commit 1b604359a9
11 changed files with 74 additions and 64 deletions

View File

@ -237,9 +237,9 @@ public:
percent_t pedalPosition = getPedalPosition(PASS_ENGINE_PARAMETER_SIGNATURE);
int rpm = GET_RPM();
percent_t targetFromTable = pedal2tpsMap.getValue(rpm / RPM_1_BYTE_PACKING_MULT, pedalPosition);
percent_t etbIdleAddition = CONFIGB(useETBforIdleControl) ? engine->engineState.etbIdleAddition : 0;
percent_t targetPosition = targetFromTable + etbIdleAddition;
engine->engineState.targetFromTable = pedal2tpsMap.getValue(rpm / RPM_1_BYTE_PACKING_MULT, pedalPosition);
percent_t etbIdleAddition = CONFIGB(useETBforIdleControl) ? engine->engineState.idle.etbIdleAddition : 0;
percent_t targetPosition = engine->engineState.targetFromTable + etbIdleAddition;
if (engineConfiguration->debugMode == DBG_ETB_LOGIC) {
#if EFI_TUNER_STUDIO

View File

@ -137,7 +137,7 @@ void setIdleMode(idle_mode_e value) {
static void applyIACposition(percent_t position) {
if (CONFIGB(useETBforIdleControl)) {
engine->engineState.etbIdleAddition = position / 100 * CONFIG(etbIdleThrottleRange);
engine->engineState.idle.etbIdleAddition = position / 100 * CONFIG(etbIdleThrottleRange);
#if ! EFI_UNIT_TEST
} if (CONFIGB(useStepperIdle)) {
iacMotor.setTargetPosition(position / 100 * engineConfiguration->idleStepperTotalSteps);

View File

@ -29,11 +29,6 @@ public:
FuelConsumptionState fuelConsumption;
/**
* ETB position adjustment related to idle RPM control
*/
percent_t etbIdleAddition = 0;
efitick_t crankingTime = 0;
efitick_t timeSinceCranking = 0;

View File

@ -1,4 +1,4 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Sun Sep 01 15:38:18 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Sun Sep 22 08:39:46 EDT 2019
// by class com.rusefi.output.CHeaderConsumer
// begin
#ifndef CONTROLLERS_GENERATED_ENGINE_STATE_GENERATED_H
@ -67,7 +67,12 @@ struct idle_state_s {
* offset 12
*/
int throttlePedalUpState = (int)0;
/** total size 16*/
/**
* ETB position adjustment related to idle RPM control
* offset 16
*/
percent_t etbIdleAddition = (percent_t)0;
/** total size 20*/
};
typedef struct idle_state_s idle_state_s;
@ -161,63 +166,67 @@ struct engine_state2_s {
*/
idle_state_s idle;
/**
* offset 48
* offset 52
*/
float targetAFR = (float)0;
/**
* offset 52
* offset 56
*/
float engineCycleDurationMs = (float)0;
/**
* offset 56
* offset 60
*/
float minRpmKcurrentTPS = (float)0;
/**
* offset 60
* offset 64
*/
int currentTpsAdc = (int)0;
/**
* offset 64
* offset 68
*/
float tpsVoltageMCU = (float)0;
/**
* offset 68
* offset 72
*/
float tpsVoltageBoard = (float)0;
/**
* offset 72
* offset 76
*/
float currentBaroCorrectedVE = (float)0;
/**
* offset 76
* offset 80
*/
float baroCorrection = (float)0;
/**
offset 80 bit 0 */
offset 84 bit 0 */
bool isCrankingState : 1;
/**
offset 80 bit 1 */
offset 84 bit 1 */
bool hasEtbPedalPositionSensor : 1;
/**
offset 80 bit 2 */
offset 84 bit 2 */
bool isAutomaticIdle : 1;
/**
* offset 84
* offset 88
*/
cranking_fuel_s cranking;
/**
* offset 104
* offset 108
*/
running_fuel_s running;
/**
* offset 136
* offset 140
*/
percent_t etbFeedForward = (percent_t)0;
/** total size 140*/
/**
* offset 144
*/
percent_t targetFromTable = (percent_t)0;
/** total size 148*/
};
typedef struct engine_state2_s engine_state2_s;
#endif
// end
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Sun Sep 01 15:38:18 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Sun Sep 22 08:39:46 EDT 2019

View File

@ -31,6 +31,7 @@ struct_no_prefix idle_state_s
percent_t currentIdlePosition;that's current position with CLT and IAT corrections
percent_t baseIdlePosition;current position without adjustments (iacByTpsTaper, afterCrankingIACtaperDuration)
int throttlePedalUpState;true in IDLE throttle pedal state, false if driver is touching the pedal\ntodo: better name for this field?
percent_t etbIdleAddition;ETB position adjustment related to idle RPM control
! end of idle_state_s structure definition
end_struct
@ -97,5 +98,6 @@ running_fuel_s running
percent_t etbFeedForward;
percent_t targetFromTable
! engine_state2_s
end_struct

View File

@ -1,8 +1,8 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Sun Sep 01 15:38:18 EDT 2019
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Sun Sep 22 08:32:24 EDT 2019
// by class com.rusefi.output.JavaFieldsConsumer
// by class com.rusefi.output.FileJavaFieldsConsumer
import com.rusefi.config.*;
public class EngineState {
@ -18,31 +18,33 @@ public class EngineState {
public static final Field CURRENTIDLEPOSITION = Field.create("CURRENTIDLEPOSITION", 36, FieldType.FLOAT);
public static final Field BASEIDLEPOSITION = Field.create("BASEIDLEPOSITION", 40, FieldType.FLOAT);
public static final Field THROTTLEPEDALUPSTATE = Field.create("THROTTLEPEDALUPSTATE", 44, FieldType.INT);
public static final Field TARGETAFR = Field.create("TARGETAFR", 48, FieldType.FLOAT);
public static final Field ENGINECYCLEDURATIONMS = Field.create("ENGINECYCLEDURATIONMS", 52, FieldType.FLOAT);
public static final Field MINRPMKCURRENTTPS = Field.create("MINRPMKCURRENTTPS", 56, FieldType.FLOAT);
public static final Field CURRENTTPSADC = Field.create("CURRENTTPSADC", 60, FieldType.INT);
public static final Field TPSVOLTAGEMCU = Field.create("TPSVOLTAGEMCU", 64, FieldType.FLOAT);
public static final Field TPSVOLTAGEBOARD = Field.create("TPSVOLTAGEBOARD", 68, FieldType.FLOAT);
public static final Field CURRENTBAROCORRECTEDVE = Field.create("CURRENTBAROCORRECTEDVE", 72, FieldType.FLOAT);
public static final Field BAROCORRECTION = Field.create("BAROCORRECTION", 76, FieldType.FLOAT);
public static final Field ISCRANKINGSTATE = Field.create("ISCRANKINGSTATE", 80, FieldType.BIT, 0);
public static final Field HASETBPEDALPOSITIONSENSOR = Field.create("HASETBPEDALPOSITIONSENSOR", 80, FieldType.BIT, 1);
public static final Field ISAUTOMATICIDLE = Field.create("ISAUTOMATICIDLE", 80, FieldType.BIT, 2);
public static final Field CRANKING_BASEFUEL = Field.create("CRANKING_BASEFUEL", 84, FieldType.FLOAT);
public static final Field CRANKING_COOLANTTEMPERATURECOEFFICIENT = Field.create("CRANKING_COOLANTTEMPERATURECOEFFICIENT", 88, FieldType.FLOAT);
public static final Field CRANKING_TPSCOEFFICIENT = Field.create("CRANKING_TPSCOEFFICIENT", 92, FieldType.FLOAT);
public static final Field CRANKING_DURATIONCOEFFICIENT = Field.create("CRANKING_DURATIONCOEFFICIENT", 96, FieldType.FLOAT);
public static final Field CRANKING_FUEL = Field.create("CRANKING_FUEL", 100, FieldType.FLOAT);
public static final Field RUNNING_POSTCRANKINGFUELCORRECTION = Field.create("RUNNING_POSTCRANKINGFUELCORRECTION", 104, FieldType.FLOAT);
public static final Field RUNNING_INTAKETEMPERATURECOEFFICIENT = Field.create("RUNNING_INTAKETEMPERATURECOEFFICIENT", 108, FieldType.FLOAT);
public static final Field RUNNING_COOLANTTEMPERATURECOEFFICIENT = Field.create("RUNNING_COOLANTTEMPERATURECOEFFICIENT", 112, FieldType.FLOAT);
public static final Field RUNNING_TIMESINCECRANKINGINSECS = Field.create("RUNNING_TIMESINCECRANKINGINSECS", 116, FieldType.FLOAT);
public static final Field RUNNING_INJECTORLAG = Field.create("RUNNING_INJECTORLAG", 120, FieldType.FLOAT);
public static final Field RUNNING_PIDCORRECTION = Field.create("RUNNING_PIDCORRECTION", 124, FieldType.FLOAT);
public static final Field RUNNING_BASEFUEL = Field.create("RUNNING_BASEFUEL", 128, FieldType.FLOAT);
public static final Field RUNNING_FUEL = Field.create("RUNNING_FUEL", 132, FieldType.FLOAT);
public static final Field ETBFEEDFORWARD = Field.create("ETBFEEDFORWARD", 136, FieldType.FLOAT);
public static final Field ETBIDLEADDITION = Field.create("ETBIDLEADDITION", 48, FieldType.FLOAT);
public static final Field TARGETAFR = Field.create("TARGETAFR", 52, FieldType.FLOAT);
public static final Field ENGINECYCLEDURATIONMS = Field.create("ENGINECYCLEDURATIONMS", 56, FieldType.FLOAT);
public static final Field MINRPMKCURRENTTPS = Field.create("MINRPMKCURRENTTPS", 60, FieldType.FLOAT);
public static final Field CURRENTTPSADC = Field.create("CURRENTTPSADC", 64, FieldType.INT);
public static final Field TPSVOLTAGEMCU = Field.create("TPSVOLTAGEMCU", 68, FieldType.FLOAT);
public static final Field TPSVOLTAGEBOARD = Field.create("TPSVOLTAGEBOARD", 72, FieldType.FLOAT);
public static final Field CURRENTBAROCORRECTEDVE = Field.create("CURRENTBAROCORRECTEDVE", 76, FieldType.FLOAT);
public static final Field BAROCORRECTION = Field.create("BAROCORRECTION", 80, FieldType.FLOAT);
public static final Field ISCRANKINGSTATE = Field.create("ISCRANKINGSTATE", 84, FieldType.BIT, 0);
public static final Field HASETBPEDALPOSITIONSENSOR = Field.create("HASETBPEDALPOSITIONSENSOR", 84, FieldType.BIT, 1);
public static final Field ISAUTOMATICIDLE = Field.create("ISAUTOMATICIDLE", 84, FieldType.BIT, 2);
public static final Field CRANKING_BASEFUEL = Field.create("CRANKING_BASEFUEL", 88, FieldType.FLOAT);
public static final Field CRANKING_COOLANTTEMPERATURECOEFFICIENT = Field.create("CRANKING_COOLANTTEMPERATURECOEFFICIENT", 92, FieldType.FLOAT);
public static final Field CRANKING_TPSCOEFFICIENT = Field.create("CRANKING_TPSCOEFFICIENT", 96, FieldType.FLOAT);
public static final Field CRANKING_DURATIONCOEFFICIENT = Field.create("CRANKING_DURATIONCOEFFICIENT", 100, FieldType.FLOAT);
public static final Field CRANKING_FUEL = Field.create("CRANKING_FUEL", 104, FieldType.FLOAT);
public static final Field RUNNING_POSTCRANKINGFUELCORRECTION = Field.create("RUNNING_POSTCRANKINGFUELCORRECTION", 108, FieldType.FLOAT);
public static final Field RUNNING_INTAKETEMPERATURECOEFFICIENT = Field.create("RUNNING_INTAKETEMPERATURECOEFFICIENT", 112, FieldType.FLOAT);
public static final Field RUNNING_COOLANTTEMPERATURECOEFFICIENT = Field.create("RUNNING_COOLANTTEMPERATURECOEFFICIENT", 116, FieldType.FLOAT);
public static final Field RUNNING_TIMESINCECRANKINGINSECS = Field.create("RUNNING_TIMESINCECRANKINGINSECS", 120, FieldType.FLOAT);
public static final Field RUNNING_INJECTORLAG = Field.create("RUNNING_INJECTORLAG", 124, FieldType.FLOAT);
public static final Field RUNNING_PIDCORRECTION = Field.create("RUNNING_PIDCORRECTION", 128, FieldType.FLOAT);
public static final Field RUNNING_BASEFUEL = Field.create("RUNNING_BASEFUEL", 132, FieldType.FLOAT);
public static final Field RUNNING_FUEL = Field.create("RUNNING_FUEL", 136, FieldType.FLOAT);
public static final Field ETBFEEDFORWARD = Field.create("ETBFEEDFORWARD", 140, FieldType.FLOAT);
public static final Field TARGETFROMTABLE = Field.create("TARGETFROMTABLE", 144, FieldType.FLOAT);
public static final Field[] VALUES = {
ISTCHARGEAIRMODEL,
AIRMASSINONECYLINDER,
@ -56,6 +58,7 @@ public class EngineState {
CURRENTIDLEPOSITION,
BASEIDLEPOSITION,
THROTTLEPEDALUPSTATE,
ETBIDLEADDITION,
TARGETAFR,
ENGINECYCLEDURATIONMS,
MINRPMKCURRENTTPS,
@ -81,5 +84,6 @@ public class EngineState {
RUNNING_BASEFUEL,
RUNNING_FUEL,
ETBFEEDFORWARD,
TARGETFROMTABLE,
};
}

View File

@ -1,8 +1,8 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/pid_state.txt Sun Sep 01 19:07:42 EDT 2019
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/pid_state.txt Sun Sep 22 08:31:57 EDT 2019
// by class com.rusefi.output.JavaFieldsConsumer
// by class com.rusefi.output.FileJavaFieldsConsumer
import com.rusefi.config.*;
public class PidState {

View File

@ -1,8 +1,8 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/thermistor_state.txt Sat Jul 20 12:28:04 EDT 2019
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/thermistor_state.txt Sun Sep 22 08:31:58 EDT 2019
// by class com.rusefi.output.JavaFieldsConsumer
// by class com.rusefi.output.FileJavaFieldsConsumer
import com.rusefi.config.*;
public class ThermistorState {

View File

@ -1,8 +1,8 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger_central.txt Tue Sep 03 19:14:15 EDT 2019
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger_central.txt Sun Sep 22 08:31:58 EDT 2019
// by class com.rusefi.output.JavaFieldsConsumer
// by class com.rusefi.output.FileJavaFieldsConsumer
import com.rusefi.config.*;
public class TriggerCentral {

View File

@ -1,8 +1,8 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger_state.txt Tue Sep 03 19:14:16 EDT 2019
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger_state.txt Sun Sep 22 08:31:58 EDT 2019
// by class com.rusefi.output.JavaFieldsConsumer
// by class com.rusefi.output.FileJavaFieldsConsumer
import com.rusefi.config.*;
public class TriggerState {

View File

@ -1,8 +1,8 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/wall_fuel_state.txt Sat Jul 20 12:28:05 EDT 2019
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/wall_fuel_state.txt Sun Sep 22 08:31:58 EDT 2019
// by class com.rusefi.output.JavaFieldsConsumer
// by class com.rusefi.output.FileJavaFieldsConsumer
import com.rusefi.config.*;
public class WallFuelState {