Annotations in C++ code to produce formulas in rusEfi console #807
This commit is contained in:
parent
dd43f62706
commit
ed4b2cc17e
|
@ -49,26 +49,26 @@ float getTCharge(int rpm, float tps, float coolantTemp, float airTemp DECLARE_EN
|
|||
engine->engineState.DISPLAY_FIELD(airFlow) = airFlow;
|
||||
DISPLAY_TEXT(Between)
|
||||
engine->engineState.Tcharge_coff = interpolateClamped(0.0,
|
||||
DISPLAY_TEXT(tChargeAirCoefMin) CONFIG(DISPLAY_CONFIG(tChargeAirCoefMin)),
|
||||
DISPLAY_TEXT(tChargeAirFlowMax) CONFIG(DISPLAY_CONFIG(tChargeAirFlowMax)),
|
||||
DISPLAY_TEXT(tChargeAirCoefMax) CONFIG(DISPLAY_CONFIG(tChargeAirCoefMax)), airFlow);
|
||||
CONFIG(DISPLAY_CONFIG(tChargeAirCoefMin)),
|
||||
CONFIG(DISPLAY_CONFIG(tChargeAirFlowMax)),
|
||||
CONFIG(DISPLAY_CONFIG(tChargeAirCoefMax)), airFlow);
|
||||
// save it for console output (instead of MAF massAirFlow)
|
||||
} else/* DISPLAY_ELSE */ {
|
||||
// TCHARGE_MODE_RPM_TPS
|
||||
DISPLAY_TEXT(interpolate_RPM)
|
||||
DISPLAY_TEXT(interpolate_3D)
|
||||
DISPLAY_SENSOR(RPM)
|
||||
DISPLAY_TEXT(and_TPS)
|
||||
DISPLAY_TEXT(and)
|
||||
DISPLAY_SENSOR(TPS)
|
||||
DISPLAY_TEXT(EOL)
|
||||
DISPLAY_TEXT(Between)
|
||||
float minRpmKcurrentTPS = interpolateMsg("minRpm", tpMin,
|
||||
DISPLAY_TEXT(tChargeMinRpmMinTps) CONFIG(DISPLAY_CONFIG(tChargeMinRpmMinTps)), tpMax, DISPLAY_TEXT(EOL)
|
||||
DISPLAY_TEXT(tChargeMinRpmMaxTps) CONFIG(DISPLAY_CONFIG(tChargeMinRpmMaxTps)), tps);
|
||||
float maxRpmKcurrentTPS = interpolateMsg("maxRpm", tpMin, CONFIG(DISPLAY_CONFIG(tChargeMaxRpmMinTps)), tpMax,
|
||||
CONFIG(DISPLAY_CONFIG(tChargeMinRpmMinTps)), tpMax,
|
||||
CONFIG(DISPLAY_CONFIG(tChargeMinRpmMaxTps)), tps);
|
||||
DISPLAY_TEXT(EOL)
|
||||
float maxRpmKcurrentTPS = interpolateMsg("maxRpm", tpMin,
|
||||
CONFIG(DISPLAY_CONFIG(tChargeMaxRpmMinTps)), tpMax,
|
||||
CONFIG(DISPLAY_CONFIG(tChargeMaxRpmMaxTps)), tps);
|
||||
|
||||
//ISPLAY_TEXT()
|
||||
|
||||
engine->engineState.Tcharge_coff = interpolateMsg("Kcurr", rpmMin, minRpmKcurrentTPS, rpmMax, maxRpmKcurrentTPS, rpm);
|
||||
/* DISPLAY_ENDIF */
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public enum Sensor {
|
|||
// COOLANT_WIDTH("c w", "", 30),
|
||||
// INTAKE_AIR_WIDTH("air w", "", 30),
|
||||
|
||||
// VREF("VRef", SensorCategory.SENSOR_INPUTS, "Volts", 6),
|
||||
// VREF("VRef", SensorCategory.SENSOR_INPUTS, "Volts", 6),
|
||||
VBATT("VBatt", SensorCategory.SENSOR_INPUTS, FieldType.FLOAT, 28, BackgroundColor.BEIGE, 4, 18, "Volts"),
|
||||
|
||||
ETB_CONTROL_QUALITY("ETB metric", SensorCategory.SNIFFING, "", 100),
|
||||
|
@ -196,6 +196,13 @@ public enum Sensor {
|
|||
return sensor;
|
||||
}
|
||||
|
||||
public static Sensor find(String value) {
|
||||
for (Sensor s : values())
|
||||
if (s.name.equals(value))
|
||||
return s;
|
||||
throw new IllegalStateException("Sensor not found: " + value);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -9,25 +9,20 @@ public class SpeedDensityMeta {
|
|||
new TextRequest("interpolate_Air_Flow"),
|
||||
new FieldRequest("airFlow"),
|
||||
new TextRequest("Between"),
|
||||
new TextRequest("tChargeAirCoefMin"),
|
||||
new ConfigRequest("tChargeAirCoefMin"),
|
||||
new TextRequest("tChargeAirFlowMax"),
|
||||
new ConfigRequest("tChargeAirFlowMax"),
|
||||
new TextRequest("tChargeAirCoefMax"),
|
||||
new ConfigRequest("tChargeAirCoefMax"),
|
||||
},
|
||||
new Request[]{
|
||||
new TextRequest("interpolate_RPM"),
|
||||
new TextRequest("interpolate_3D"),
|
||||
new SensorRequest("RPM"),
|
||||
new TextRequest("and_TPS"),
|
||||
new TextRequest("and"),
|
||||
new SensorRequest("TPS"),
|
||||
new TextRequest("EOL"),
|
||||
new TextRequest("Between"),
|
||||
new TextRequest("tChargeMinRpmMinTps"),
|
||||
new ConfigRequest("tChargeMinRpmMinTps"),
|
||||
new TextRequest("EOL"),
|
||||
new TextRequest("tChargeMinRpmMaxTps"),
|
||||
new ConfigRequest("tChargeMinRpmMaxTps"),
|
||||
new TextRequest("EOL"),
|
||||
new ConfigRequest("tChargeMaxRpmMinTps"),
|
||||
new ConfigRequest("tChargeMaxRpmMaxTps"),
|
||||
}),
|
||||
|
|
|
@ -6,11 +6,14 @@ import com.rusefi.config.Field;
|
|||
import com.rusefi.config.generated.EngineState;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.config.generated.ThermistorState;
|
||||
import com.rusefi.core.Sensor;
|
||||
import com.rusefi.core.SensorCentral;
|
||||
import com.rusefi.ldmp.*;
|
||||
import com.rusefi.ldmp.generated.SpeedDensityMeta;
|
||||
import com.rusefi.ldmp.generated.ThermistorsMeta;
|
||||
import com.rusefi.ldmp.generated.TpsMeta;
|
||||
import com.rusefi.ui.livedocs.controls.Toolbox;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.putgemin.VerticalFlowLayout;
|
||||
|
||||
|
@ -19,6 +22,8 @@ import java.awt.*;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.rusefi.config.Field.niceToString;
|
||||
|
||||
public class LiveDocPanel {
|
||||
@NotNull
|
||||
public static JPanel getPanel(String title, String instancePrefix, final int id, Field[] values, Request[] content) {
|
||||
|
@ -58,12 +63,14 @@ public class LiveDocPanel {
|
|||
FieldRequest request = (FieldRequest) r;
|
||||
Field field = Field.findField(values, "", request.getField());
|
||||
JLabel label = new JLabel("*");
|
||||
label.setIcon(UiUtils.loadIcon("livedocs/variable.png"));
|
||||
label.setToolTipText("Variable " + field.getName());
|
||||
result.addControl(label);
|
||||
result.actionsList.add(new RefreshActions() {
|
||||
@Override
|
||||
public void refresh(BinaryProtocol bp, byte[] response) {
|
||||
Number fieldValue = field.getValue(new ConfigurationImage(response));
|
||||
String value = Field.niceToString(fieldValue);
|
||||
String value = niceToString(fieldValue);
|
||||
label.setText(value);
|
||||
}
|
||||
});
|
||||
|
@ -72,6 +79,8 @@ public class LiveDocPanel {
|
|||
Field field = Field.findField(Fields.VALUES, instancePrefix, request.getField());
|
||||
|
||||
JLabel label = new JLabel("*");
|
||||
label.setIcon(UiUtils.loadIcon("livedocs/setting.png"));
|
||||
label.setToolTipText("Configuration " + field.getName());
|
||||
result.actionsList.add(new RefreshActions() {
|
||||
@Override
|
||||
public void refresh(BinaryProtocol bp, byte[] response) {
|
||||
|
@ -82,7 +91,18 @@ public class LiveDocPanel {
|
|||
result.addControl(label);
|
||||
} else if (r instanceof SensorRequest) {
|
||||
SensorRequest request = (SensorRequest) r;
|
||||
result.addControl(new JLabel("*"));
|
||||
Sensor sensor = Sensor.find(request.getValue());
|
||||
JLabel label = new JLabel("*");
|
||||
result.addControl(label);
|
||||
label.setIcon(UiUtils.loadIcon("livedocs/gauge.png"));
|
||||
label.setToolTipText("Sensor " + request.getValue());
|
||||
result.actionsList.add(new RefreshActions() {
|
||||
@Override
|
||||
public void refresh(BinaryProtocol bp, byte[] response) {
|
||||
double value = SensorCentral.getInstance().getValue(sensor);
|
||||
label.setText(niceToString(value));
|
||||
}
|
||||
});
|
||||
} else if (r instanceof IfRequest) {
|
||||
IfRequest request = (IfRequest) r;
|
||||
|
||||
|
@ -104,7 +124,8 @@ public class LiveDocPanel {
|
|||
|
||||
JPanel result = new JPanel(new VerticalFlowLayout());
|
||||
|
||||
result.add(new JLabel(request.getVariable()));
|
||||
JLabel conditionLabel = new JLabel(request.getVariable());
|
||||
result.add(conditionLabel);
|
||||
|
||||
|
||||
ActionPanel trueAP = createComponents("", request.trueBlock.toArray(new Request[0]), values, "");
|
||||
|
@ -120,6 +141,7 @@ public class LiveDocPanel {
|
|||
@Override
|
||||
public void refresh(BinaryProtocol bp, byte[] response) {
|
||||
int value = (int) conditionField.getValue(new ConfigurationImage(response));
|
||||
conditionLabel.setText(request.getVariable() + " is " + (value == 1 ? "TRUE" : "FALSE"));
|
||||
JPanel active;
|
||||
JPanel passive;
|
||||
if (value == 1) {
|
||||
|
|
Loading…
Reference in New Issue