diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 46c48dea..a9ad612e 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -518,6 +518,9 @@ "portsHelp": { "message": "Configure serial ports. Note: not all combinations are valid. When the flight controller firmware detects this the serial port configuration will be reset." }, + "portsFirmwareUpgradeRequired": { + "message": "Firmware upgrade required. 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..." }, diff --git a/js/backup_restore.js b/js/backup_restore.js index 830ea458..5b77b1e0 100644 --- a/js/backup_restore.js +++ b/js/backup_restore.js @@ -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++) { diff --git a/js/data_storage.js b/js/data_storage.js index 3a85dced..19648c28 100755 --- a/js/data_storage.js +++ b/js/data_storage.js @@ -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, diff --git a/tabs/dataflash.html b/tabs/dataflash.html index 70d46b89..7948e8f8 100644 --- a/tabs/dataflash.html +++ b/tabs/dataflash.html @@ -62,6 +62,6 @@ -
+
\ No newline at end of file diff --git a/tabs/dataflash.js b/tabs/dataflash.js index f1cde23d..485856ee 100644 --- a/tabs/dataflash.js +++ b/tabs/dataflash.js @@ -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(); } diff --git a/tabs/ports.css b/tabs/ports.css index ab0c4204..e29583ab 100644 --- a/tabs/ports.css +++ b/tabs/ports.css @@ -64,4 +64,22 @@ } .tab-ports .save:hover { background-color: #dedcdc; -} \ No newline at end of file +} + +.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; +} diff --git a/tabs/ports.html b/tabs/ports.html index 8989fe89..15362f98 100644 --- a/tabs/ports.html +++ b/tabs/ports.html @@ -1,25 +1,29 @@
-
-

+
+
+

+
+ + + + + + + + + + + + + +
IdentifierDataLoggingTelemetryRXGPS
+
+
+ +
- - - - - - - - - - - - - -
IdentifierDataLoggingTelemetryRXGPS
-
-
- +
diff --git a/tabs/ports.js b/tabs/ports.js index 8b5d0cee..580e67c5 100644 --- a/tabs/ports.js +++ b/tabs/ports.js @@ -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',