LiveData progress: isChanking & hasEtbPedalPositionSensor

This commit is contained in:
rusefi 2019-08-31 17:07:21 -04:00
parent 71472af1c4
commit 4ddb0aeace
13 changed files with 60 additions and 33 deletions

View File

@ -256,6 +256,7 @@ class EtbController : public PeriodicTimerController {
etbPid.showPidStatus(&logger, "ETB"); etbPid.showPidStatus(&logger, "ETB");
} }
DISPLAY(DISPLAY_IF(hasEtbPedalPositionSensor))
DISPLAY_TEXT(Electrnoic_Throttle); DISPLAY_TEXT(Electrnoic_Throttle);
DISPLAY_SENSOR(TPS) DISPLAY_SENSOR(TPS)
DISPLAY_TEXT(eol); DISPLAY_TEXT(eol);
@ -274,8 +275,9 @@ class EtbController : public PeriodicTimerController {
DISPLAY(DISPLAY_CONFIG(ETB_PFACTOR)); DISPLAY(DISPLAY_CONFIG(ETB_PFACTOR));
DISPLAY(DISPLAY_CONFIG(ETB_IFACTOR)); DISPLAY(DISPLAY_CONFIG(ETB_IFACTOR));
DISPLAY(DISPLAY_CONFIG(ETB_DFACTOR)); DISPLAY(DISPLAY_CONFIG(ETB_DFACTOR));
/* DISPLAY_ELSE */
DISPLAY_TEXT(No_Pedal_Sensor);
/* DISPLAY_ENDIF */
tsOutputChannels.etbTarget = targetPosition; tsOutputChannels.etbTarget = targetPosition;
tsOutputChannels.etb1DutyCycle = currentEtbDuty; tsOutputChannels.etb1DutyCycle = currentEtbDuty;
// Error is positive if the throttle needs to open further // Error is positive if the throttle needs to open further
@ -490,7 +492,9 @@ void initElectronicThrottle(void) {
addConsoleAction("ethinfo", showEthInfo); addConsoleAction("ethinfo", showEthInfo);
addConsoleAction("etbreset", etbReset); addConsoleAction("etbreset", etbReset);
pedal2tpsMap.init(config->pedalToTpsTable, config->pedalToTpsPedalBins, config->pedalToTpsRpmBins); pedal2tpsMap.init(config->pedalToTpsTable, config->pedalToTpsPedalBins, config->pedalToTpsRpmBins);
if (!hasPedalPositionSensor()) {
engine->engineState.hasEtbPedalPositionSensor = hasPedalPositionSensor();
if (!engine->engineState.hasEtbPedalPositionSensor) {
return; return;
} }
autoTune.SetOutputStep(0.1); autoTune.SetOutputStep(0.1);

View File

@ -530,6 +530,7 @@ void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
DISPLAY_TEXT(EOL); DISPLAY_TEXT(EOL);
DISPLAY_TEXT(EOL); DISPLAY_TEXT(EOL);
DISPLAY_SENSOR(TPS); DISPLAY_SENSOR(TPS);
DISPLAY_TEXT(EOL);
DISPLAY_TEXT(Throttle_Up_State); DISPLAY_TEXT(Throttle_Up_State);
DISPLAY(DISPLAY_FIELD(throttlePedalUpState)); DISPLAY(DISPLAY_FIELD(throttlePedalUpState));
DISPLAY(DISPLAY_CONFIG(throttlePedalUpPin)); DISPLAY(DISPLAY_CONFIG(throttlePedalUpPin));

View File

@ -111,6 +111,10 @@ EngineState::EngineState() {
} }
void EngineState::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void EngineState::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// this feeds rusEfi console Live Data
engine->engineState.isCrankingState = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE);
engine->sensors.iat = getIntakeAirTemperature(PASS_ENGINE_PARAMETER_SIGNATURE); engine->sensors.iat = getIntakeAirTemperature(PASS_ENGINE_PARAMETER_SIGNATURE);
engine->sensors.clt = getCoolantTemperature(PASS_ENGINE_PARAMETER_SIGNATURE); engine->sensors.clt = getCoolantTemperature(PASS_ENGINE_PARAMETER_SIGNATURE);

View File

@ -41,7 +41,7 @@ extern baroCorr_Map3D_t baroCorrMap;
#if EFI_ENGINE_CONTROL #if EFI_ENGINE_CONTROL
DISPLAY(DISPLAY_IF(isCranking)) floatms_t getCrankingFuel3(float coolantTemperature, DISPLAY(DISPLAY_IF(isCrankingState)) floatms_t getCrankingFuel3(float coolantTemperature,
uint32_t revolutionCounterSinceStart DECLARE_ENGINE_PARAMETER_SUFFIX) { uint32_t revolutionCounterSinceStart DECLARE_ENGINE_PARAMETER_SUFFIX) {
// these magic constants are in Celsius // these magic constants are in Celsius
float baseCrankingFuel = engineConfiguration->cranking.baseFuel; float baseCrankingFuel = engineConfiguration->cranking.baseFuel;
@ -122,8 +122,6 @@ floatms_t getRunningFuel(floatms_t baseFuel DECLARE_ENGINE_PARAMETER_SUFFIX) {
return runningFuel; return runningFuel;
} }
/* DISPLAY_ENDIF */ /* DISPLAY_ENDIF */
/** /**

View File

@ -1,4 +1,4 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Fri Aug 30 18:02:22 EDT 2019 // this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Sat Aug 31 11:02:25 EDT 2019
// by class com.rusefi.output.CHeaderConsumer // by class com.rusefi.output.CHeaderConsumer
// begin // begin
#ifndef CONTROLLERS_GENERATED_ENGINE_STATE_GENERATED_H #ifndef CONTROLLERS_GENERATED_ENGINE_STATE_GENERATED_H
@ -229,7 +229,10 @@ struct engine_state2_s {
float baroCorrection = (float)0; float baroCorrection = (float)0;
/** /**
offset 80 bit 0 */ offset 80 bit 0 */
bool isCranking : 1; bool isCrankingState : 1;
/**
offset 80 bit 1 */
bool hasEtbPedalPositionSensor : 1;
/** /**
* offset 84 * offset 84
*/ */
@ -245,4 +248,4 @@ typedef struct engine_state2_s engine_state2_s;
#endif #endif
// end // end
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Fri Aug 30 18:02:22 EDT 2019 // this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Sat Aug 31 11:02:25 EDT 2019

View File

@ -62,7 +62,8 @@ float tpsVoltageBoard
float currentBaroCorrectedVE; float currentBaroCorrectedVE;
float baroCorrection; float baroCorrection;
bit isCranking bit isCrankingState
bit hasEtbPedalPositionSensor;
struct cranking_fuel_s struct cranking_fuel_s

View File

@ -19,6 +19,7 @@ public class Field {
private static final String INT_VALUE_PREFIX = INT_TYPE_STRING + Fields.CONSOLE_DATA_PROTOCOL_TAG; private static final String INT_VALUE_PREFIX = INT_TYPE_STRING + Fields.CONSOLE_DATA_PROTOCOL_TAG;
private static final String FLOAT_VALUE_PREFIX = FLOAT_TYPE_STRING + Fields.CONSOLE_DATA_PROTOCOL_TAG; private static final String FLOAT_VALUE_PREFIX = FLOAT_TYPE_STRING + Fields.CONSOLE_DATA_PROTOCOL_TAG;
public static final int NO_BIT_OFFSET = -1; public static final int NO_BIT_OFFSET = -1;
private static final int FIELD_PRECISION = 3;
private final String name; private final String name;
private final int offset; private final int offset;
@ -74,16 +75,20 @@ public class Field {
} }
public static String niceToString(Number value) { public static String niceToString(Number value) {
return niceToString(value, FIELD_PRECISION);
}
public static String niceToString(Number value, int precision) {
// not enum field // not enum field
Number number = value; Number number = value;
if (number instanceof Float) if (number instanceof Float)
return niceToString(number.floatValue(), 3); return niceToString(number.floatValue(), precision);
return number.toString(); return number.toString();
} }
public static String niceToString(double value, int i) { public static String niceToString(double value, int precision) {
int scale = (int) Math.log10(value); int scale = (int) Math.log10(value);
int places = 1 + Math.max(0, i - scale); int places = 1 + Math.max(0, precision - scale);
double toScale = Math.pow(10, places); double toScale = Math.pow(10, places);
return Double.toString(Math.round(value * toScale) / toScale); return Double.toString(Math.round(value * toScale) / toScale);
} }

View File

@ -1,6 +1,6 @@
package com.rusefi.config.generated; package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Fri Aug 30 18:02:22 EDT 2019 // this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Sat Aug 31 11:02:25 EDT 2019
// by class com.rusefi.output.JavaFieldsConsumer // by class com.rusefi.output.JavaFieldsConsumer
import com.rusefi.config.*; import com.rusefi.config.*;
@ -32,7 +32,8 @@ public class EngineState {
public static final Field TPSVOLTAGEBOARD = Field.create("TPSVOLTAGEBOARD", 68, 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 CURRENTBAROCORRECTEDVE = Field.create("CURRENTBAROCORRECTEDVE", 72, FieldType.FLOAT);
public static final Field BAROCORRECTION = Field.create("BAROCORRECTION", 76, FieldType.FLOAT); public static final Field BAROCORRECTION = Field.create("BAROCORRECTION", 76, FieldType.FLOAT);
public static final Field ISCRANKING = Field.create("ISCRANKING", 80, FieldType.BIT, 0); 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 CRANKING_BASEFUEL = Field.create("CRANKING_BASEFUEL", 84, FieldType.FLOAT); 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_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_TPSCOEFFICIENT = Field.create("CRANKING_TPSCOEFFICIENT", 92, FieldType.FLOAT);
@ -73,7 +74,8 @@ public class EngineState {
TPSVOLTAGEBOARD, TPSVOLTAGEBOARD,
CURRENTBAROCORRECTEDVE, CURRENTBAROCORRECTEDVE,
BAROCORRECTION, BAROCORRECTION,
ISCRANKING, ISCRANKINGSTATE,
HASETBPEDALPOSITIONSENSOR,
CRANKING_BASEFUEL, CRANKING_BASEFUEL,
CRANKING_COOLANTTEMPERATURECOEFFICIENT, CRANKING_COOLANTTEMPERATURECOEFFICIENT,
CRANKING_TPSCOEFFICIENT, CRANKING_TPSCOEFFICIENT,

View File

@ -37,6 +37,8 @@ public class FieldTest {
assertEquals("10000.0", Field.niceToString(10000.00002, 4)); assertEquals("10000.0", Field.niceToString(10000.00002, 4));
assertEquals("0.002", Field.niceToString(0.002, 4)); assertEquals("0.002", Field.niceToString(0.002, 4));
assertEquals("12.302", Field.niceToString(12.302, 4)); assertEquals("12.302", Field.niceToString(12.302, 4));
assertEquals("12.302", Field.niceToString(12.302, 3));
assertEquals("12.31", Field.niceToString(12.312, 2));
assertEquals("123.02", Field.niceToString(123.02, 4)); assertEquals("123.02", Field.niceToString(123.02, 4));
} }

View File

@ -4,20 +4,25 @@ import com.rusefi.ldmp.*;
public class ElectronicThrottleMeta { public class ElectronicThrottleMeta {
public static final Request[] CONTENT = new Request[]{ public static final Request[] CONTENT = new Request[]{
new TextRequest("Electrnoic_Throttle"), new IfRequest("hasEtbPedalPositionSensor",
new SensorRequest("TPS"), new Request[]{
new TextRequest("eol"), new SensorRequest("TPS"),
new TextRequest("Pedal"), new TextRequest("eol"),
new SensorRequest("PPS"), new TextRequest("Pedal"),
new TextRequest("eol"), new SensorRequest("PPS"),
new TextRequest("Output"), new TextRequest("eol"),
new FieldRequest("output"), new TextRequest("Output"),
new TextRequest("iTerm"), new FieldRequest("output"),
new FieldRequest("iTerm"), new TextRequest("iTerm"),
new TextRequest("eol"), new FieldRequest("iTerm"),
new TextRequest("Settings"), new TextRequest("eol"),
new ConfigRequest("ETB_PFACTOR"), new TextRequest("Settings"),
new ConfigRequest("ETB_IFACTOR"), new ConfigRequest("ETB_PFACTOR"),
new ConfigRequest("ETB_DFACTOR"), new ConfigRequest("ETB_IFACTOR"),
new ConfigRequest("ETB_DFACTOR"),
},
new Request[]{
new TextRequest("No_Pedal_Sensor"),
}),
}; };
} }

View File

@ -4,7 +4,7 @@ import com.rusefi.ldmp.*;
public class FuelMathMeta { public class FuelMathMeta {
public static final Request[] CONTENT = new Request[]{ public static final Request[] CONTENT = new Request[]{
new IfRequest("isCranking", new IfRequest("isCrankingState",
new Request[]{ new Request[]{
new TextRequest("Duration_coef"), new TextRequest("Duration_coef"),
new FieldRequest("cranking_durationCoefficient"), new FieldRequest("cranking_durationCoefficient"),

View File

@ -14,6 +14,7 @@ public class IdleThreadMeta {
new TextRequest("EOL"), new TextRequest("EOL"),
new TextRequest("EOL"), new TextRequest("EOL"),
new SensorRequest("TPS"), new SensorRequest("TPS"),
new TextRequest("EOL"),
new TextRequest("Throttle_Up_State"), new TextRequest("Throttle_Up_State"),
new FieldRequest("throttlePedalUpState"), new FieldRequest("throttlePedalUpState"),
new ConfigRequest("throttlePedalUpPin"), new ConfigRequest("throttlePedalUpPin"),

View File

@ -35,6 +35,7 @@ public class LiveDocPanel {
private static final String LAYOUT = "gap 0, insets 0"; private static final String LAYOUT = "gap 0, insets 0";
// todo: replace magic hard-coded value with some relative number, maybe 1/3 of frame height or something? // todo: replace magic hard-coded value with some relative number, maybe 1/3 of frame height or something?
private static final int MAGIC_DETACHED_GAUGE_SIZE = 200; private static final int MAGIC_DETACHED_GAUGE_SIZE = 200;
private static final int LIVE_DATA_PRECISION = 2;
@NotNull @NotNull
static JPanel createPanel(String title, String instancePrefix, final int id, Field[] values, Request[] content) { static JPanel createPanel(String title, String instancePrefix, final int id, Field[] values, Request[] content) {
@ -120,7 +121,7 @@ public class LiveDocPanel {
@Override @Override
public void refresh(BinaryProtocol bp, byte[] response) { public void refresh(BinaryProtocol bp, byte[] response) {
double value = SensorCentral.getInstance().getValue(sensor); double value = SensorCentral.getInstance().getValue(sensor);
label.setText(niceToString(value, 4)); label.setText(niceToString(value, LIVE_DATA_PRECISION));
} }
}); });
} else if (r instanceof IfRequest) { } else if (r instanceof IfRequest) {