auto-sync

This commit is contained in:
rusEfi 2014-09-10 07:05:45 -05:00
parent 973af9efe2
commit b206337de9
4 changed files with 26 additions and 14 deletions

View File

@ -11,7 +11,7 @@ public enum Sensor {
MAP("MAP"), MAP("MAP"),
MAP_RAW("MAP_RAW"), MAP_RAW("MAP_RAW"),
BARO("Baro"), BARO("Baro"),
TIMING("Timing"), TIMING("Timing", "deg", -180, 180),
/** /**
* Please note that these enum names are used to make 'set_mock_XXX_voltage' commands * Please note that these enum names are used to make 'set_mock_XXX_voltage' commands
@ -43,10 +43,10 @@ public enum Sensor {
TOTAL_DWELL1("Input tdwl #2", "ms", 0, 30, BackgroundColor.BEIGE), TOTAL_DWELL1("Input tdwl #2", "ms", 0, 30, BackgroundColor.BEIGE),
TOTAL_DWELL2("Input tdwl #3", "ms", 0, 30, BackgroundColor.BEIGE), TOTAL_DWELL2("Input tdwl #3", "ms", 0, 30, BackgroundColor.BEIGE),
TOTAL_DWELL3("Input tdwl #4", "ms", 0, 30, BackgroundColor.BEIGE), TOTAL_DWELL3("Input tdwl #4", "ms", 0, 30, BackgroundColor.BEIGE),
ADVANCE0("Input Adv #1", "dg", -40, 40, BackgroundColor.BROWN), ADVANCE0("Input Adv #1", "deg", -180, 180, BackgroundColor.BROWN),
ADVANCE1("Input Adv #2", "dg", -40, 40, BackgroundColor.BROWN), ADVANCE1("Input Adv #2", "deg", -180, 180, BackgroundColor.BROWN),
ADVANCE2("Input Adv #3", "dg", -40, 40, BackgroundColor.BROWN), ADVANCE2("Input Adv #3", "deg", -180, 180, BackgroundColor.BROWN),
ADVANCE3("Input Adv #4", "dg", -40, 40, BackgroundColor.BROWN), ADVANCE3("Input Adv #4", "deg", -180, 180, BackgroundColor.BROWN),
PERIOD0("Period", "dg", 0, 400), PERIOD0("Period", "dg", 0, 400),
DUTY0("Duty0", "%", 0, 100, BackgroundColor.RED), DUTY0("Duty0", "%", 0, 100, BackgroundColor.RED),
DUTY1("Duty1", "%", 0, 100, BackgroundColor.RED), DUTY1("Duty1", "%", 0, 100, BackgroundColor.RED),
@ -71,8 +71,7 @@ public enum Sensor {
INJECTOR_2_DWELL("inj #2"), INJECTOR_2_DWELL("inj #2"),
INJ_1_2_DELTA("inj 1-2 delta"), INJ_1_2_DELTA("inj 1-2 delta"),;
;
private final String name; private final String name;
private final String units; private final String units;
@ -100,6 +99,10 @@ public enum Sensor {
this.color = color; this.color = color;
} }
public static double processAdvance(double advance) {
return advance > 360 ? advance - 720 : advance;
}
public String getName() { public String getName() {
return name; return name;
} }
@ -119,4 +122,17 @@ public enum Sensor {
public BackgroundColor getColor() { public BackgroundColor getColor() {
return color; return color;
} }
public double translateValue(double value) {
switch (this) {
case ADVANCE0:
case ADVANCE1:
case ADVANCE2:
case ADVANCE3:
case TIMING:
return processAdvance(value);
default:
return value;
}
}
} }

View File

@ -19,7 +19,7 @@ import javax.swing.*;
* @see WavePanel * @see WavePanel
*/ */
public class Launcher extends FrameHelper { public class Launcher extends FrameHelper {
public static final int CONSOLE_VERSION = 20140908; public static final int CONSOLE_VERSION = 20140910;
public static final boolean SHOW_STIMULATOR = true; public static final boolean SHOW_STIMULATOR = true;
private final String port; private final String port;

View File

@ -294,7 +294,7 @@ public class EcuStimulator {
return; return;
double dwell = getValue(dwellSensor); double dwell = getValue(dwellSensor);
double advance = getValue(advanceSensor); double advance = getValue(advanceSensor);
advance = processAdvance(advance); advance = Sensor.processAdvance(advance);
result.dwells.add(dwell); result.dwells.add(dwell);
result.advances.add(advance); result.advances.add(advance);
latch.countDown(); latch.countDown();
@ -310,10 +310,6 @@ public class EcuStimulator {
return result; return result;
} }
private double processAdvance(double advance) {
return advance > 360 ? advance - 720 : advance;
}
private class MultipleMeasurements { private class MultipleMeasurements {
private List<Double> dwells = new ArrayList<>(MEASURES); private List<Double> dwells = new ArrayList<>(MEASURES);
private List<Double> advances = new ArrayList<>(MEASURES); private List<Double> advances = new ArrayList<>(MEASURES);

View File

@ -51,7 +51,7 @@ public class SensorGauge {
SensorCentral.getInstance().addListener(sensor, new SensorCentral.SensorListener() { SensorCentral.getInstance().addListener(sensor, new SensorCentral.SensorListener() {
public void onSensorUpdate(double value) { public void onSensorUpdate(double value) {
gauge.setValue(value); gauge.setValue(sensor.translateValue(value));
} }
}); });
gauge.setLcdDecimals(2); gauge.setLcdDecimals(2);