mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-26 17:55:24 +03:00
Add message for flashing not continuing after backup cancelled (#4393)
* Add message for flashing not continuing after backup cancelled * Use INVALID * Wait for port to be available again
This commit is contained in:
parent
0ea310fefe
commit
767edb8b3a
2 changed files with 31 additions and 7 deletions
|
@ -3765,6 +3765,9 @@
|
||||||
"firmwareFlasherFailedToLoadUnifiedConfig": {
|
"firmwareFlasherFailedToLoadUnifiedConfig": {
|
||||||
"message": "Failed to load remote config for {{remote_file}}"
|
"message": "Failed to load remote config for {{remote_file}}"
|
||||||
},
|
},
|
||||||
|
"firmwareFlasherCanceledBackup": {
|
||||||
|
"message": "Backup cancelled, flashing aborted"
|
||||||
|
},
|
||||||
"firmwareFlasherLegacyLabel": {
|
"firmwareFlasherLegacyLabel": {
|
||||||
"message": "{{target}} (Legacy)",
|
"message": "{{target}} (Legacy)",
|
||||||
"description": "If we have a Unified target and a old style target available, we are labeling the older one"
|
"description": "If we have a Unified target and a old style target available, we are labeling the older one"
|
||||||
|
|
|
@ -1140,17 +1140,38 @@ firmware_flasher.initialize = function (callback) {
|
||||||
function startBackup(callback) {
|
function startBackup(callback) {
|
||||||
// prevent connection while backup is in progress
|
// prevent connection while backup is in progress
|
||||||
GUI.connect_lock = true;
|
GUI.connect_lock = true;
|
||||||
AutoBackup.execute((result) => {
|
|
||||||
|
const aborted = function (message) {
|
||||||
GUI.connect_lock = false;
|
GUI.connect_lock = false;
|
||||||
if (result) {
|
|
||||||
callback();
|
|
||||||
} else {
|
|
||||||
self.isFlashing = false;
|
self.isFlashing = false;
|
||||||
self.enableFlashButton(true);
|
self.enableFlashButton(true);
|
||||||
self.enableLoadRemoteFileButton(true);
|
self.enableLoadRemoteFileButton(true);
|
||||||
self.enableLoadFileButton(true);
|
self.enableLoadFileButton(true);
|
||||||
GUI.interval_resume("sponsor");
|
GUI.interval_resume("sponsor");
|
||||||
console.log(`${self.logHead} Backup failed, skipping flashing`);
|
self.flashingMessage(i18n.getMessage(message), self.FLASH_MESSAGE_TYPES.INVALID);
|
||||||
|
};
|
||||||
|
|
||||||
|
const callBackWhenPortAvailable = function () {
|
||||||
|
const startTime = Date.now();
|
||||||
|
const interval = setInterval(() => {
|
||||||
|
if (PortHandler.portAvailable) {
|
||||||
|
clearInterval(interval);
|
||||||
|
callback();
|
||||||
|
} else if (Date.now() - startTime > 5000) {
|
||||||
|
clearInterval(interval);
|
||||||
|
// failed to connect
|
||||||
|
aborted("portsSelectNone");
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
};
|
||||||
|
|
||||||
|
AutoBackup.execute((result) => {
|
||||||
|
GUI.connect_lock = false;
|
||||||
|
if (result) {
|
||||||
|
// wait for the port to be available again - timeout after 5 seconds
|
||||||
|
callBackWhenPortAvailable();
|
||||||
|
} else {
|
||||||
|
aborted("firmwareFlasherCanceledBackup");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue