openblt into console

This commit is contained in:
rusefillc 2022-08-08 17:18:20 -04:00
parent 51887a8a6d
commit 6e560e7f12
1 changed files with 20 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package com.rusefi.maintenance; package com.rusefi.maintenance;
import com.rusefi.Launcher;
import com.rusefi.autodetect.PortDetector; import com.rusefi.autodetect.PortDetector;
import com.rusefi.autoupdate.AutoupdateUtil; import com.rusefi.autoupdate.AutoupdateUtil;
import com.rusefi.ui.StatusWindow; import com.rusefi.ui.StatusWindow;
@ -10,9 +11,11 @@ import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.File;
import java.util.Arrays; import java.util.Arrays;
import java.util.Objects; import java.util.Objects;
import static com.rusefi.StartupFrame.appendBundleName;
import static com.rusefi.ui.storage.PersistentConfiguration.getConfig; import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
public class ProgramSelector { public class ProgramSelector {
@ -22,6 +25,8 @@ public class ProgramSelector {
private static final String DFU_SWITCH = "Switch to DFU Mode"; private static final String DFU_SWITCH = "Switch to DFU Mode";
private static final String DFU_ERASE = "Full Chip Erase"; private static final String DFU_ERASE = "Full Chip Erase";
private static final String ST_LINK = "ST-LINK Update"; private static final String ST_LINK = "ST-LINK Update";
private static final String OPENBLT_CAN = "OpenBLT via CAN";
public static final boolean IS_WIN = System.getProperty("os.name").toLowerCase().contains("win"); public static final boolean IS_WIN = System.getProperty("os.name").toLowerCase().contains("win");
private static final String HELP = "https://github.com/rusefi/rusefi/wiki/HOWTO-Update-Firmware"; private static final String HELP = "https://github.com/rusefi/rusefi/wiki/HOWTO-Update-Firmware";
@ -38,6 +43,7 @@ public class ProgramSelector {
mode.addItem(MANUAL_DFU); mode.addItem(MANUAL_DFU);
mode.addItem(DFU_ERASE); mode.addItem(DFU_ERASE);
mode.addItem(ST_LINK); mode.addItem(ST_LINK);
mode.addItem(OPENBLT_CAN);
} }
mode.addItem(DFU_SWITCH); mode.addItem(DFU_SWITCH);
@ -76,6 +82,8 @@ public class ProgramSelector {
String port = selected == null ? PortDetector.AUTO : selected.toString(); String port = selected == null ? PortDetector.AUTO : selected.toString();
DfuFlasher.rebootToDfu(comboPorts, port, wnd); DfuFlasher.rebootToDfu(comboPorts, port, wnd);
break; break;
case OPENBLT_CAN:
flashOpenBltCan();
case DFU_ERASE: case DFU_ERASE:
DfuFlasher.runDfuErase(); DfuFlasher.runDfuErase();
break; break;
@ -87,6 +95,18 @@ public class ProgramSelector {
} }
private void flashOpenBltCan() {
StatusWindow wnd = new StatusWindow();
wnd.showFrame(appendBundleName("OpenBLT via CAN " + Launcher.CONSOLE_VERSION));
ExecHelper.submitAction(() -> {
ExecHelper.executeCommand(Launcher.TOOLS_PATH + File.separator + "openblt",
"BootCommander.exe -s=xcp -t=xcp_can -d=peak_pcanusb -t1=1000 -t3=2000 -t4=10000 -t5=1000 -t7=2000 ../../rusefi_update.srec",
"BootCommander.exe", wnd, new StringBuffer());
// it's a lengthy operation let's signal end
Toolkit.getDefaultToolkit().beep();
}, "OpenBLT via CAN");
}
@NotNull @NotNull
public static JComponent createHelpButton() { public static JComponent createHelpButton() {
return new URLLabel("HOWTO Update Firmware", HELP); return new URLLabel("HOWTO Update Firmware", HELP);