mirror of https://github.com/FOME-Tech/fome-fw.git
minor checkResponse refactor
This commit is contained in:
parent
7fb99bbbf6
commit
b75b54bcda
|
@ -29,6 +29,10 @@ public class SerialAutoChecker {
|
|||
this.portFound = portFound;
|
||||
}
|
||||
|
||||
public static String checkResponse(IoStream stream) {
|
||||
return checkResponse(stream, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ECU signature from specified stream
|
||||
*/
|
||||
|
|
|
@ -242,7 +242,7 @@ public enum SerialPortScanner {
|
|||
|
||||
public static boolean isPortFomeEcu(String port) {
|
||||
try (IoStream stream = BufferedSerialIoStream.openPort(port)) {
|
||||
String signature = SerialAutoChecker.checkResponse(stream, null);
|
||||
String signature = SerialAutoChecker.checkResponse(stream);
|
||||
|
||||
if (signature == null) {
|
||||
return false;
|
||||
|
|
|
@ -82,10 +82,7 @@ public class DfuFlasher {
|
|||
callbacks.log("Using selected " + port + "\n");
|
||||
IoStream stream = BufferedSerialIoStream.openPort(port);
|
||||
AtomicReference<String> signature = new AtomicReference<>();
|
||||
new SerialAutoChecker(PortDetector.DetectorMode.DETECT_TS, port, new CountDownLatch(1)).checkResponse(stream, callbackContext -> {
|
||||
signature.set(callbackContext.getSignature());
|
||||
return null;
|
||||
});
|
||||
signature.set(SerialAutoChecker.checkResponse(stream));
|
||||
if (signature.get() == null) {
|
||||
callbacks.log("*** ERROR *** FOME has not responded on selected " + port + "\n" +
|
||||
"Maybe try automatic serial port detection?");
|
||||
|
|
Loading…
Reference in New Issue