error counter on formula pane
This commit is contained in:
parent
e748d50a39
commit
f8d1f59250
|
@ -100,7 +100,7 @@ public enum Sensor {
|
|||
// todo: unify with TIMING
|
||||
ignitionAdvance(SensorCategory.OPERATIONS, FieldType.FLOAT, 56, BackgroundColor.MUD, 30, 140),
|
||||
DWELL(Fields.GAUGE_COIL_DWELL_TIME, SensorCategory.OPERATIONS, FieldType.FLOAT, 60, BackgroundColor.MUD, 1, 10),
|
||||
actualLastInjection(SensorCategory.FUEL, FieldType.FLOAT, 64, BackgroundColor.MUD, 0, 30, "ms"),
|
||||
actualLastInjection(SensorCategory.FUEL, FieldType.FLOAT, /*offset */ 64, BackgroundColor.MUD, 0, 30, "ms"),
|
||||
debugFloatField1(GAUGE_NAME_DEBUG_F1, SensorCategory.OPERATIONS, FieldType.FLOAT, 68, BackgroundColor.MUD, 0, 5),
|
||||
VSS(SensorCategory.OPERATIONS, FieldType.FLOAT, 76, BackgroundColor.BLUE),
|
||||
FIRMWARE_VERSION(SensorCategory.OPERATIONS, FieldType.INT, 84, BackgroundColor.BLUE),
|
||||
|
@ -128,7 +128,7 @@ public enum Sensor {
|
|||
debugIntField2(GAUGE_NAME_DEBUG_I2, SensorCategory.OPERATIONS, FieldType.INT, 216, BackgroundColor.MUD, 0, 5),
|
||||
debugIntField3(GAUGE_NAME_DEBUG_I3, SensorCategory.OPERATIONS, FieldType.INT, 220, BackgroundColor.MUD, 0, 5),
|
||||
|
||||
warningCounter(SensorCategory.OPERATIONS, FieldType.INT, 236, BackgroundColor.MUD, 0, 5),
|
||||
errorCodeCounter(SensorCategory.OPERATIONS, FieldType.INT, 236, BackgroundColor.MUD, 0, 5),
|
||||
lastErrorCode(SensorCategory.OPERATIONS, FieldType.INT, 240, BackgroundColor.MUD, 0, 5),
|
||||
|
||||
RPM(SensorCategory.SENSOR_INPUTS, FieldType.INT, 0, BackgroundColor.RED, 0, 8000),
|
||||
|
|
|
@ -88,7 +88,7 @@ public class SensorCentral {
|
|||
addDoubleSensor("tp", Sensor.TPS, es);
|
||||
addDoubleSensor("pps", Sensor.TPS, es);
|
||||
addDoubleSensor("error", Sensor.lastErrorCode, es);
|
||||
addDoubleSensor("warn", Sensor.warningCounter, es);
|
||||
addDoubleSensor("warn", Sensor.errorCodeCounter, es);
|
||||
addDoubleSensor("knck_c", Sensor.knockCount, es);
|
||||
addDoubleSensor("knck_v", Sensor.KnockValue, es);
|
||||
addDoubleSensor("target", Sensor.TARGET_AFR, es);
|
||||
|
|
|
@ -45,7 +45,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see EngineSnifferPanel
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20170723;
|
||||
public static final int CONSOLE_VERSION = 20170805;
|
||||
public static final boolean SHOW_STIMULATOR = false;
|
||||
private static final String TAB_INDEX = "main_tab";
|
||||
protected static final String PORT_KEY = "port";
|
||||
|
|
|
@ -71,7 +71,7 @@ public class SensorLogger {
|
|||
Sensor.debugIntField2,
|
||||
Sensor.debugIntField3,
|
||||
|
||||
Sensor.warningCounter,
|
||||
Sensor.errorCodeCounter,
|
||||
Sensor.lastErrorCode,
|
||||
|
||||
};
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.rusefi.core.Sensor;
|
|||
import com.rusefi.core.SensorCentral;
|
||||
import com.rusefi.ui.config.ConfigField;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
import com.rusefi.ui.widgets.IntGaugeLabel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.scilab.forge.jlatexmath.TeXConstants;
|
||||
import org.scilab.forge.jlatexmath.TeXFormula;
|
||||
|
@ -24,9 +25,12 @@ import java.awt.image.BufferedImage;
|
|||
* (c) Andrey Belomutskiy 2013-2017
|
||||
*/
|
||||
public class FormulasPane {
|
||||
private static final String NL = "\r\n \\\\ ";
|
||||
private static final String NL2 = NL + "\\ " + NL; // two new lines
|
||||
private static final String NL3 = NL2 + "\\ " + NL; // two new lines
|
||||
|
||||
private final JPanel content = new JPanel(new BorderLayout());
|
||||
private final JPanel centerProxy = new JPanel(new BorderLayout());
|
||||
private final String newLine = "\r\n \\\\ ";
|
||||
private boolean isPaused;
|
||||
|
||||
public FormulasPane() {
|
||||
|
@ -57,6 +61,12 @@ public class FormulasPane {
|
|||
top.add(pauseButton);
|
||||
content.add(top, BorderLayout.NORTH);
|
||||
|
||||
JPanel bottomPanel = new JPanel(new FlowLayout());
|
||||
bottomPanel.add(new IntGaugeLabel("count", Sensor.errorCodeCounter));
|
||||
bottomPanel.add(new IntGaugeLabel("error", Sensor.lastErrorCode));
|
||||
|
||||
content.add(bottomPanel, BorderLayout.SOUTH);
|
||||
|
||||
updateFormula();
|
||||
new Timer(200, new ActionListener() {
|
||||
@Override
|
||||
|
@ -95,7 +105,7 @@ public class FormulasPane {
|
|||
throw new IllegalStateException("Unexpected "+ algorithm);
|
||||
engine_load_mode_e algo = values[algorithm];
|
||||
|
||||
String acceleration = getAccelerationVariables(ci);
|
||||
String acceleration = getAccelerationVariables(ci) + NL2;
|
||||
|
||||
String page;
|
||||
if (algo == engine_load_mode_e.LM_SPEED_DENSITY) {
|
||||
|
@ -105,7 +115,7 @@ public class FormulasPane {
|
|||
double maf = SensorCentral.getInstance().getValue(Sensor.MAF);
|
||||
|
||||
String baseFuelStr = twoDecimals(Sensor.FUEL_BASE);
|
||||
String baseFuel = "$Base_Fuel (ms) = lookup (" +
|
||||
String baseFuel = "$Table_Fuel (ms) = lookup (" +
|
||||
"(RPM = " + rpm + ", " +
|
||||
"MAF = " + maf + ") = " +
|
||||
baseFuelStr + "ms";
|
||||
|
@ -120,7 +130,7 @@ public class FormulasPane {
|
|||
}
|
||||
|
||||
TeXFormula formula = new TeXFormula("\r\n" +
|
||||
algo.title + newLine + newLine + newLine + page + "");
|
||||
algo.title + NL3 + page + "");
|
||||
TeXIcon icon = formula.createTeXIcon(TeXConstants.STYLE_DISPLAY, 20);
|
||||
|
||||
BufferedImage image = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
|
||||
|
@ -158,9 +168,9 @@ public class FormulasPane {
|
|||
String loadEnrichDelta = "$deltaLoad = max(currentLoad - previousLoad, length = " + elEnrichLength +
|
||||
") = " + elDelta + "$";
|
||||
|
||||
return tpsEnrichDelta + newLine +
|
||||
tpsEnrich + newLine +
|
||||
loadEnrichDelta + newLine;
|
||||
return tpsEnrichDelta + NL +
|
||||
tpsEnrich + NL +
|
||||
loadEnrichDelta;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
@ -194,7 +204,7 @@ public class FormulasPane {
|
|||
"$";
|
||||
|
||||
String baseFuelStr = twoDecimals(Sensor.FUEL_BASE);
|
||||
String baseFuel = "$Base_Fuel (ms) = \\frac{" +
|
||||
String baseFuel = "$SD_Fuel (ms) = \\frac{" +
|
||||
"($Airmass = " + chargeAirMass + ")" +
|
||||
"}{" +
|
||||
"(TargetAFR (" + rpm_map + ") = " + TARGET_AFR + ")" +
|
||||
|
@ -209,15 +219,15 @@ public class FormulasPane {
|
|||
|
||||
String actualLastInjection = twoDecimals(Sensor.actualLastInjection);
|
||||
String injTime = "$Fuel (ms) = " +
|
||||
"(Base_Fuel (" + baseFuelStr + "ms) + Tps_Accel_Corr = (" + tpsAccel + "ms))" +
|
||||
tempCorrections + getInjecctorLag() +
|
||||
"(SD_Fuel (" + baseFuelStr + "ms) + Tps_Accel_Corr = (" + tpsAccel + "ms))" +
|
||||
tempCorrections + NL + getInjecctorLag() +
|
||||
" = " + actualLastInjection + "ms_per_injection$";
|
||||
|
||||
return acceleration +
|
||||
tCharge + newLine +
|
||||
mCharge + newLine +
|
||||
baseFuel + newLine +
|
||||
injTime + newLine;
|
||||
tCharge + NL3 +
|
||||
mCharge + NL2 +
|
||||
baseFuel + NL2 +
|
||||
injTime + NL;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package com.rusefi.ui.widgets;
|
||||
|
||||
import com.rusefi.config.FieldType;
|
||||
import com.rusefi.core.Sensor;
|
||||
import com.rusefi.core.SensorCentral;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Read-only text representation of an int {@link Sensor}
|
||||
* <p>
|
||||
* (c) Andrey Belomutskiy
|
||||
* 8/5/2017
|
||||
*/
|
||||
public class IntGaugeLabel extends JLabel {
|
||||
public IntGaugeLabel(final String shortName, Sensor sensor) {
|
||||
if (sensor.getType() != FieldType.INT)
|
||||
throw new IllegalArgumentException(sensor.name());
|
||||
SensorCentral.getInstance().addListener(sensor, new SensorCentral.SensorListener() {
|
||||
@Override
|
||||
public void onSensorUpdate(double value) {
|
||||
IntGaugeLabel.this.setText(shortName + ": " + (int)value);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue