auto-sync

This commit is contained in:
rusEfi 2015-03-11 08:07:40 -05:00
parent 5dffa8e670
commit 9073cba73f
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";
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() {
return INSTANCE;
@ -73,6 +73,8 @@ public class SensorCentral {
};
public void setValue(double value, final Sensor sensor) {
Double oldValue = values.get(sensor);
boolean isUpdated = oldValue == null || !oldValue.equals(value);
values.put(sensor, value);
List<SensorListener> listeners;
synchronized (allListeners) {
@ -90,6 +92,11 @@ public class SensorCentral {
LoggerData d = new LoggerData() {
@Override
public String toString() {
return getName();
}
@Override
public String getId() {
return sensor.getName();
@ -137,7 +144,8 @@ public class SensorCentral {
};
r.setDataValue(d, value);
TableUpdateHandler.getInstance().handleDataUpdate(r);
if (isUpdated)
TableUpdateHandler.getInstance().handleDataUpdate(r);
}
public static String getInternalAdcRepresentation(double value) {

View File

@ -50,6 +50,7 @@ public final class TableUpdateHandler implements DataUpdateHandler {
if (tables != null && !tables.isEmpty()) {
String formattedValue = loggerData.getSelectedConvertor().format(response.getDataValue(loggerData));
for (Table table : tables) {
table.clearLiveDataTrace();
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
public void updateTableLabel() {
this.getAxisParent().updateTableLabel();

View File

@ -34,7 +34,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
* @see com.rusefi.StartupFrame
*/
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 String TAB_INDEX = "main_tab";
private final String port;