trigger and VSS hw integrated testing #1668

This commit is contained in:
rusefi 2020-08-08 17:37:51 -04:00
parent f2d4ace881
commit 6927c47e58
1 changed files with 9 additions and 3 deletions

View File

@ -38,6 +38,7 @@ public class SerialAutoChecker implements Runnable {
public void run() {
IoStream stream = SerialIoStreamJSerialComm.openPort(serialPort);
IncomingDataBuffer incomingData = stream.getDataBuffer();
boolean isPortFound = false;
try {
HelloCommand.send(stream);
byte[] response = incomingData.getPacket("");
@ -50,14 +51,19 @@ public class SerialAutoChecker implements Runnable {
if (callback != null) {
callback.apply(stream);
}
result.set(serialPort);
portFound.countDown();
isPortFound = true;
}
} catch (IOException ignore) {
return;
} finally {
stream.close();
}
if (isPortFound) {
/**
* propagating result after closing the port so that it could be used right away
*/
result.set(serialPort);
portFound.countDown();
}
}
}