only:better naming, better location

This commit is contained in:
rusefillc 2024-08-26 11:41:53 -04:00
parent 4d4c0b59f8
commit 57356dad03
3 changed files with 12 additions and 17 deletions

View File

@ -13,11 +13,13 @@ import static com.devexperts.logging.Logging.getLogging;
import static com.rusefi.Timeouts.SECOND;
import static com.rusefi.binaryprotocol.BinaryProtocol.sleep;
public class DfuHelper {
private static final Logging log = getLogging(DfuHelper.class);
private static final String PREFIX = "rusefi_bundle";
/**
* this code is shared between DFU and OpenBLT tracks
*/
public class BootloaderHelper {
private static final Logging log = getLogging(BootloaderHelper.class);
private static void sendDfuRebootCommand(IoStream stream, UpdateOperationCallbacks callbacks, String cmd) {
private static void sendBootloaderRebootCommand(IoStream stream, UpdateOperationCallbacks callbacks, String cmd) {
byte[] command = BinaryProtocol.getTextCommandBytes(cmd);
try {
stream.sendPacket(command);
@ -27,7 +29,7 @@ public class DfuHelper {
}
}
public static boolean sendDfuRebootCommand(JComponent parent, String signature, IoStream stream, UpdateOperationCallbacks callbacks, String command) {
public static boolean sendBootloaderRebootCommand(JComponent parent, String signature, IoStream stream, UpdateOperationCallbacks callbacks, String command) {
RusEfiSignature controllerSignature = SignatureHelper.parse(signature);
String fileSystemBundleTarget = BundleUtil.getBundleTarget();
if (fileSystemBundleTarget != null && controllerSignature != null) {
@ -53,7 +55,7 @@ public class DfuHelper {
}
}
sendDfuRebootCommand(stream, callbacks, command);
sendBootloaderRebootCommand(stream, callbacks, command);
return true;
}
}

View File

@ -7,8 +7,7 @@ import com.rusefi.autodetect.PortDetector;
import com.rusefi.autodetect.SerialAutoChecker;
import com.rusefi.config.generated.Integration;
import com.rusefi.core.FindFileHelper;
import com.rusefi.config.generated.Fields;
import com.rusefi.io.DfuHelper;
import com.rusefi.io.BootloaderHelper;
import com.rusefi.io.IoStream;
import com.rusefi.io.UpdateOperationCallbacks;
import com.rusefi.io.serial.BufferedSerialIoStream;
@ -21,10 +20,8 @@ import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import static com.rusefi.core.FindFileHelper.INPUT_FILES_PATH;
@ -94,7 +91,7 @@ public class DfuFlasher {
callbacks.error();
return null;
}
boolean isSignatureValidatedLocal = DfuHelper.sendDfuRebootCommand(parent, signature.get(), stream, callbacks, command);
boolean isSignatureValidatedLocal = BootloaderHelper.sendBootloaderRebootCommand(parent, signature.get(), stream, callbacks, command);
isSignatureValidated.set(isSignatureValidatedLocal);
}
} else {
@ -103,7 +100,7 @@ public class DfuFlasher {
// it's more reliable this way
// ISSUE: that's blocking stuff on UI thread at the moment, TODO smarter threading!
port = PortDetector.autoDetectSerial(callbackContext -> {
boolean isSignatureValidatedLocal = DfuHelper.sendDfuRebootCommand(parent, callbackContext.getSignature(), callbackContext.getStream(), callbacks, command);
boolean isSignatureValidatedLocal = BootloaderHelper.sendBootloaderRebootCommand(parent, callbackContext.getSignature(), callbackContext.getStream(), callbacks, command);
isSignatureValidated.set(isSignatureValidatedLocal);
return null;
}).getSerialPort();

View File

@ -2,13 +2,9 @@ package com.rusefi.ui.config;
import com.devexperts.logging.Logging;
import com.opensr5.ConfigurationImage;
import com.rusefi.FileLog;
import com.rusefi.binaryprotocol.BinaryProtocol;
import com.rusefi.config.Field;
import com.rusefi.io.CommandQueue;
import com.rusefi.io.ConnectionStatusLogic;
import com.rusefi.io.DfuHelper;
import com.rusefi.io.LinkManager;
import com.rusefi.ui.UIContext;
import org.jetbrains.annotations.NotNull;