trigger and VSS hw integrated testing #1668

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

View File

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