mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 20:35:19 +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
|
@ -518,6 +518,9 @@
|
||||||
"portsHelp": {
|
"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."
|
"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": {
|
"portsButtonSave": {
|
||||||
"message": "Save and Reboot"
|
"message": "Save and Reboot"
|
||||||
},
|
},
|
||||||
|
@ -899,6 +902,9 @@
|
||||||
"dataflashNotSupportedNote": {
|
"dataflashNotSupportedNote": {
|
||||||
"message": "Your flight controller does not have a compatible dataflash chip available."
|
"message": "Your flight controller does not have a compatible dataflash chip available."
|
||||||
},
|
},
|
||||||
|
"dataflashFirmwareUpgradeRequired": {
|
||||||
|
"message": "Dataflash requires firmware >= 1.8.0."
|
||||||
|
},
|
||||||
"dataflashButtonSaveFile": {
|
"dataflashButtonSaveFile": {
|
||||||
"message": "Save flash to file..."
|
"message": "Save flash to file..."
|
||||||
},
|
},
|
||||||
|
|
|
@ -102,7 +102,7 @@ function configuration_backup(callback) {
|
||||||
configuration.RCMAP = jQuery.extend(true, [], RC_MAP);
|
configuration.RCMAP = jQuery.extend(true, [], RC_MAP);
|
||||||
configuration.BF_CONFIG = jQuery.extend(true, {}, BF_CONFIG);
|
configuration.BF_CONFIG = jQuery.extend(true, {}, BF_CONFIG);
|
||||||
configuration.SERIAL_CONFIG = jQuery.extend(true, {}, SERIAL_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();
|
save();
|
||||||
}
|
}
|
||||||
|
@ -332,9 +332,56 @@ function configuration_restore(callback) {
|
||||||
|
|
||||||
if (!compareVersions(migratedVersion, '0.63.0')) {
|
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 = {
|
configuration.SERIAL_CONFIG = {
|
||||||
ports: []
|
ports: ports
|
||||||
};
|
};
|
||||||
|
|
||||||
for (var profileIndex = 0; profileIndex < 3; profileIndex++) {
|
for (var profileIndex = 0; profileIndex < 3; profileIndex++) {
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
var CONFIGURATOR = {
|
var CONFIGURATOR = {
|
||||||
'releaseDate': 1424462791805, // new Date().getTime() - 2015.02.20
|
'releaseDate': 1424462791805, // new Date().getTime() - 2015.02.20
|
||||||
'apiVersionAccepted': 1.2,
|
'apiVersionAccepted': 1.2,
|
||||||
'backupRestoreMinApiVersionAccepted': 1.6,
|
'backupRestoreMinApiVersionAccepted': 1.5,
|
||||||
'pidControllerChangeMinApiVersion': 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,
|
'connectionValid': false,
|
||||||
'connectionValidCliOnly': false,
|
'connectionValidCliOnly': false,
|
||||||
'cliActive': false,
|
'cliActive': false,
|
||||||
|
@ -89,6 +89,8 @@ var SERVO_CONFIG = [];
|
||||||
|
|
||||||
var SERIAL_CONFIG = {
|
var SERIAL_CONFIG = {
|
||||||
ports: [],
|
ports: [],
|
||||||
|
|
||||||
|
// pre 1.6 settings
|
||||||
mspBaudRate: 0,
|
mspBaudRate: 0,
|
||||||
gpsBaudRate: 0,
|
gpsBaudRate: 0,
|
||||||
gpsPassthroughBaudRate: 0,
|
gpsPassthroughBaudRate: 0,
|
||||||
|
|
|
@ -62,6 +62,6 @@
|
||||||
<a href="#" class="save-flash" i18n="dataflashButtonSaveFile"></a>
|
<a href="#" class="save-flash" i18n="dataflashButtonSaveFile"></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="note require-no-dataflash" i18n="dataflashNotSupportedNote">
|
<div class="note require-no-dataflash">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -1,6 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
TABS.dataflash = {};
|
TABS.dataflash = {
|
||||||
|
available: false
|
||||||
|
};
|
||||||
TABS.dataflash.initialize = function (callback) {
|
TABS.dataflash.initialize = function (callback) {
|
||||||
var
|
var
|
||||||
self = this,
|
self = this,
|
||||||
|
@ -18,11 +20,20 @@ TABS.dataflash.initialize = function (callback) {
|
||||||
log_buffer = [];
|
log_buffer = [];
|
||||||
|
|
||||||
if (CONFIGURATOR.connectionValid) {
|
if (CONFIGURATOR.connectionValid) {
|
||||||
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false, function() {
|
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() {
|
$('#content').load("./tabs/dataflash.html", function() {
|
||||||
create_html();
|
create_html();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatFilesize(bytes) {
|
function formatFilesize(bytes) {
|
||||||
|
@ -71,12 +82,13 @@ TABS.dataflash.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_html() {
|
function create_html() {
|
||||||
var
|
|
||||||
supportsDataflash = DATAFLASH.totalSize > 0;
|
|
||||||
|
|
||||||
// translate to user-selected language
|
// translate to user-selected language
|
||||||
localize();
|
localize();
|
||||||
|
|
||||||
|
if (TABS.dataflash.available) {
|
||||||
|
var supportsDataflash = DATAFLASH.totalSize > 0;
|
||||||
|
|
||||||
$(".tab-dataflash").toggleClass("supported", supportsDataflash);
|
$(".tab-dataflash").toggleClass("supported", supportsDataflash);
|
||||||
|
|
||||||
if (supportsDataflash) {
|
if (supportsDataflash) {
|
||||||
|
@ -91,7 +103,13 @@ TABS.dataflash.initialize = function (callback) {
|
||||||
$('.tab-dataflash a.save-flash-dismiss').click(dismiss_saving_dialog);
|
$('.tab-dataflash a.save-flash-dismiss').click(dismiss_saving_dialog);
|
||||||
|
|
||||||
update_html();
|
update_html();
|
||||||
|
} else {
|
||||||
|
$(".tab-dataflash .note").html(chrome.i18n.getMessage('dataflashNotSupportedNote'));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$(".tab-dataflash .note").html(chrome.i18n.getMessage('dataflashFirmwareUpgradeRequired'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,3 +65,21 @@
|
||||||
.tab-ports .save:hover {
|
.tab-ports .save:hover {
|
||||||
background-color: #dedcdc;
|
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,5 +1,6 @@
|
||||||
<div id="content-watermark"></div>
|
<div id="content-watermark"></div>
|
||||||
<div class="tab-ports">
|
<div class="tab-ports">
|
||||||
|
<div class="require-support">
|
||||||
<div class="help">
|
<div class="help">
|
||||||
<p i18n="portsHelp"></p>
|
<p i18n="portsHelp"></p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -21,6 +22,9 @@
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<a class="save" href="#" i18n="portsButtonSave"></a>
|
<a class="save" href="#" i18n="portsButtonSave"></a>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="note require-upgrade" i18n="portsFirmwareUpgradeRequired">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="tab-ports-templates">
|
<div id="tab-ports-templates">
|
||||||
|
|
|
@ -75,6 +75,13 @@ TABS.ports.initialize = function (callback, scrollPosition) {
|
||||||
|
|
||||||
function update_ui() {
|
function update_ui() {
|
||||||
|
|
||||||
|
if (CONFIG.apiVersion < 1.6) {
|
||||||
|
|
||||||
|
$(".tab-ports").removeClass("supported");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(".tab-ports").addClass("supported");
|
||||||
|
|
||||||
var portIdentifierToNameMapping = {
|
var portIdentifierToNameMapping = {
|
||||||
0: 'UART1',
|
0: 'UART1',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue