mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-17 21:35:33 +03:00
Provide a migration path from pre-1.8.0 firmware backups.
This commit is contained in:
parent
4b2704e784
commit
b2be2853b4
8 changed files with 148 additions and 46 deletions
|
@ -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++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue