only: it's all dead

This commit is contained in:
rusefillc 2024-09-12 15:13:33 -04:00
parent 36bdb193e6
commit 050f615b1c
5 changed files with 17 additions and 26 deletions

View File

@ -3,11 +3,8 @@ 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;
import javax.swing.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@ -16,8 +13,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import static com.rusefi.io.can.elm.Elm327Connector.ELM327_DEFAULT_BAUDRATE;
/**
* Andrey Belomutskiy, (c) 2013-2020
*/
@ -61,10 +56,7 @@ 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(serialPort, portFound).openAndCheckResponse(mode, result, callback);
new SerialAutoChecker(serialPort, portFound).openAndCheckResponse(result, callback);
}
@Override

View File

@ -7,7 +7,6 @@ import com.rusefi.core.net.ConnectionAndMeta;
import com.rusefi.io.IoStream;
import com.rusefi.io.commands.HelloCommand;
import com.rusefi.io.serial.BufferedSerialIoStream;
import com.rusefi.io.serial.SerialIoStream;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
@ -67,10 +66,10 @@ public class SerialAutoChecker {
return signatureWhiteLabel != null && signature.startsWith(signatureWhiteLabel + " ");
}
public void openAndCheckResponse(PortDetector.DetectorMode mode, AtomicReference<AutoDetectResult> result, Function<CallbackContext, Void> callback) {
public void openAndCheckResponse(AtomicReference<AutoDetectResult> result, Function<CallbackContext, Void> callback) {
String signature;
// java 101: just a reminder that try-with syntax would take care of closing stream and that's important here!
try (IoStream stream = getStreamByMode(mode)) {
try (IoStream stream = getStreamByMode()) {
signature = checkResponse(stream, callback);
}
if (signature != null) {
@ -85,12 +84,8 @@ public class SerialAutoChecker {
}
@Nullable
private IoStream getStreamByMode(PortDetector.DetectorMode mode) {
if (mode == PortDetector.DetectorMode.DETECT_ELM327) {
return SerialIoStream.openPort(serialPort);
} else {
return BufferedSerialIoStream.openPort(serialPort);
}
private IoStream getStreamByMode() {
return BufferedSerialIoStream.openPort(serialPort);
}
public static class CallbackContext {

View File

@ -14,6 +14,7 @@ import java.io.IOException;
import static com.rusefi.binaryprotocol.IoHelper.checkResponseCode;
import static com.rusefi.io.can.elm.Elm327Connector.ELM327_DEFAULT_BAUDRATE;
/*
public class Elm327Sandbox {
public static void main(String[] args) throws InterruptedException, IOException {
BaudRateHolder.INSTANCE.baudRate = ELM327_DEFAULT_BAUDRATE;
@ -38,13 +39,13 @@ public class Elm327Sandbox {
if (1 == 1)
return;
/*
SandboxCommon.runFcommand("First time", tsStream);
Elm327Connector.whyDoWeNeedToSleepBetweenCommands();
SandboxCommon.runFcommand("Second time", tsStream);
Elm327Connector.whyDoWeNeedToSleepBetweenCommands();
*/
// /*
// SandboxCommon.runFcommand("First time", tsStream);
// Elm327Connector.whyDoWeNeedToSleepBetweenCommands();
//
// SandboxCommon.runFcommand("Second time", tsStream);
// Elm327Connector.whyDoWeNeedToSleepBetweenCommands();
///
SandboxCommon.verifySignature(tsStream, "", "ELM");
Elm327Connector.whyDoWeNeedToSleepBetweenCommands();
@ -80,3 +81,4 @@ public class Elm327Sandbox {
}
}
*/

View File

@ -78,7 +78,7 @@ public class ConsoleTools {
registerTool("network_connector", strings -> NetworkConnectorStartup.start(), "Connect your rusEFI ECU to rusEFI Online");
registerTool("network_authenticator", strings -> LocalApplicationProxy.start(), "rusEFI Online Authenticator");
registerTool("elm327_connector", strings -> Elm327ConnectorStartup.start(), "Connect your rusEFI ECU using ELM327 CAN-bus adapter");
// registerTool("elm327_connector", strings -> Elm327ConnectorStartup.start(), "Connect your rusEFI ECU using ELM327 CAN-bus adapter");
registerTool("pcan_connector", strings -> {
PCanIoStream stream = PCanIoStream.createStream();

View File

@ -12,6 +12,7 @@ import com.rusefi.ui.StatusConsumer;
import java.io.IOException;
/*
public class Elm327ConnectorStartup {
private final static Logging log = Logging.getLogging(Elm327ConnectorStartup.class);
@ -38,3 +39,4 @@ public class Elm327ConnectorStartup {
log.info("Running Elm327 connector for " + autoDetectedPort);
}
}
*/