Provide a migration path from pre-1.8.0 firmware backups.
parent
4b2704e784
commit
b2be2853b4
|
@ -518,6 +518,9 @@
|
|||
"portsHelp": {
|
||||
"message": "Configure serial ports. <strong>Note:</strong> not all combinations are valid. When the flight controller firmware detects this the serial port configuration will be reset."
|
||||
},
|
||||
"portsFirmwareUpgradeRequired": {
|
||||
"message": "Firmware upgrade <span style=\"color: red\">required</span>. Serial port configurations of firmware < 1.8.0 is not supported."
|
||||
},
|
||||
"portsButtonSave": {
|
||||
"message": "Save and Reboot"
|
||||
},
|
||||
|
@ -899,6 +902,9 @@
|
|||
"dataflashNotSupportedNote": {
|
||||
"message": "Your flight controller does not have a compatible dataflash chip available."
|
||||
},
|
||||
"dataflashFirmwareUpgradeRequired": {
|
||||
"message": "Dataflash requires firmware >= 1.8.0."
|
||||
},
|
||||
"dataflashButtonSaveFile": {
|
||||
"message": "Save flash to 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++) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -62,6 +62,6 @@
|
|||
<a href="#" class="save-flash" i18n="dataflashButtonSaveFile"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="note require-no-dataflash" i18n="dataflashNotSupportedNote">
|
||||
<div class="note require-no-dataflash">
|
||||
</div>
|
||||
</div>
|
|
@ -1,6 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
TABS.dataflash = {};
|
||||
TABS.dataflash = {
|
||||
available: false
|
||||
};
|
||||
TABS.dataflash.initialize = function (callback) {
|
||||
var
|
||||
self = this,
|
||||
|
@ -18,10 +20,19 @@ TABS.dataflash.initialize = function (callback) {
|
|||
log_buffer = [];
|
||||
|
||||
if (CONFIGURATOR.connectionValid) {
|
||||
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false, function() {
|
||||
$('#content').load("./tabs/dataflash.html", function() {
|
||||
create_html();
|
||||
});
|
||||
if (CONFIG.apiVersion < 1.6) {
|
||||
load_html();
|
||||
return;
|
||||
}
|
||||
|
||||
TABS.dataflash.available = true;
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false, load_html);
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
$('#content').load("./tabs/dataflash.html", function() {
|
||||
create_html();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -71,27 +82,34 @@ TABS.dataflash.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function create_html() {
|
||||
var
|
||||
supportsDataflash = DATAFLASH.totalSize > 0;
|
||||
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
|
||||
if (TABS.dataflash.available) {
|
||||
var supportsDataflash = DATAFLASH.totalSize > 0;
|
||||
|
||||
$(".tab-dataflash").toggleClass("supported", supportsDataflash);
|
||||
|
||||
$(".tab-dataflash").toggleClass("supported", supportsDataflash);
|
||||
if (supportsDataflash) {
|
||||
// UI hooks
|
||||
$('.tab-dataflash a.erase-flash').click(ask_to_erase_flash);
|
||||
|
||||
$('.tab-dataflash a.erase-flash-confirm').click(flash_erase);
|
||||
$('.tab-dataflash a.erase-flash-cancel').click(flash_erase_cancel);
|
||||
|
||||
if (supportsDataflash) {
|
||||
// UI hooks
|
||||
$('.tab-dataflash a.erase-flash').click(ask_to_erase_flash);
|
||||
|
||||
$('.tab-dataflash a.erase-flash-confirm').click(flash_erase);
|
||||
$('.tab-dataflash a.erase-flash-cancel').click(flash_erase_cancel);
|
||||
|
||||
$('.tab-dataflash a.save-flash').click(flash_save_begin);
|
||||
$('.tab-dataflash a.save-flash-cancel').click(flash_save_cancel);
|
||||
$('.tab-dataflash a.save-flash-dismiss').click(dismiss_saving_dialog);
|
||||
|
||||
update_html();
|
||||
$('.tab-dataflash a.save-flash').click(flash_save_begin);
|
||||
$('.tab-dataflash a.save-flash-cancel').click(flash_save_cancel);
|
||||
$('.tab-dataflash a.save-flash-dismiss').click(dismiss_saving_dialog);
|
||||
|
||||
update_html();
|
||||
} else {
|
||||
$(".tab-dataflash .note").html(chrome.i18n.getMessage('dataflashNotSupportedNote'));
|
||||
}
|
||||
} else {
|
||||
$(".tab-dataflash .note").html(chrome.i18n.getMessage('dataflashFirmwareUpgradeRequired'));
|
||||
}
|
||||
|
||||
|
||||
if (callback) callback();
|
||||
}
|
||||
|
|
|
@ -64,4 +64,22 @@
|
|||
}
|
||||
.tab-ports .save:hover {
|
||||
background-color: #dedcdc;
|
||||
}
|
||||
}
|
||||
|
||||
.tab-ports .note {
|
||||
padding: 5px;
|
||||
border: 1px dashed silver;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.require-support {
|
||||
display:none;
|
||||
}
|
||||
.tab-ports.supported .require-support {
|
||||
display:block;
|
||||
}
|
||||
.require-upgrade {
|
||||
display:block;
|
||||
}
|
||||
.tab-ports.supported .require-upgrade {
|
||||
display:none;
|
||||
}
|
||||
|
|
|
@ -1,25 +1,29 @@
|
|||
<div id="content-watermark"></div>
|
||||
<div class="tab-ports">
|
||||
<div class="help">
|
||||
<p i18n="portsHelp"></p>
|
||||
<div class="require-support">
|
||||
<div class="help">
|
||||
<p i18n="portsHelp"></p>
|
||||
</div>
|
||||
<table class="ports">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Identifier</td>
|
||||
<td>Data</td>
|
||||
<td>Logging</td>
|
||||
<td>Telemetry</td>
|
||||
<td>RX</td>
|
||||
<td>GPS</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="clear-both"></div>
|
||||
<div class="buttons">
|
||||
<a class="save" href="#" i18n="portsButtonSave"></a>
|
||||
</div>
|
||||
</div>
|
||||
<table class="ports">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Identifier</td>
|
||||
<td>Data</td>
|
||||
<td>Logging</td>
|
||||
<td>Telemetry</td>
|
||||
<td>RX</td>
|
||||
<td>GPS</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="clear-both"></div>
|
||||
<div class="buttons">
|
||||
<a class="save" href="#" i18n="portsButtonSave"></a>
|
||||
<div class="note require-upgrade" i18n="portsFirmwareUpgradeRequired">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -75,6 +75,13 @@ TABS.ports.initialize = function (callback, scrollPosition) {
|
|||
|
||||
function update_ui() {
|
||||
|
||||
if (CONFIG.apiVersion < 1.6) {
|
||||
|
||||
$(".tab-ports").removeClass("supported");
|
||||
return;
|
||||
}
|
||||
|
||||
$(".tab-ports").addClass("supported");
|
||||
|
||||
var portIdentifierToNameMapping = {
|
||||
0: 'UART1',
|
||||
|
|
Loading…
Reference in New Issue