mirror of https://github.com/rusefi/rusefi-1.git
LiveData progress: isChanking & hasEtbPedalPositionSensor
This commit is contained in:
parent
71472af1c4
commit
4ddb0aeace
|
@ -256,6 +256,7 @@ class EtbController : public PeriodicTimerController {
|
|||
etbPid.showPidStatus(&logger, "ETB");
|
||||
}
|
||||
|
||||
DISPLAY(DISPLAY_IF(hasEtbPedalPositionSensor))
|
||||
DISPLAY_TEXT(Electrnoic_Throttle);
|
||||
DISPLAY_SENSOR(TPS)
|
||||
DISPLAY_TEXT(eol);
|
||||
|
@ -274,8 +275,9 @@ class EtbController : public PeriodicTimerController {
|
|||
DISPLAY(DISPLAY_CONFIG(ETB_PFACTOR));
|
||||
DISPLAY(DISPLAY_CONFIG(ETB_IFACTOR));
|
||||
DISPLAY(DISPLAY_CONFIG(ETB_DFACTOR));
|
||||
|
||||
|
||||
/* DISPLAY_ELSE */
|
||||
DISPLAY_TEXT(No_Pedal_Sensor);
|
||||
/* DISPLAY_ENDIF */
|
||||
tsOutputChannels.etbTarget = targetPosition;
|
||||
tsOutputChannels.etb1DutyCycle = currentEtbDuty;
|
||||
// Error is positive if the throttle needs to open further
|
||||
|
@ -490,7 +492,9 @@ void initElectronicThrottle(void) {
|
|||
addConsoleAction("ethinfo", showEthInfo);
|
||||
addConsoleAction("etbreset", etbReset);
|
||||
pedal2tpsMap.init(config->pedalToTpsTable, config->pedalToTpsPedalBins, config->pedalToTpsRpmBins);
|
||||
if (!hasPedalPositionSensor()) {
|
||||
|
||||
engine->engineState.hasEtbPedalPositionSensor = hasPedalPositionSensor();
|
||||
if (!engine->engineState.hasEtbPedalPositionSensor) {
|
||||
return;
|
||||
}
|
||||
autoTune.SetOutputStep(0.1);
|
||||
|
|
|
@ -530,6 +530,7 @@ void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
DISPLAY_TEXT(EOL);
|
||||
DISPLAY_TEXT(EOL);
|
||||
DISPLAY_SENSOR(TPS);
|
||||
DISPLAY_TEXT(EOL);
|
||||
DISPLAY_TEXT(Throttle_Up_State);
|
||||
DISPLAY(DISPLAY_FIELD(throttlePedalUpState));
|
||||
DISPLAY(DISPLAY_CONFIG(throttlePedalUpPin));
|
||||
|
|
|
@ -111,6 +111,10 @@ EngineState::EngineState() {
|
|||
}
|
||||
|
||||
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.clt = getCoolantTemperature(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ extern baroCorr_Map3D_t baroCorrMap;
|
|||
|
||||
#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) {
|
||||
// these magic constants are in Celsius
|
||||
float baseCrankingFuel = engineConfiguration->cranking.baseFuel;
|
||||
|
@ -122,8 +122,6 @@ floatms_t getRunningFuel(floatms_t baseFuel DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
return runningFuel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* DISPLAY_ENDIF */
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
// begin
|
||||
#ifndef CONTROLLERS_GENERATED_ENGINE_STATE_GENERATED_H
|
||||
|
@ -229,7 +229,10 @@ struct engine_state2_s {
|
|||
float baroCorrection = (float)0;
|
||||
/**
|
||||
offset 80 bit 0 */
|
||||
bool isCranking : 1;
|
||||
bool isCrankingState : 1;
|
||||
/**
|
||||
offset 80 bit 1 */
|
||||
bool hasEtbPedalPositionSensor : 1;
|
||||
/**
|
||||
* offset 84
|
||||
*/
|
||||
|
@ -245,4 +248,4 @@ 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 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
|
||||
|
|
|
@ -62,7 +62,8 @@ float tpsVoltageBoard
|
|||
float currentBaroCorrectedVE;
|
||||
float baroCorrection;
|
||||
|
||||
bit isCranking
|
||||
bit isCrankingState
|
||||
bit hasEtbPedalPositionSensor;
|
||||
|
||||
struct cranking_fuel_s
|
||||
|
||||
|
|
|
@ -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 FLOAT_VALUE_PREFIX = FLOAT_TYPE_STRING + Fields.CONSOLE_DATA_PROTOCOL_TAG;
|
||||
public static final int NO_BIT_OFFSET = -1;
|
||||
private static final int FIELD_PRECISION = 3;
|
||||
|
||||
private final String name;
|
||||
private final int offset;
|
||||
|
@ -74,16 +75,20 @@ public class Field {
|
|||
}
|
||||
|
||||
public static String niceToString(Number value) {
|
||||
return niceToString(value, FIELD_PRECISION);
|
||||
}
|
||||
|
||||
public static String niceToString(Number value, int precision) {
|
||||
// not enum field
|
||||
Number number = value;
|
||||
if (number instanceof Float)
|
||||
return niceToString(number.floatValue(), 3);
|
||||
return niceToString(number.floatValue(), precision);
|
||||
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 places = 1 + Math.max(0, i - scale);
|
||||
int places = 1 + Math.max(0, precision - scale);
|
||||
double toScale = Math.pow(10, places);
|
||||
return Double.toString(Math.round(value * toScale) / toScale);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
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 CURRENTBAROCORRECTEDVE = Field.create("CURRENTBAROCORRECTEDVE", 72, 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_COOLANTTEMPERATURECOEFFICIENT = Field.create("CRANKING_COOLANTTEMPERATURECOEFFICIENT", 88, FieldType.FLOAT);
|
||||
public static final Field CRANKING_TPSCOEFFICIENT = Field.create("CRANKING_TPSCOEFFICIENT", 92, FieldType.FLOAT);
|
||||
|
@ -73,7 +74,8 @@ public class EngineState {
|
|||
TPSVOLTAGEBOARD,
|
||||
CURRENTBAROCORRECTEDVE,
|
||||
BAROCORRECTION,
|
||||
ISCRANKING,
|
||||
ISCRANKINGSTATE,
|
||||
HASETBPEDALPOSITIONSENSOR,
|
||||
CRANKING_BASEFUEL,
|
||||
CRANKING_COOLANTTEMPERATURECOEFFICIENT,
|
||||
CRANKING_TPSCOEFFICIENT,
|
||||
|
|
|
@ -37,6 +37,8 @@ public class FieldTest {
|
|||
assertEquals("10000.0", Field.niceToString(10000.00002, 4));
|
||||
assertEquals("0.002", Field.niceToString(0.002, 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));
|
||||
}
|
||||
|
||||
|
|
|
@ -4,20 +4,25 @@ import com.rusefi.ldmp.*;
|
|||
|
||||
public class ElectronicThrottleMeta {
|
||||
public static final Request[] CONTENT = new Request[]{
|
||||
new TextRequest("Electrnoic_Throttle"),
|
||||
new SensorRequest("TPS"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Pedal"),
|
||||
new SensorRequest("PPS"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Output"),
|
||||
new FieldRequest("output"),
|
||||
new TextRequest("iTerm"),
|
||||
new FieldRequest("iTerm"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Settings"),
|
||||
new ConfigRequest("ETB_PFACTOR"),
|
||||
new ConfigRequest("ETB_IFACTOR"),
|
||||
new ConfigRequest("ETB_DFACTOR"),
|
||||
new IfRequest("hasEtbPedalPositionSensor",
|
||||
new Request[]{
|
||||
new SensorRequest("TPS"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Pedal"),
|
||||
new SensorRequest("PPS"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Output"),
|
||||
new FieldRequest("output"),
|
||||
new TextRequest("iTerm"),
|
||||
new FieldRequest("iTerm"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Settings"),
|
||||
new ConfigRequest("ETB_PFACTOR"),
|
||||
new ConfigRequest("ETB_IFACTOR"),
|
||||
new ConfigRequest("ETB_DFACTOR"),
|
||||
},
|
||||
new Request[]{
|
||||
new TextRequest("No_Pedal_Sensor"),
|
||||
}),
|
||||
};
|
||||
}
|
|
@ -4,7 +4,7 @@ import com.rusefi.ldmp.*;
|
|||
|
||||
public class FuelMathMeta {
|
||||
public static final Request[] CONTENT = new Request[]{
|
||||
new IfRequest("isCranking",
|
||||
new IfRequest("isCrankingState",
|
||||
new Request[]{
|
||||
new TextRequest("Duration_coef"),
|
||||
new FieldRequest("cranking_durationCoefficient"),
|
||||
|
|
|
@ -14,6 +14,7 @@ public class IdleThreadMeta {
|
|||
new TextRequest("EOL"),
|
||||
new TextRequest("EOL"),
|
||||
new SensorRequest("TPS"),
|
||||
new TextRequest("EOL"),
|
||||
new TextRequest("Throttle_Up_State"),
|
||||
new FieldRequest("throttlePedalUpState"),
|
||||
new ConfigRequest("throttlePedalUpPin"),
|
||||
|
|
|
@ -35,6 +35,7 @@ public class LiveDocPanel {
|
|||
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?
|
||||
private static final int MAGIC_DETACHED_GAUGE_SIZE = 200;
|
||||
private static final int LIVE_DATA_PRECISION = 2;
|
||||
|
||||
@NotNull
|
||||
static JPanel createPanel(String title, String instancePrefix, final int id, Field[] values, Request[] content) {
|
||||
|
@ -120,7 +121,7 @@ public class LiveDocPanel {
|
|||
@Override
|
||||
public void refresh(BinaryProtocol bp, byte[] response) {
|
||||
double value = SensorCentral.getInstance().getValue(sensor);
|
||||
label.setText(niceToString(value, 4));
|
||||
label.setText(niceToString(value, LIVE_DATA_PRECISION));
|
||||
}
|
||||
});
|
||||
} else if (r instanceof IfRequest) {
|
||||
|
|
Loading…
Reference in New Issue