auto-sync

This commit is contained in:
rusEfi 2015-03-11 08:07:40 -05:00
parent 4c311856a0
commit 2b26316ce9
4 changed files with 25 additions and 4 deletions

View File

@ -22,9 +22,9 @@ public class SensorCentral {
public static final String RPM_KEY = "rpm"; public static final String RPM_KEY = "rpm";
private static final SensorCentral INSTANCE = new SensorCentral(); private static final SensorCentral INSTANCE = new SensorCentral();
private final Map<Sensor, Double> values = new EnumMap<Sensor, Double>(Sensor.class); private final Map<Sensor, Double> values = new EnumMap<>(Sensor.class);
private final Map<Sensor, List<SensorListener>> allListeners = new EnumMap<Sensor, List<SensorListener>>(Sensor.class); private final Map<Sensor, List<SensorListener>> allListeners = new EnumMap<>(Sensor.class);
public static SensorCentral getInstance() { public static SensorCentral getInstance() {
return INSTANCE; return INSTANCE;
@ -73,6 +73,8 @@ public class SensorCentral {
}; };
public void setValue(double value, final Sensor sensor) { public void setValue(double value, final Sensor sensor) {
Double oldValue = values.get(sensor);
boolean isUpdated = oldValue == null || !oldValue.equals(value);
values.put(sensor, value); values.put(sensor, value);
List<SensorListener> listeners; List<SensorListener> listeners;
synchronized (allListeners) { synchronized (allListeners) {
@ -90,6 +92,11 @@ public class SensorCentral {
LoggerData d = new LoggerData() { LoggerData d = new LoggerData() {
@Override
public String toString() {
return getName();
}
@Override @Override
public String getId() { public String getId() {
return sensor.getName(); return sensor.getName();
@ -137,7 +144,8 @@ public class SensorCentral {
}; };
r.setDataValue(d, value); r.setDataValue(d, value);
TableUpdateHandler.getInstance().handleDataUpdate(r); if (isUpdated)
TableUpdateHandler.getInstance().handleDataUpdate(r);
} }
public static String getInternalAdcRepresentation(double value) { public static String getInternalAdcRepresentation(double value) {

View File

@ -50,6 +50,7 @@ public final class TableUpdateHandler implements DataUpdateHandler {
if (tables != null && !tables.isEmpty()) { if (tables != null && !tables.isEmpty()) {
String formattedValue = loggerData.getSelectedConvertor().format(response.getDataValue(loggerData)); String formattedValue = loggerData.getSelectedConvertor().format(response.getDataValue(loggerData));
for (Table table : tables) { for (Table table : tables) {
table.clearLiveDataTrace();
table.highlightLiveData(formattedValue); table.highlightLiveData(formattedValue);
} }
} }

View File

@ -283,6 +283,18 @@ public class Table1D extends Table {
} }
} }
boolean ec = false;
@Override
public void clearLiveDataTrace() {
super.clearLiveDataTrace();
if (!ec) {
ec = true;
getAxisParent().clearLiveDataTrace();
ec = false;
}
}
@Override @Override
public void updateTableLabel() { public void updateTableLabel() {
this.getAxisParent().updateTableLabel(); this.getAxisParent().updateTableLabel();

View File

@ -34,7 +34,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
* @see com.rusefi.StartupFrame * @see com.rusefi.StartupFrame
*/ */
public class Launcher { public class Launcher {
public static final int CONSOLE_VERSION = 20150310; public static final int CONSOLE_VERSION = 20150311;
public static final boolean SHOW_STIMULATOR = false; public static final boolean SHOW_STIMULATOR = false;
public static final String TAB_INDEX = "main_tab"; public static final String TAB_INDEX = "main_tab";
private final String port; private final String port;