Now we back up updated calibrations #7357

This commit is contained in:
kifir23917 2025-02-03 18:29:25 +03:00 committed by rusefillc
parent d1fa312d8e
commit fd369ef4e6
1 changed files with 12 additions and 0 deletions

View File

@ -213,6 +213,7 @@ public class ProgramSelector {
}
private static final String PREVIOUS_CALIBRATIONS_FILE_NAME = "prev_calibrations";
private static final String UPDATED_CALIBRATIONS_FILE_NAME = "updated_calibrations";
public static void flashOpenbltSerialAutomatic(JComponent parent, PortResult ecuPort, UpdateOperationCallbacks callbacks) {
AutoupdateUtil.assertNotAwtThread();
@ -267,6 +268,17 @@ public class ProgramSelector {
callbacks.logLine("Serial port " + openbltPort + " appeared, programming firmware...");
flashOpenbltSerialJni(parent, openbltPort, callbacks);
final Optional<CalibrationsInfo> updatedCalibrations = readAndBackupCurrentCalibrations(
ecuPort,
callbacks,
UPDATED_CALIBRATIONS_FILE_NAME
);
if (updatedCalibrations.isEmpty()) {
callbacks.logLine("Failed to back up updated calibrations...");
callbacks.error();
return;
}
}
private static OpenbltJni.OpenbltCallbacks makeOpenbltCallbacks(UpdateOperationCallbacks callbacks) {