diff --git a/java_console/autotest/src/main/java/com/rusefi/common/MiscTest.java b/java_console/autotest/src/main/java/com/rusefi/common/MiscTest.java index 1ea627abc2..3ae33a90e8 100644 --- a/java_console/autotest/src/main/java/com/rusefi/common/MiscTest.java +++ b/java_console/autotest/src/main/java/com/rusefi/common/MiscTest.java @@ -1,13 +1,12 @@ package com.rusefi.common; import com.rusefi.RusefiTestBase; +import com.rusefi.binaryprotocol.BinaryProtocol; import com.rusefi.core.Sensor; import com.rusefi.core.SensorCentral; -import com.rusefi.binaryprotocol.BinaryProtocol; -import com.rusefi.functional_tests.EcuTestHelper; -import org.junit.Ignore; import org.junit.Test; +import static com.devexperts.util.TimeUtil.SECOND; import static org.junit.Assert.assertTrue; public class MiscTest extends RusefiTestBase { @@ -19,8 +18,13 @@ public class MiscTest extends RusefiTestBase { } @Test - public void testMcuTemperature() { - double mcuTemp = SensorCentral.getInstance().getValue(Sensor.INT_TEMP); + public void testMcuTemperature() throws InterruptedException { + double mcuTemp = Double.NaN; + long start = System.currentTimeMillis(); + while (Double.isNaN(mcuTemp) && (System.currentTimeMillis() - start) < 5 * SECOND) { + Thread.sleep(100); + mcuTemp = SensorCentral.getInstance().getValue(Sensor.INT_TEMP); + } System.out.println("MCU temperature is " + mcuTemp + " deg C"); diff --git a/java_console/models/src/main/java/com/rusefi/core/ISensorCentral.java b/java_console/models/src/main/java/com/rusefi/core/ISensorCentral.java index a69994c643..809064d17f 100644 --- a/java_console/models/src/main/java/com/rusefi/core/ISensorCentral.java +++ b/java_console/models/src/main/java/com/rusefi/core/ISensorCentral.java @@ -7,10 +7,10 @@ package com.rusefi.core; public interface ISensorCentral extends ISensorHolder { void setAnySensorListener(SensorCentral.SensorListener2 anySensorListener); - public class ListenerToken { - private ISensorCentral sensorCentralInstance; - private Sensor sensor; - private SensorCentral.SensorListener listener; + class ListenerToken { + private final ISensorCentral sensorCentralInstance; + private final Sensor sensor; + private final SensorCentral.SensorListener listener; public ListenerToken(ISensorCentral instance, Sensor sensor, SensorCentral.SensorListener listener) { this.sensorCentralInstance = instance;