Add forced full erase to STM32F7 firmware update
(cherry picked from commit a53b09c01e50c06788ffaed1a813e0b48cb481d6)
This commit is contained in:
parent
543ebdad63
commit
41b78ddd8a
|
@ -5,6 +5,7 @@ import com.rusefi.Launcher;
|
||||||
import com.rusefi.Timeouts;
|
import com.rusefi.Timeouts;
|
||||||
import com.rusefi.autodetect.PortDetector;
|
import com.rusefi.autodetect.PortDetector;
|
||||||
import com.rusefi.autodetect.SerialAutoChecker;
|
import com.rusefi.autodetect.SerialAutoChecker;
|
||||||
|
import com.rusefi.core.io.BundleUtil;
|
||||||
import com.rusefi.io.DfuHelper;
|
import com.rusefi.io.DfuHelper;
|
||||||
import com.rusefi.io.IoStream;
|
import com.rusefi.io.IoStream;
|
||||||
import com.rusefi.io.serial.BufferedSerialIoStream;
|
import com.rusefi.io.serial.BufferedSerialIoStream;
|
||||||
|
@ -45,6 +46,18 @@ public class DfuFlasher {
|
||||||
|
|
||||||
StatusWindow wnd = createStatusWindow();
|
StatusWindow wnd = createStatusWindow();
|
||||||
|
|
||||||
|
boolean needsEraseFirst = false;
|
||||||
|
if (BundleUtil.getBundleTarget().contains("f7")) {
|
||||||
|
int result = JOptionPane.showConfirmDialog(parent, "Firmware update requires a full erase of the ECU. If your tune is not saved in TunerStudio, it will be lost.\nEnsure that TunerStudio has your current tune saved!\n\nAfter updating, re-connect TunerStudio to restore your tune.\n\nPress OK to continue with the update, or Cancel to abort so you can save your tune.", "WARNING", JOptionPane.OK_CANCEL_OPTION);
|
||||||
|
|
||||||
|
// 0 means they clicked "OK", 1 means they clicked "Cancel"
|
||||||
|
if (result != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
needsEraseFirst = true;
|
||||||
|
}
|
||||||
|
|
||||||
AtomicBoolean isSignatureValidated = rebootToDfu(parent, port, wnd);
|
AtomicBoolean isSignatureValidated = rebootToDfu(parent, port, wnd);
|
||||||
if (isSignatureValidated == null)
|
if (isSignatureValidated == null)
|
||||||
return;
|
return;
|
||||||
|
@ -54,9 +67,11 @@ public class DfuFlasher {
|
||||||
wnd.append("rusEFI console can only program on Windows");
|
wnd.append("rusEFI console can only program on Windows");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean finalNeedsEraseFirst = needsEraseFirst;
|
||||||
submitAction(() -> {
|
submitAction(() -> {
|
||||||
timeForDfuSwitch(wnd);
|
timeForDfuSwitch(wnd);
|
||||||
executeDFU(wnd);
|
executeDFU(wnd, finalNeedsEraseFirst);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
wnd.append("Please use manual DFU to change bundle type.");
|
wnd.append("Please use manual DFU to change bundle type.");
|
||||||
|
@ -134,10 +149,10 @@ public class DfuFlasher {
|
||||||
|
|
||||||
public static void runDfuProgramming() {
|
public static void runDfuProgramming() {
|
||||||
StatusWindow wnd = createStatusWindow();
|
StatusWindow wnd = createStatusWindow();
|
||||||
submitAction(() -> executeDFU(wnd));
|
submitAction(() -> executeDFU(wnd, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void executeDFU(StatusWindow wnd) {
|
private static void executeDFU(StatusWindow wnd, boolean fullErase) {
|
||||||
boolean driverIsHappy = detectSTM32BootloaderDriverState(wnd);
|
boolean driverIsHappy = detectSTM32BootloaderDriverState(wnd);
|
||||||
if (!driverIsHappy) {
|
if (!driverIsHappy) {
|
||||||
wnd.append("*** DRIVER ERROR? *** Did you have a chance to try 'Install Drivers' button on top of rusEFI console start screen?");
|
wnd.append("*** DRIVER ERROR? *** Did you have a chance to try 'Install Drivers' button on top of rusEFI console start screen?");
|
||||||
|
@ -145,6 +160,10 @@ public class DfuFlasher {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fullErase) {
|
||||||
|
runDfuErase(wnd);
|
||||||
|
}
|
||||||
|
|
||||||
StringBuffer stdout = new StringBuffer();
|
StringBuffer stdout = new StringBuffer();
|
||||||
String errorResponse;
|
String errorResponse;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue