auto-sync
This commit is contained in:
parent
7046bc7302
commit
a8772b1f8a
|
@ -150,17 +150,12 @@ public class SensorCentral {
|
|||
TableUpdateHandler.getInstance().handleDataUpdate(r);
|
||||
}
|
||||
|
||||
public static String getInternalAdcRepresentation(double value) {
|
||||
double volts = value * 3.3 / 4096;
|
||||
return String.format("%.2f (%.2fv)", value, volts);
|
||||
}
|
||||
|
||||
public void addListener(Sensor sensor, SensorListener listener) {
|
||||
List<SensorListener> listeners;
|
||||
synchronized (allListeners) {
|
||||
listeners = allListeners.get(sensor);
|
||||
if (listeners == null)
|
||||
listeners = new CopyOnWriteArrayList<SensorListener>();
|
||||
listeners = new CopyOnWriteArrayList<>();
|
||||
allListeners.put(sensor, listeners);
|
||||
}
|
||||
listeners.add(listener);
|
||||
|
|
|
@ -46,9 +46,4 @@ public class EngineStateTest {
|
|||
es.processNewData("600\r");
|
||||
assertEquals(600, rpmResult.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAdcRepresentation() {
|
||||
assertEquals("1025.00 (0.83v)", SensorCentral.getInternalAdcRepresentation(1025));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue