ELM327 bugfix: baud rate

This commit is contained in:
rusefillc 2021-12-04 14:03:05 -05:00
parent 1a6483757a
commit b8f7efb437
1 changed files with 6 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package com.rusefi.autodetect;
import com.devexperts.logging.Logging;
import com.rusefi.NamedThreadFactory;
import com.rusefi.io.LinkManager;
import com.rusefi.io.serial.BaudRateHolder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -15,6 +16,8 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import static com.rusefi.io.can.Elm327Connector.ELM327_DEFAULT_BAUDRATE;
/**
* Andrey Belomutskiy, (c) 2013-2020
*/
@ -58,6 +61,9 @@ public class PortDetector {
Thread thread = AUTO_DETECT_PORT.newThread(new Runnable() {
@Override
public void run() {
if (mode == DetectorMode.DETECT_ELM327) {
BaudRateHolder.INSTANCE.baudRate = ELM327_DEFAULT_BAUDRATE;
}
new SerialAutoChecker(mode, serialPort, portFound).openAndCheckResponse(result, callback);
}