1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-19 14:25:14 +03:00

Provide a migration path from pre-1.8.0 firmware backups.

This commit is contained in:
Dominic Clifton 2015-03-11 23:34:24 +00:00
parent 4b2704e784
commit b2be2853b4
8 changed files with 148 additions and 46 deletions

View file

@ -102,7 +102,7 @@ function configuration_backup(callback) {
configuration.RCMAP = jQuery.extend(true, [], RC_MAP);
configuration.BF_CONFIG = jQuery.extend(true, {}, BF_CONFIG);
configuration.SERIAL_CONFIG = jQuery.extend(true, {}, SERIAL_CONFIG);
configuration.LED_STRIP = jQuery.extend(true, {}, LED_STRIP);
configuration.LED_STRIP = jQuery.extend(true, [], LED_STRIP);
save();
}
@ -332,9 +332,56 @@ function configuration_restore(callback) {
if (!compareVersions(migratedVersion, '0.63.0')) {
// Serial configuation redesigned. Until a migration is written just reset the serial port configuration
// LED Strip was saved as object instead of array.
if (typeof(configuration.LED_STRIP) == 'object') {
var fixed_led_strip = [];
var index = 0;
while (configuration.LED_STRIP[index]) {
fixed_led_strip.push(configuration.LED_STRIP[index++]);
}
configuration.LED_STRIP = fixed_led_strip;
}
// Serial configuation redesigned
var ports = [];
for (var portIndex = 0; portIndex < configuration.SERIAL_CONFIG.ports.length; portIndex++) {
var oldPort = configuration.SERIAL_CONFIG.ports[portIndex];
var newPort = {
identifier: oldPort.identifier,
functionMask: 0,
msp_baudrate: configuration.SERIAL_CONFIG.mspBaudRate,
gps_baudrate: configuration.SERIAL_CONFIG.gpsBaudRate,
telemetry_baudrate: 0, // auto
blackbox_baudrate: 5, // 115200
};
switch(oldPort.scenario) {
case 1: // MSP, CLI, TELEMETRY, SMARTPORT TELEMETRY, GPS-PASSTHROUGH
case 5: // MSP, CLI, GPS-PASSTHROUGH
case 8: // MSP ONLY
newPort.functionMask = 1; // FUCNTION_MSP
break;
case 2: // GPS
newPort.functionMask = 2; // FUNCTION_GPS
break;
case 3: // RX_SERIAL
newPort.functionMask = 64; // FUNCTION_RX_SERIAL
break;
case 10: // BLACKBOX ONLY
newPort.functionMask = 128; // FUNCTION_BLACKBOX
break;
case 11: // MSP, CLI, BLACKBOX, GPS-PASSTHROUGH
newPort.functionMask = 1 + 128; // FUNCTION_BLACKBOX
break;
}
ports.push(newPort);
}
configuration.SERIAL_CONFIG = {
ports: []
ports: ports
};
for (var profileIndex = 0; profileIndex < 3; profileIndex++) {

View file

@ -3,9 +3,9 @@
var CONFIGURATOR = {
'releaseDate': 1424462791805, // new Date().getTime() - 2015.02.20
'apiVersionAccepted': 1.2,
'backupRestoreMinApiVersionAccepted': 1.6,
'backupRestoreMinApiVersionAccepted': 1.5,
'pidControllerChangeMinApiVersion': 1.5,
'backupFileMinVersionAccepted': '0.63', // chrome.runtime.getManifest().version is stored as string, so does this one
'backupFileMinVersionAccepted': '0.55', // chrome.runtime.getManifest().version is stored as string, so does this one
'connectionValid': false,
'connectionValidCliOnly': false,
'cliActive': false,
@ -89,6 +89,8 @@ var SERVO_CONFIG = [];
var SERIAL_CONFIG = {
ports: [],
// pre 1.6 settings
mspBaudRate: 0,
gpsBaudRate: 0,
gpsPassthroughBaudRate: 0,