diff --git a/java_console/shared_io/src/main/java/com/rusefi/rusEFIVersion.java b/java_console/shared_io/src/main/java/com/rusefi/rusEFIVersion.java index 3fa27daa29..1b6e220210 100644 --- a/java_console/shared_io/src/main/java/com/rusefi/rusEFIVersion.java +++ b/java_console/shared_io/src/main/java/com/rusefi/rusEFIVersion.java @@ -6,7 +6,7 @@ import java.net.URL; import java.util.concurrent.atomic.AtomicReference; public class rusEFIVersion { - public static final int CONSOLE_VERSION = 20220110; + public static final int CONSOLE_VERSION = 20220116; public static AtomicReference firmwareVersion = new AtomicReference<>("N/A"); public static long classBuildTimeMillis() { diff --git a/java_console/ui/src/main/java/com/rusefi/maintenance/DfuFlasher.java b/java_console/ui/src/main/java/com/rusefi/maintenance/DfuFlasher.java index c984720de7..1182d6408c 100644 --- a/java_console/ui/src/main/java/com/rusefi/maintenance/DfuFlasher.java +++ b/java_console/ui/src/main/java/com/rusefi/maintenance/DfuFlasher.java @@ -14,10 +14,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; +import java.io.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -126,9 +123,16 @@ public class DfuFlasher { private static void executeDFU(StatusWindow wnd) { StringBuffer stdout = new StringBuffer(); - String errorResponse = ExecHelper.executeCommand(DFU_BINARY_LOCATION, - getDfuWriteCommand(), - DFU_BINARY, wnd, stdout); + String errorResponse; + try { + errorResponse = ExecHelper.executeCommand(DFU_BINARY_LOCATION, + getDfuWriteCommand(), + DFU_BINARY, wnd, stdout); + } catch (FileNotFoundException e) { + wnd.append("ERROR: " + e); + wnd.setErrorState(true); + return; + } if (stdout.toString().contains("Download verified successfully")) { // looks like sometimes we are not catching the last line of the response? 'Upgrade' happens before 'Verify' wnd.append("SUCCESS!"); @@ -168,10 +172,12 @@ public class DfuFlasher { } } - private static String getDfuWriteCommand() { - String hexFileName = IniFileModel.findFile(Launcher.INPUT_FILES_PATH, "rusefi", ".hex"); + private static String getDfuWriteCommand() throws FileNotFoundException { + String prefix = "rusefi"; + String suffix = ".hex"; + String hexFileName = IniFileModel.findFile(Launcher.INPUT_FILES_PATH, prefix, suffix); if (hexFileName == null) - return "File not found"; + throw new FileNotFoundException("File not found " + prefix + "*" + suffix); String hexAbsolutePath = new File(hexFileName).getAbsolutePath(); return DFU_BINARY_LOCATION + "/" + DFU_BINARY + " -c port=usb1 -w " + hexAbsolutePath + " -v -s";