This commit is contained in:
rusefi 2020-06-07 12:27:21 -04:00
parent 4af0cec252
commit a9c91a4079
4 changed files with 20 additions and 7 deletions

View File

@ -102,7 +102,7 @@ this is just too unreliable at this point :(
public static void assertRpmDoesNotJump(int rpm, int settleTime, int testDuration, Function<String, Object> callback) {
changeRpm(rpm);
sleep(settleTime);
sleepSeconds(settleTime);
AtomicReference<String> result = new AtomicReference<>();
SensorCentral.SensorListener listener = new SensorCentral.SensorListener() {
@Override
@ -113,7 +113,7 @@ this is just too unreliable at this point :(
}
};
SensorCentral.getInstance().addListener(Sensor.RPM, listener);
sleep(testDuration);
sleepSeconds(testDuration);
callback.apply(result.get());
SensorCentral.getInstance().removeListener(Sensor.RPM, listener);
}
@ -192,7 +192,7 @@ this is just too unreliable at this point :(
currentEngineType = type;
sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + type, COMPLEX_COMMAND_RETRY, Timeouts.SET_ENGINE_TIMEOUT);
// TODO: document the reason for this sleep?!
sleep(1);
sleepSeconds(1);
sendCommand(getEnableCommand("self_stimulation"));
}

View File

@ -1,7 +1,6 @@
package com.rusefi;
import com.rusefi.config.generated.Fields;
import org.junit.rules.Timeout;
import static com.rusefi.IoUtil.*;
import static com.rusefi.RealHwTest.startRealHardwareTest;
@ -27,12 +26,12 @@ public class EnduranceTest {
for (int i = 0; i < count; i++) {
AutoTest.currentEngineType = 3;
sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + 3, AutoTest.COMPLEX_COMMAND_RETRY, Timeouts.SET_ENGINE_TIMEOUT);
sleep(2);
sleepSeconds(2);
sendCommand(getEnableCommand("self_stimulation"));
// IoUtil.changeRpm(1200);
AutoTest.currentEngineType = 28;
sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + 28, AutoTest.COMPLEX_COMMAND_RETRY, Timeouts.SET_ENGINE_TIMEOUT);
sleep(2);
sleepSeconds(2);
FileLog.MAIN.logLine("++++++++++++++++++++++++++++++++++++ " + i + " +++++++++++++++");
}

View File

@ -142,7 +142,7 @@ public class IoUtil {
}
@SuppressWarnings("UnusedDeclaration")
static void sleep(int seconds) {
public static void sleepSeconds(int seconds) {
FileLog.MAIN.logLine("Sleeping " + seconds + " seconds");
try {
Thread.sleep(seconds * 1000L);

View File

@ -0,0 +1,14 @@
package com.rusefi.autodetect;
import com.rusefi.IoUtil;
public class PortDetectorSandbox {
public static void main(String[] args) {
while (true) {
String port = PortDetector.autoDetectSerial(null);
System.out.println("Detected " + port);
IoUtil.sleepSeconds(1);
}
}
}