Live Data progress
This commit is contained in:
parent
7ce9b2890e
commit
7842c7305f
|
@ -520,6 +520,7 @@ void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
initIdleHardware(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
|
||||
DISPLAY_STATE(Engine)
|
||||
DISPLAY_TEXT(Idle_State);
|
||||
engine->engineState.idle.DISPLAY_FIELD(idleState) = INIT;
|
||||
DISPLAY_TEXT(EOL);
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
#define DISPLAY_TAG(x)
|
||||
#define DISPLAY_TEXT(x)
|
||||
#define DISPLAY_STATE(x)
|
||||
#define DISPLAY_SENSOR(x) {}
|
||||
#define DISPLAY_IF(x) x
|
||||
|
||||
|
|
|
@ -487,6 +487,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
|||
bool isSynchronizationPoint;
|
||||
bool wasSynchronized = shaft_is_synchronized;
|
||||
|
||||
DISPLAY_STATE(Trigger)
|
||||
DISPLAY(DISPLAY_CONFIG(TRIGGERINPUTPINS1));
|
||||
DISPLAY_TEXT(Trigger_1_Fall);
|
||||
DISPLAY(DISPLAY_FIELD(HWEVENTCOUNTERS1));
|
||||
|
|
|
@ -7,9 +7,9 @@ public class AccelEnrichmentMeta {
|
|||
new ConfigRequest("wwaeTau"),
|
||||
new ConfigRequest("wwaeBeta"),
|
||||
new TextRequest("Current_Wall_Fuel_Film"),
|
||||
new FieldRequest("wallFuel"),
|
||||
new FieldRequest("","wallFuel"),
|
||||
new TextRequest("Fuel"),
|
||||
new FieldRequest("wallFuelCorrection"),
|
||||
new FieldRequest("","wallFuelCorrection"),
|
||||
new TextRequest("ms"),
|
||||
};
|
||||
}
|
|
@ -12,9 +12,9 @@ public class ElectronicThrottleMeta {
|
|||
new SensorRequest("PPS"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Output"),
|
||||
new FieldRequest("output"),
|
||||
new FieldRequest("","output"),
|
||||
new TextRequest("iTerm"),
|
||||
new FieldRequest("iTerm"),
|
||||
new FieldRequest("","iTerm"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Settings"),
|
||||
new ConfigRequest("ETB_PFACTOR"),
|
||||
|
|
|
@ -7,40 +7,40 @@ public class FuelMathMeta {
|
|||
new IfRequest("isCrankingState",
|
||||
new Request[]{
|
||||
new TextRequest("Duration_coef"),
|
||||
new FieldRequest("cranking_durationCoefficient"),
|
||||
new FieldRequest("","cranking_durationCoefficient"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Coolant_coef"),
|
||||
new FieldRequest("cranking_coolantTemperatureCoefficient"),
|
||||
new FieldRequest("","cranking_coolantTemperatureCoefficient"),
|
||||
new SensorRequest("CLT"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("TPS_coef"),
|
||||
new FieldRequest("cranking_tpsCoefficient"),
|
||||
new FieldRequest("","cranking_tpsCoefficient"),
|
||||
new SensorRequest("TPS"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Cranking_fuel"),
|
||||
new FieldRequest("cranking_fuel"),
|
||||
new FieldRequest("","cranking_fuel"),
|
||||
},
|
||||
new Request[]{
|
||||
new TextRequest("Base_fuel"),
|
||||
new FieldRequest("running_baseFuel"),
|
||||
new FieldRequest("","running_baseFuel"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Intake_coef"),
|
||||
new FieldRequest("running_intakeTemperatureCoefficient"),
|
||||
new FieldRequest("","running_intakeTemperatureCoefficient"),
|
||||
new SensorRequest("IAT"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Coolant_coef"),
|
||||
new FieldRequest("running_coolantTemperatureCoefficient"),
|
||||
new FieldRequest("","running_coolantTemperatureCoefficient"),
|
||||
new SensorRequest("CLT"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Post_cranking_coef"),
|
||||
new FieldRequest("running_postCrankingFuelCorrection"),
|
||||
new FieldRequest("","running_postCrankingFuelCorrection"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Running_fuel"),
|
||||
new FieldRequest("running_fuel"),
|
||||
new FieldRequest("","running_fuel"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Injector_lag"),
|
||||
new FieldRequest("running_injectorLag"),
|
||||
new FieldRequest("","running_injectorLag"),
|
||||
new SensorRequest("VBATT"),
|
||||
}),
|
||||
};
|
||||
|
|
|
@ -5,18 +5,18 @@ import com.rusefi.ldmp.*;
|
|||
public class IdleThreadMeta {
|
||||
public static final Request[] CONTENT = new Request[]{
|
||||
new TextRequest("Idle_State"),
|
||||
new FieldRequest("idleState"),
|
||||
new FieldRequest("Engine","idleState"),
|
||||
new TextRequest("EOL"),
|
||||
new TextRequest("Base_Position"),
|
||||
new FieldRequest("baseIdlePosition"),
|
||||
new FieldRequest("Engine","baseIdlePosition"),
|
||||
new TextRequest("Position_with_Adjustments"),
|
||||
new FieldRequest("currentIdlePosition"),
|
||||
new FieldRequest("Engine","currentIdlePosition"),
|
||||
new TextRequest("EOL"),
|
||||
new TextRequest("EOL"),
|
||||
new SensorRequest("TPS"),
|
||||
new TextRequest("EOL"),
|
||||
new TextRequest("Throttle_Up_State"),
|
||||
new FieldRequest("throttlePedalUpState"),
|
||||
new FieldRequest("Engine","throttlePedalUpState"),
|
||||
new ConfigRequest("throttlePedalUpPin"),
|
||||
};
|
||||
}
|
|
@ -7,7 +7,7 @@ public class SpeedDensityMeta {
|
|||
new IfRequest("isTChargeAirModel",
|
||||
new Request[]{
|
||||
new TextRequest("interpolate_Air_Flow"),
|
||||
new FieldRequest("airFlow"),
|
||||
new FieldRequest("","airFlow"),
|
||||
new TextRequest("Between"),
|
||||
new ConfigRequest("tChargeAirCoefMin"),
|
||||
new ConfigRequest("tChargeAirFlowMax"),
|
||||
|
|
|
@ -5,16 +5,16 @@ import com.rusefi.ldmp.*;
|
|||
public class ThermistorsMeta {
|
||||
public static final Request[] CONTENT = new Request[]{
|
||||
new TextRequest("Analog_MCU_reads"),
|
||||
new FieldRequest("voltageMCU"),
|
||||
new FieldRequest("","voltageMCU"),
|
||||
new TextRequest("from_pin"),
|
||||
new ConfigRequest("adcChannel"),
|
||||
new TextRequest("EOL"),
|
||||
new TextRequest("Analog_ECU_reads"),
|
||||
new FieldRequest("voltageBoard"),
|
||||
new FieldRequest("","voltageBoard"),
|
||||
new TextRequest("Rdivider"),
|
||||
new ConfigRequest("analogInputDividerCoefficient"),
|
||||
new TextRequest("EOL"),
|
||||
new TextRequest("Measured_resistance"),
|
||||
new FieldRequest("resistance"),
|
||||
new FieldRequest("","resistance"),
|
||||
};
|
||||
}
|
|
@ -11,18 +11,18 @@ public class TpsMeta {
|
|||
new SensorRequest("TPS"),
|
||||
new TextRequest("EOL"),
|
||||
new TextRequest("Analog_MCU_reads"),
|
||||
new FieldRequest("tpsVoltageMCU"),
|
||||
new FieldRequest("","tpsVoltageMCU"),
|
||||
new TextRequest("Volts"),
|
||||
new TextRequest("from_pin"),
|
||||
new ConfigRequest("tps1_1AdcChannel"),
|
||||
new TextRequest("EOL"),
|
||||
new TextRequest("Analog_ECU_reads"),
|
||||
new FieldRequest("tpsVoltageBoard"),
|
||||
new FieldRequest("","tpsVoltageBoard"),
|
||||
new TextRequest("Rdivider"),
|
||||
new ConfigRequest("analogInputDividerCoefficient"),
|
||||
new TextRequest("EOL"),
|
||||
new TextRequest("Current_ADC"),
|
||||
new FieldRequest("currentTpsAdc"),
|
||||
new FieldRequest("","currentTpsAdc"),
|
||||
new TextRequest("interpolate_between"),
|
||||
new ConfigRequest("tpsMax"),
|
||||
new TextRequest("and"),
|
||||
|
|
|
@ -6,14 +6,14 @@ public class TriggerDecoderMeta {
|
|||
public static final Request[] CONTENT = new Request[]{
|
||||
new ConfigRequest("TRIGGERINPUTPINS1"),
|
||||
new TextRequest("Trigger_1_Fall"),
|
||||
new FieldRequest("HWEVENTCOUNTERS1"),
|
||||
new FieldRequest("Trigger","HWEVENTCOUNTERS1"),
|
||||
new TextRequest("Rise"),
|
||||
new FieldRequest("HWEVENTCOUNTERS2"),
|
||||
new FieldRequest("Trigger","HWEVENTCOUNTERS2"),
|
||||
new TextRequest("EOL"),
|
||||
new ConfigRequest("TRIGGERINPUTPINS2"),
|
||||
new TextRequest("Trigger_2_Fall"),
|
||||
new FieldRequest("HWEVENTCOUNTERS3"),
|
||||
new FieldRequest("Trigger","HWEVENTCOUNTERS3"),
|
||||
new TextRequest("Rise"),
|
||||
new FieldRequest("HWEVENTCOUNTERS4"),
|
||||
new FieldRequest("Trigger","HWEVENTCOUNTERS4"),
|
||||
};
|
||||
}
|
|
@ -3,8 +3,6 @@ package com.rusefi.ldmp;
|
|||
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.rusefi.ConfigDefinition.EOL;
|
||||
|
||||
/**
|
||||
* Reference to a parameter from configuration
|
||||
*
|
||||
|
@ -43,7 +41,7 @@ public class ConfigRequest extends Request {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getJavaCode() {
|
||||
public String getGeneratedJavaCode() {
|
||||
return withSimpleParameter(quoteString(field));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,14 @@ package com.rusefi.ldmp;
|
|||
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.rusefi.ConfigDefinition.EOL;
|
||||
|
||||
public class FieldRequest extends Request {
|
||||
private final String stateContext;
|
||||
private final String field;
|
||||
|
||||
public FieldRequest(String field) {
|
||||
public FieldRequest(String stateContext, String field) {
|
||||
this.stateContext = stateContext;
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
|
@ -16,7 +20,8 @@ public class FieldRequest extends Request {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "FieldRequest{" +
|
||||
"field='" + field + '\'' +
|
||||
"stateContext='" + stateContext + '\'' +
|
||||
", field='" + field + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
@ -24,18 +29,23 @@ public class FieldRequest extends Request {
|
|||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
FieldRequest that = (FieldRequest) o;
|
||||
return field.equals(that.field);
|
||||
FieldRequest request = (FieldRequest) o;
|
||||
return stateContext.equals(request.stateContext) &&
|
||||
field.equals(request.field);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(field);
|
||||
return Objects.hash(stateContext, field);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJavaCode() {
|
||||
return withSimpleParameter(quoteString(field));
|
||||
public String getGeneratedJavaCode() {
|
||||
return GLOBAL_PREFIX + "new " + getClass().getSimpleName() + "("
|
||||
+ quoteString(stateContext)
|
||||
+ ","
|
||||
+ quoteString(field)
|
||||
+ ")," + EOL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,17 +35,17 @@ public class IfRequest extends Request {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getJavaCode() {
|
||||
public String getGeneratedJavaCode() {
|
||||
String result = Request.GLOBAL_PREFIX;
|
||||
|
||||
Request.GLOBAL_PREFIX = Request.GLOBAL_PREFIX + "\t";
|
||||
|
||||
result += "new IfRequest(" + quoteString(variable) + "," + EOL +
|
||||
Request.GLOBAL_PREFIX + "new Request[]{" + EOL +
|
||||
Request.printList(trueBlock) +
|
||||
Request.getGeneratedJavaCode(trueBlock) +
|
||||
"}," + EOL +
|
||||
Request.GLOBAL_PREFIX + "new Request[]{" + EOL +
|
||||
Request.printList(falseBlock) +
|
||||
Request.getGeneratedJavaCode(falseBlock) +
|
||||
"})," + EOL;
|
||||
|
||||
Request.GLOBAL_PREFIX = Request.GLOBAL_PREFIX.substring(1);
|
||||
|
|
|
@ -18,6 +18,7 @@ public class LiveDocsMetaParser {
|
|||
private static final String DISPLAY_CONFIG = "DISPLAY_CONFIG";
|
||||
private static final String DISPLAY_PREFIX = "DISPLAY_PREFIX";
|
||||
private static final String DISPLAY_FIELD = "DISPLAY_FIELD";
|
||||
private static final String DISPLAY_STATE = "DISPLAY_STATE";
|
||||
private static final String DISPLAY_TEXT = "DISPLAY_TEXT";
|
||||
private static final String DISPLAY_SENSOR = "DISPLAY_SENSOR";
|
||||
private static final String DISPLAY_IF = "DISPLAY_IF";
|
||||
|
@ -79,6 +80,10 @@ public class LiveDocsMetaParser {
|
|||
SystemOut.println("REQ CONF " + config);
|
||||
result.add(new ConfigRequest(config));
|
||||
}
|
||||
} else if (DISPLAY_STATE.equalsIgnoreCase(token)) {
|
||||
if (s.hasNext()) {
|
||||
String state = s.next();
|
||||
meta.stateStack.push(state); }
|
||||
} else if (DISPLAY_TEXT.equalsIgnoreCase(token)) {
|
||||
if (s.hasNext()) {
|
||||
String config = s.next();
|
||||
|
@ -100,7 +105,7 @@ public class LiveDocsMetaParser {
|
|||
if (s.hasNext()) {
|
||||
String config = prefix + s.next();
|
||||
SystemOut.println("REQ FIELD " + config);
|
||||
result.add(new FieldRequest(config));
|
||||
result.add(new FieldRequest(meta.getStateContext(), config));
|
||||
prefix.setLength(0);
|
||||
}
|
||||
} else if (DISPLAY_IF.equalsIgnoreCase(token)) {
|
||||
|
@ -162,7 +167,7 @@ public class LiveDocsMetaParser {
|
|||
java.append("\tpublic static final Request[] " +
|
||||
e.getKey() +
|
||||
" = new Request[]{" + EOL);
|
||||
java.append(Request.printList(list));
|
||||
java.append(Request.getGeneratedJavaCode(list));
|
||||
java.append("\t};" + EOL);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.*;
|
|||
|
||||
public class MetaInfo {
|
||||
public Map<String, List<Request>> map = new TreeMap<>();
|
||||
|
||||
public Stack<String> stateStack = new Stack<>();
|
||||
|
||||
public List<Request> start(String content) {
|
||||
map.putIfAbsent(content, new ArrayList<>());
|
||||
|
@ -14,4 +14,10 @@ public class MetaInfo {
|
|||
public List<Request> first() {
|
||||
return map.values().iterator().next();
|
||||
}
|
||||
|
||||
public String getStateContext() {
|
||||
if (stateStack.isEmpty())
|
||||
return ""; // state context not defined, java code would have to explicitly provide that information
|
||||
return stateStack.peek();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,14 +7,14 @@ import static com.rusefi.ConfigDefinition.EOL;
|
|||
public abstract class Request {
|
||||
static String GLOBAL_PREFIX = "\t\t\t";
|
||||
|
||||
static String printList(List<Request> r) {
|
||||
static String getGeneratedJavaCode(List<Request> r) {
|
||||
StringBuilder java = new StringBuilder();
|
||||
for (Request request : r)
|
||||
java.append(request.getJavaCode());
|
||||
java.append(request.getGeneratedJavaCode());
|
||||
return java.toString();
|
||||
}
|
||||
|
||||
public abstract String getJavaCode();
|
||||
public abstract String getGeneratedJavaCode();
|
||||
|
||||
protected String withSimpleParameter(String parameter) {
|
||||
return GLOBAL_PREFIX + "new " + getClass().getSimpleName() + "(" + parameter + ")," + EOL;
|
||||
|
|
|
@ -34,7 +34,7 @@ public class SensorRequest extends Request {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getJavaCode() {
|
||||
public String getGeneratedJavaCode() {
|
||||
return withSimpleParameter(quoteString(value));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@ package com.rusefi.ldmp;
|
|||
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.rusefi.ConfigDefinition.EOL;
|
||||
|
||||
/**
|
||||
* Static text label
|
||||
*/
|
||||
|
@ -43,7 +41,7 @@ public class TextRequest extends Request {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getJavaCode() {
|
||||
public String getGeneratedJavaCode() {
|
||||
return withSimpleParameter(quoteString(value));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,9 @@ public class LiveDocsMetaParserTest {
|
|||
|
||||
@Test
|
||||
public void parseField() {
|
||||
MetaInfo r = LiveDocsMetaParser.parse("\tDISPLAY_TEXT(Analog_MCU_reads);\n" +
|
||||
MetaInfo r = LiveDocsMetaParser.parse(
|
||||
"DISPLAY_STATE(tps)\n" +
|
||||
"\tDISPLAY_TEXT(Analog_MCU_reads);\n" +
|
||||
"\tengine->engineState.DISPLAY_FIELD(currentTpsAdc) = adc;\n" +
|
||||
"\tDISPLAY_TEXT(ADC_which_equals);\n");
|
||||
assertEquals(3, r.first().size());
|
||||
|
@ -63,10 +65,13 @@ public class LiveDocsMetaParserTest {
|
|||
|
||||
@Test
|
||||
public void testField() {
|
||||
MetaInfo r = LiveDocsMetaParser.parse("tm->DISPLAY_FIELD(voltageMCU) = getVoltage(\"term\", config->adcChannel);\n" +
|
||||
"DISPLAY_tag(tag) DISPLAY_FIELD(voltageMCU2)");
|
||||
MetaInfo r = LiveDocsMetaParser.parse(
|
||||
"DISPLAY_STATE(tps)\n" +
|
||||
"tm->DISPLAY_FIELD(voltageMCU) = getVoltage(\"term\", config->adcChannel);\n" +
|
||||
|
||||
"DISPLAY_tag(tag) DISPLAY_FIELD(voltageMCU2)");
|
||||
assertEquals(1, r.first().size());
|
||||
assertEquals(new FieldRequest("voltageMCU"), r.first().get(0));
|
||||
assertEquals(new FieldRequest("tps", "voltageMCU"), r.first().get(0));
|
||||
|
||||
assertEquals(2, r.map.size());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue