integration

This commit is contained in:
rusefillc 2023-12-24 19:09:47 -05:00
parent 55fccd8714
commit 67745aff7d
4 changed files with 33 additions and 7 deletions

View File

@ -7,6 +7,7 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.FileNotFoundException;
/**
* This code automates drivers unpacking and installation
@ -50,13 +51,18 @@ public class DriverInstall {
FileLog.MAIN.logLine(message);
return;
}
try {
ExecHelper.executeCommand(FOLDER,
FOLDER + File.separator + SELF_UNCOMPRESSING_ARCHIVE + YES,
SELF_UNCOMPRESSING_ARCHIVE,
wnd);
String batch = isWindows7orBelow() ? WINDOWS7_BATCH : WINDOWS8_BATCH;
String batch = isWindows7orBelow() ? WINDOWS7_BATCH : WINDOWS8_BATCH;
ExecHelper.executeCommand(UNPACKED_FOLDER, ExecHelper.getBatchCommand(batch), batch, wnd);
} catch (FileNotFoundException e) {
wnd.append(e.toString());
wnd.error();
}
}
private static boolean isWindows7orBelow() {

View File

@ -6,6 +6,7 @@ import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.io.FileNotFoundException;
import static com.rusefi.maintenance.FirmwareFlasher.TITLE;
@ -30,8 +31,13 @@ public class EraseChip {
wnd.showFrame(TITLE);
StatusAnimation sa = new StatusAnimation(wnd);
ExecHelper.submitAction(() -> {
try {
FirmwareFlasher.executeOpenOCDCommand(getEraseCommand(), wnd);
sa.stop();
} catch (FileNotFoundException ex) {
wnd.append(ex.toString());
wnd.error();
}
sa.stop();
wnd.setStatus(FirmwareFlasher.DONE);
}, EraseChip.this.getClass() + " extProcessThread");
}
@ -46,4 +52,4 @@ public class EraseChip {
public JButton getButton() {
return button;
}
}
}

View File

@ -8,6 +8,7 @@ import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.io.File;
import java.io.FileNotFoundException;
import static com.rusefi.Launcher.INPUT_FILES_PATH;
import static com.rusefi.core.preferences.storage.PersistentConfiguration.getConfig;
@ -58,7 +59,7 @@ public class FirmwareFlasher {
return OPENOCD_EXE + " -f openocd/" + cfg;
}
protected static String executeOpenOCDCommand(String command, UpdateOperationCallbacks wnd) {
protected static String executeOpenOCDCommand(String command, UpdateOperationCallbacks wnd) throws FileNotFoundException {
return ExecHelper.executeCommand(OPENOCD_BINARY_LOCATION,
OPENOCD_BINARY_LOCATION + File.separator + command,
OPENOCD_EXE, wnd);
@ -71,10 +72,17 @@ public class FirmwareFlasher {
return;
}
StatusAnimation sa = new StatusAnimation(wnd);
String error = executeOpenOCDCommand(getOpenocdCommand() + " -c \"program " +
String error = null;
try {
error = executeOpenOCDCommand(getOpenocdCommand() + " -c \"program " +
fileName +
" verify reset exit 0x08000000\"", wnd);
if (error.contains(SUCCESS_MESSAGE_TAG) && !error.toLowerCase().contains(FAILED_MESSAGE_TAG)) {
} catch (FileNotFoundException e) {
wnd.append(e.toString());
wnd.error();
return;
}
if (error.contains(SUCCESS_MESSAGE_TAG) && !error.toLowerCase().contains(FAILED_MESSAGE_TAG)) {
wnd.append("Flashing looks good!");
sa.stop();
wnd.setStatus(DONE);

View File

@ -131,7 +131,13 @@ public class ProgramSelector {
DfuFlasher.rebootToDfu(parent, port, callbacks, Fields.CMD_REBOOT_OPENBLT);
}
private void flashOpenBltCan(UpdateOperationCallbacks callbacks) {
@NotNull
public static JButton createUpdateFirmwareButton() {
return new JButton("Update Firmware", AutoupdateUtil.loadIcon("upload48.png"));
}
private void flashOpenBltCan(UpdateOperationCallbacks callbacks) {
OpenbltBootCommanderRunner.flashCan("../../rusefi_update.srec", callbacks);
// it's a lengthy operation let's signal end