proxy progress
This commit is contained in:
parent
47b2904108
commit
324003c1a3
|
@ -75,7 +75,7 @@ public class BinaryProtocol implements BinaryProtocolCommands {
|
|||
/**
|
||||
* Composite logging turns off after 10 seconds of RPM above 300
|
||||
*/
|
||||
private boolean needCompositeLogger = true;
|
||||
private boolean needCompositeLogger;
|
||||
private boolean isCompositeLoggerEnabled;
|
||||
private long lastLowRpmTime = System.currentTimeMillis();
|
||||
|
||||
|
@ -144,6 +144,7 @@ public class BinaryProtocol implements BinaryProtocolCommands {
|
|||
|
||||
incomingData = dataBuffer;
|
||||
Runtime.getRuntime().addShutdownHook(hook);
|
||||
needCompositeLogger = linkManager.getCompositeLogicEnabled();
|
||||
rpmListener = value -> {
|
||||
if (value <= COMPOSITE_OFF_RPM) {
|
||||
needCompositeLogger = true;
|
||||
|
|
|
@ -52,7 +52,8 @@ public interface IoStream extends WriteStream {
|
|||
} else {
|
||||
packet = IoHelper.makeCrc32Packet(plainPacket);
|
||||
}
|
||||
logger.info("Sending packet " + printHexBinary(plainPacket));
|
||||
// todo: verbose mode printHexBinary(plainPacket))
|
||||
logger.info("Sending packet " + BinaryProtocol.findCommand(plainPacket[0]) + " length=" + plainPacket.length);
|
||||
write(packet);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ public class LinkManager {
|
|||
|
||||
private LinkConnector connector;
|
||||
private boolean isStarted;
|
||||
private boolean compositeLogicEnabled = true;
|
||||
|
||||
public LinkManager(Logger logger) {
|
||||
this.logger = logger;
|
||||
|
@ -106,6 +107,14 @@ public class LinkManager {
|
|||
return commandQueue;
|
||||
}
|
||||
|
||||
public void setCompositeLogicEnabled(boolean compositeLogicEnabled) {
|
||||
this.compositeLogicEnabled = compositeLogicEnabled;
|
||||
}
|
||||
|
||||
public boolean getCompositeLogicEnabled() {
|
||||
return compositeLogicEnabled;
|
||||
}
|
||||
|
||||
public enum LogLevel {
|
||||
INFO,
|
||||
DEBUG,
|
||||
|
|
|
@ -13,7 +13,7 @@ public class CompositeParser {
|
|||
public static List<CompositeEvent> parse(byte[] response) {
|
||||
ByteBuffer byteBuffer = ByteBuffer.wrap(response);
|
||||
byteBuffer.order(ByteOrder.BIG_ENDIAN);
|
||||
System.out.println("Got composite " + response.length);
|
||||
System.out.println("Got composite length=" + response.length);
|
||||
int ptr = 1;
|
||||
|
||||
List<CompositeEvent> events = new ArrayList<>();
|
||||
|
|
|
@ -42,6 +42,7 @@ import static com.rusefi.binaryprotocol.IoHelper.getCrc32;
|
|||
|
||||
public class ConsoleTools {
|
||||
public static final String SET_AUTH_TOKEN = "set_auth_token";
|
||||
public static final String RUS_EFI_NOT_DETECTED = "rusEFI not detected";
|
||||
private static Map<String, ConsoleTool> TOOLS = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
private static Map<String, String> toolsHelp = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
@ -203,7 +204,7 @@ public class ConsoleTools {
|
|||
|
||||
String autoDetectedPort = PortDetector.autoDetectSerial(null);
|
||||
if (autoDetectedPort == null) {
|
||||
System.err.println("rusEFI not detected");
|
||||
System.err.println(RUS_EFI_NOT_DETECTED);
|
||||
return;
|
||||
}
|
||||
LinkManager linkManager = new LinkManager(FileLog.LOGGER);
|
||||
|
@ -268,7 +269,7 @@ public class ConsoleTools {
|
|||
private static String autoDetectPort() {
|
||||
String autoDetectedPort = PortDetector.autoDetectSerial(null);
|
||||
if (autoDetectedPort == null) {
|
||||
System.err.println("rusEFI not detected");
|
||||
System.err.println(RUS_EFI_NOT_DETECTED);
|
||||
return null;
|
||||
}
|
||||
return autoDetectedPort;
|
||||
|
@ -313,7 +314,7 @@ public class ConsoleTools {
|
|||
static void detect(String[] strings) throws IOException, InterruptedException {
|
||||
String autoDetectedPort = autoDetectPort();
|
||||
if (autoDetectedPort == null) {
|
||||
System.out.println("rusEFI not detected");
|
||||
System.out.println(RUS_EFI_NOT_DETECTED);
|
||||
return;
|
||||
}
|
||||
IoStream stream = SerialIoStreamJSerialComm.openPort(autoDetectedPort, FileLog.LOGGER);
|
||||
|
|
|
@ -14,12 +14,13 @@ public class NetworkConnectorStartup {
|
|||
public static void start(String[] strings) throws IOException {
|
||||
String autoDetectedPort = PortDetector.autoDetectSerial(null);
|
||||
if (autoDetectedPort == null) {
|
||||
System.err.println("rusEFI not detected");
|
||||
System.err.println(ConsoleTools.RUS_EFI_NOT_DETECTED);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinkManager linkManager = new LinkManager(Logger.CONSOLE);
|
||||
linkManager.setCompositeLogicEnabled(false);
|
||||
linkManager.startAndConnect(autoDetectedPort, ConnectionStateListener.VOID);
|
||||
|
||||
String authToken = AuthTokenPanel.getAuthToken();
|
||||
|
|
Loading…
Reference in New Issue