From 4e12db9c5e9c89f086e35ad6c929ff933aeef530 Mon Sep 17 00:00:00 2001 From: Nicholas Sherlock Date: Mon, 30 Nov 2015 20:36:47 +1300 Subject: [PATCH 01/13] Convert dataflash tab to a new Blackbox tab with SD card support --- _locales/en/messages.json | 32 ++- images/icons/cf_icon_sdcard.svg | 83 ++++++ js/data_storage.js | 16 ++ js/gui.js | 2 +- js/msp.js | 47 +++- main.html | 12 +- main.js | 4 +- tabs/dataflash.css | 221 --------------- tabs/dataflash.html | 66 ----- tabs/dataflash.js | 288 ------------------- tabs/onboard_logging.css | 298 ++++++++++++++++++++ tabs/onboard_logging.html | 141 ++++++++++ tabs/onboard_logging.js | 470 ++++++++++++++++++++++++++++++++ 13 files changed, 1089 insertions(+), 591 deletions(-) create mode 100644 images/icons/cf_icon_sdcard.svg delete mode 100644 tabs/dataflash.css delete mode 100644 tabs/dataflash.html delete mode 100644 tabs/dataflash.js create mode 100644 tabs/onboard_logging.css create mode 100644 tabs/onboard_logging.html create mode 100644 tabs/onboard_logging.js diff --git a/_locales/en/messages.json b/_locales/en/messages.json index ff0b4b1e..77a03a0b 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -103,10 +103,10 @@ "message": "CLI" }, "tabLogging": { - "message": "Logging" + "message": "Tethered Logging" }, - "tabDataflash": { - "message": "Dataflash" + "tabOnboardLogging": { + "message": "Blackbox" }, "tabAdjustments": { "message": "Adjustments" @@ -988,10 +988,30 @@ "message": "Automatically loaded previous log file: $1" }, - "dataflashNote": { - "message": "Blackbox flight logs can be recorded to your flight controller's onboard dataflash chip." + "blackboxNotSupported": { + "message": "Your flight controller's firmware does not support Blackbox logging." }, - "dataflashNotSupportedNote": { + "blackboxMaybeSupported": { + "message": "Your flight controller's firmware is too old to support this tab, or the Blackbox feature is disabled on the Configuration tab." + }, + "blackboxConfiguration": { + "message": "Blackbox configuration" + }, + "blackboxButtonSave": { + "message": "Save and reboot" + }, + + "serialLoggingSupportedNote": { + "message": "You can log to an external logging device (such as an OpenLog or compatible clone) by using a serial port. Configure the port on the Ports tab." + }, + "sdcardNote": { + "message": "Flight logs can be recorded to your flight controller's onboard SD card slot." + }, + + "dataflashNote": { + "message": "Flight logs can be recorded to your flight controller's onboard dataflash chip." + }, + "dataflashNotPresentNote": { "message": "Your flight controller does not have a compatible dataflash chip available." }, "dataflashFirmwareUpgradeRequired": { diff --git a/images/icons/cf_icon_sdcard.svg b/images/icons/cf_icon_sdcard.svg new file mode 100644 index 00000000..c429edd8 --- /dev/null +++ b/images/icons/cf_icon_sdcard.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/js/data_storage.js b/js/data_storage.js index 2d75ed18..b3a7f821 100755 --- a/js/data_storage.js +++ b/js/data_storage.js @@ -174,7 +174,23 @@ var _3D = { var DATAFLASH = { ready: false, + supported: false, sectors: 0, totalSize: 0, usedSize: 0 }; + +var SDCARD = { + supported: false, + state: 0, + filesystemLastError: 0, + freeSizeKB: 0, + totalSizeKB: 0, +}; + +var BLACKBOX = { + supported: false, + blackboxDevice: 0, + blackboxRateNum: 1, + blackboxRateDenom: 1 +}; diff --git a/js/gui.js b/js/gui.js index 466b35a1..b3b955d2 100644 --- a/js/gui.js +++ b/js/gui.js @@ -25,7 +25,7 @@ var GUI_control = function () { 'gps', 'led_strip', 'logging', - 'dataflash', + 'onboard_logging', 'modes', 'motors', 'pid_tuning', diff --git a/js/msp.js b/js/msp.js index cfde7dc0..5c42ffed 100644 --- a/js/msp.js +++ b/js/msp.js @@ -29,6 +29,10 @@ var MSP_codes = { MSP_DATAFLASH_ERASE: 72, MSP_LOOP_TIME: 73, MSP_SET_LOOP_TIME: 74, + + MSP_SDCARD_SUMMARY: 79, + MSP_BLACKBOX_CONFIG: 80, + MSP_SET_BLACKBOX_CONFIG: 81, // Multiwii MSP commands MSP_IDENT: 100, @@ -811,13 +815,17 @@ var MSP = { break; case MSP_codes.MSP_DATAFLASH_SUMMARY: if (data.byteLength >= 13) { - DATAFLASH.ready = (data.getUint8(0) & 1) != 0; + var + flags = data.getUint8(0); + DATAFLASH.ready = (flags & 1) != 0; + DATAFLASH.supported = (flags & 2) != 0 || DATAFLASH.ready; DATAFLASH.sectors = data.getUint32(1, 1); DATAFLASH.totalSize = data.getUint32(5, 1); DATAFLASH.usedSize = data.getUint32(9, 1); } else { // Firmware version too old to support MSP_DATAFLASH_SUMMARY DATAFLASH.ready = false; + DATAFLASH.supported = false; DATAFLASH.sectors = 0; DATAFLASH.totalSize = 0; DATAFLASH.usedSize = 0; @@ -829,6 +837,24 @@ var MSP = { case MSP_codes.MSP_DATAFLASH_ERASE: console.log("Data flash erase begun..."); break; + case MSP_codes.MSP_SDCARD_SUMMARY: + var flags = data.getUint8(0); + + SDCARD.supported = (flags & 0x01) != 0; + SDCARD.state = data.getUint8(1); + SDCARD.filesystemLastError = data.getUint8(2); + SDCARD.freeSizeKB = data.getUint32(3, 1); + SDCARD.totalSizeKB = data.getUint32(7, 1); + break; + case MSP_codes.MSP_BLACKBOX_CONFIG: + BLACKBOX.supported = (data.getUint8(0) & 1) != 0; + BLACKBOX.blackboxDevice = data.getUint8(1); + BLACKBOX.blackboxRateNum = data.getUint8(2); + BLACKBOX.blackboxRateDenom = data.getUint8(3); + break; + case MSP_codes.MSP_SET_BLACKBOX_CONFIG: + console.log("Blackbox config saved"); + break; case MSP_codes.MSP_SET_MODE_RANGE: console.log('Mode range saved'); break; @@ -1176,6 +1202,19 @@ MSP.setRawRx = function(channels) { MSP.send_message(MSP_codes.MSP_SET_RAW_RC, buffer, false); } +MSP.sendBlackboxConfiguration = function(onDataCallback) { + var + message = [ + BLACKBOX.blackboxDevice & 0xFF, + BLACKBOX.blackboxRateNum & 0xFF, + BLACKBOX.blackboxRateDenom & 0xFF + ]; + + MSP.send_message(MSP_codes.MSP_SET_BLACKBOX_CONFIG, message, false, function(response) { + onDataCallback(); + }); +} + /** * Send a request to read a block of data from the dataflash at the given address and pass that address and a dataview * of the returned data to the given callback (or null for the data if an error occured). @@ -1438,3 +1477,9 @@ MSP.serialPortFunctionsToMask = function(functions) { } return mask; } + +MSP.SDCARD_STATE_NOT_PRESENT = 0; +MSP.SDCARD_STATE_FATAL = 1; +MSP.SDCARD_STATE_CARD_INIT = 2; +MSP.SDCARD_STATE_FS_INIT = 3; +MSP.SDCARD_STATE_READY = 4; diff --git a/main.html b/main.html index 88320b86..e1136e5b 100755 --- a/main.html +++ b/main.html @@ -1,4 +1,4 @@ - + @@ -21,7 +21,7 @@ - + @@ -73,7 +73,7 @@ - + @@ -188,9 +188,9 @@ title="LED Strip">
  • -
  • -
  • +
  • +
  • + + + + + + + + + + + + + diff --git a/images/icons/cf_icon_transponder_white.svg b/images/icons/cf_icon_transponder_white.svg new file mode 100644 index 00000000..a58f74b1 --- /dev/null +++ b/images/icons/cf_icon_transponder_white.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + diff --git a/js/fc.js b/js/fc.js index 4189d326..089403be 100644 --- a/js/fc.js +++ b/js/fc.js @@ -29,6 +29,7 @@ var _3D; var DATAFLASH; var SDCARD; var BLACKBOX; +var TRANSPONDER; var RC_deadband; var SENSOR_ALIGNMENT; var RX_CONFIG; @@ -217,6 +218,11 @@ var FC = { blackboxRateDenom: 1 }; + TRANSPONDER = { + supported: false, + data: [] + }; + RC_deadband = { deadband: 0, yaw_deadband: 0, diff --git a/js/gui.js b/js/gui.js index 078510bc..84972d4a 100644 --- a/js/gui.js +++ b/js/gui.js @@ -19,6 +19,7 @@ var GUI_control = function () { ]; this.defaultAllowedTabsWhenConnected = [ 'failsafe', + 'transponder', 'adjustments', 'auxiliary', 'cli', @@ -275,10 +276,12 @@ GUI_control.prototype.content_ready = function (callback) { $(elem).removeClass('togglemedium'); }); - // Build link to in-use CF version documentation - var documentationButton = $('div#content #button-documentation'); - documentationButton.html("Documentation for "+CONFIG.flightControllerVersion); - documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion)); + if (CONFIGURATOR.connectionValid) { + // Build link to in-use CF version documentation + var documentationButton = $('div#content #button-documentation'); + documentationButton.html("Documentation for " + CONFIG.flightControllerVersion); + documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion)); + } // loading tooltip jQuery(document).ready(function($) { diff --git a/js/msp.js b/js/msp.js index c41415a4..fd3fb8d9 100644 --- a/js/msp.js +++ b/js/msp.js @@ -38,6 +38,8 @@ var MSP_codes = { MSP_SDCARD_SUMMARY: 79, MSP_BLACKBOX_CONFIG: 80, MSP_SET_BLACKBOX_CONFIG: 81, + MSP_TRANSPONDER_CONFIG: 82, + MSP_SET_TRANSPONDER_CONFIG: 83, // Multiwii MSP commands MSP_IDENT: 100, @@ -932,6 +934,18 @@ var MSP = { case MSP_codes.MSP_SET_BLACKBOX_CONFIG: console.log("Blackbox config saved"); break; + case MSP_codes.MSP_TRANSPONDER_CONFIG: + var offset = 0; + TRANSPONDER.supported = (data.getUint8(offset++) & 1) != 0; + TRANSPONDER.data = []; + var bytesRemaining = data.byteLength - offset; + for (var i = 0; i < bytesRemaining; i++) { + TRANSPONDER.data.push(data.getUint8(offset++)); + } + break; + case MSP_codes.MSP_SET_TRANSPONDER_CONFIG: + console.log("Transponder config saved"); + break; case MSP_codes.MSP_SET_MODE_RANGE: console.log('Mode range saved'); break; @@ -1242,6 +1256,12 @@ MSP.crunch = function (code) { } break; + case MSP_codes.MSP_SET_TRANSPONDER_CONFIG: + for (var i = 0; i < TRANSPONDER.data.length; i++) { + buffer.push(TRANSPONDER.data[i]); + } + break; + case MSP_codes.MSP_SET_CHANNEL_FORWARDING: for (var i = 0; i < SERVO_CONFIG.length; i++) { var out = SERVO_CONFIG[i].indexOfChannelToForward; diff --git a/main.css b/main.css index 5d90c575..a1944fd9 100644 --- a/main.css +++ b/main.css @@ -784,6 +784,19 @@ li.active .ic_flasher { background-image: url(images/icons/cf_icon_flasher_white.svg); } +.ic_transponder { + background-image: url(images/icons/cf_icon_transponder_grey.svg); +} + +.ic_transponder:hover { + background-image: url(images/icons/cf_icon_transponder_white.svg); +} + +li.active .ic_transponder { + background-image: url(images/icons/cf_icon_transponder_white.svg); +} + + /* SPARE Tab-Icons */ .ic_failsafe { background-image: url(images/icons/cf_icon_failsafe_grey.svg); diff --git a/main.html b/main.html index 567735ad..14783c82 100755 --- a/main.html +++ b/main.html @@ -26,6 +26,7 @@ + @@ -78,6 +79,7 @@ + @@ -191,7 +193,7 @@
  • -
  • Failsafe
  • +
  • @@ -199,6 +201,7 @@
  • +
  • diff --git a/main.js b/main.js index 9a42bdd9..6c734a94 100644 --- a/main.js +++ b/main.js @@ -136,6 +136,9 @@ $(document).ready(function () { case 'failsafe': TABS.failsafe.initialize(content_ready); break; + case 'transponder': + TABS.transponder.initialize(content_ready); + break; case 'setup': TABS.setup.initialize(content_ready); break; diff --git a/tabs/configuration.js b/tabs/configuration.js index 63b1d01d..612139c7 100644 --- a/tabs/configuration.js +++ b/tabs/configuration.js @@ -89,9 +89,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) { } function process_html() { - // translate to user-selected language - localize(); - + var mixer_list_e = $('select.mixerList'); for (var i = 0; i < mixerList.length; i++) { mixer_list_e.append(''); @@ -110,37 +108,37 @@ TABS.configuration.initialize = function (callback, scrollPosition) { // generate features var features = [ - {bit: 0, group: 'rxMode', mode: 'group', name: 'RX_PPM', description: 'PPM RX input'}, - {bit: 1, group: 'batteryVoltage', name: 'VBAT', description: 'Battery voltage monitoring'}, - {bit: 2, group: 'other', name: 'INFLIGHT_ACC_CAL', description: 'In-flight level calibration'}, - {bit: 3, group: 'rxMode', mode: 'group', name: 'RX_SERIAL', description: 'Serial-based receiver (SPEKSAT, SBUS, SUMD)'}, - {bit: 4, group: 'esc', name: 'MOTOR_STOP', description: 'Don\'t spin the motors when armed'}, - {bit: 5, group: 'other', name: 'SERVO_TILT', description: 'Servo gimbal'}, - {bit: 6, group: 'other', name: 'SOFTSERIAL', description: 'Enable CPU based serial ports'}, - {bit: 7, group: 'gps', name: 'GPS', description: 'Configure port scenario first'}, - {bit: 8, group: 'rxFailsafe', name: 'FAILSAFE', description: 'Failsafe settings on RX signal loss'}, - {bit: 9, group: 'other', name: 'SONAR', description: 'Sonar'}, - {bit: 10, group: 'other', name: 'TELEMETRY', description: 'Telemetry output'}, - {bit: 11, group: 'batteryCurrent', name: 'CURRENT_METER', description: 'Battery current monitoring'}, - {bit: 12, group: 'other', name: '3D', description: '3D mode (for use with reversible ESCs)'}, - {bit: 13, group: 'rxMode', mode: 'group', name: 'RX_PARALLEL_PWM', description: 'PWM RX input'}, - {bit: 14, group: 'rxMode', mode: 'group', name: 'RX_MSP', description: 'MSP RX input'}, - {bit: 15, group: 'rssi', name: 'RSSI_ADC', description: 'Analog RSSI input'}, - {bit: 16, group: 'other', name: 'LED_STRIP', description: 'Addressable RGB LED strip support'}, - {bit: 17, group: 'other', name: 'DISPLAY', description: 'OLED Screen Display'}, - {bit: 18, group: 'esc', name: 'ONESHOT125', description: 'ONESHOT ESC support (disconnect ESCs, remove props)'}, - {bit: 19, group: 'other', name: 'BLACKBOX', description: 'Blackbox flight data recorder'} + {bit: 0, group: 'rxMode', mode: 'group', name: 'RX_PPM'}, + {bit: 1, group: 'batteryVoltage', name: 'VBAT'}, + {bit: 2, group: 'other', name: 'INFLIGHT_ACC_CAL'}, + {bit: 3, group: 'rxMode', mode: 'group', name: 'RX_SERIAL'}, + {bit: 4, group: 'esc', name: 'MOTOR_STOP'}, + {bit: 5, group: 'other', name: 'SERVO_TILT'}, + {bit: 6, group: 'other', name: 'SOFTSERIAL', haveTip: true}, + {bit: 7, group: 'gps', name: 'GPS', haveTip: true}, + {bit: 8, group: 'rxFailsafe', name: 'FAILSAFE'}, + {bit: 9, group: 'other', name: 'SONAR'}, + {bit: 10, group: 'other', name: 'TELEMETRY'}, + {bit: 11, group: 'batteryCurrent', name: 'CURRENT_METER'}, + {bit: 12, group: 'other', name: '3D'}, + {bit: 13, group: 'rxMode', mode: 'group', name: 'RX_PARALLEL_PWM'}, + {bit: 14, group: 'rxMode', mode: 'group', name: 'RX_MSP'}, + {bit: 15, group: 'rssi', name: 'RSSI_ADC'}, + {bit: 16, group: 'other', name: 'LED_STRIP'}, + {bit: 17, group: 'other', name: 'DISPLAY'}, + {bit: 18, group: 'esc', name: 'ONESHOT125', haveTip: true}, + {bit: 19, group: 'other', name: 'BLACKBOX', haveTip: true} ]; if (semver.gte(CONFIG.apiVersion, "1.12.0")) { features.push( - {bit: 20, group: 'other', name: 'CHANNEL_FORWARDING', description: 'Forward aux channels to servo outputs'} + {bit: 20, group: 'other', name: 'CHANNEL_FORWARDING'} ); } - if (semver.gte(CONFIG.apiVersion, "1.15.0")) { + if (semver.gte(CONFIG.apiVersion, "1.16.0")) { features.push( - {bit: 21, group: 'other', name: 'TRANSPONDER', description: 'Transponder'} + {bit: 21, group: 'other', name: 'TRANSPONDER', haveTip: true} ); } @@ -159,6 +157,11 @@ TABS.configuration.initialize = function (callback, scrollPosition) { for (var i = 0; i < features.length; i++) { var row_e; + var feature_tip_html = ''; + if (features[i].haveTip) { + feature_tip_html = '
    '; + } + if (features[i].mode === 'group') { row_e = $('' + features[i].name - + '' - + features[i].description - + ''); + + '' + + feature_tip_html + ''); radioGroups.push(features[i].group); } else { row_e = $('' + features[i].name - + '' - + features[i].description - + ''); + + '' + + feature_tip_html + ''); var feature_e = row_e.find('input.feature'); @@ -203,6 +204,9 @@ TABS.configuration.initialize = function (callback, scrollPosition) { } }); } + + // translate to user-selected language + localize(); for (var i = 0; i < radioGroups.length; i++) { var group = radioGroups[i]; diff --git a/tabs/transponder.css b/tabs/transponder.css new file mode 100644 index 00000000..7465848e --- /dev/null +++ b/tabs/transponder.css @@ -0,0 +1,75 @@ +.tab-transponder .spacer_box { + padding-bottom: 10px; + float: left; + width: calc(100% - 20px); +} + +.tab-transponder .text input { + width: 100px; + padding-left: 3px; + height: 20px; + line-height: 20px; + text-align: left; + border: 1px solid silver; + border-radius: 3px; + margin-right: 11px; + font-size: 12px; + font-weight: normal; +} + +.tab-transponder .text .disabled { + width: 43px; + padding: 0px 5px; + background-color: #ececec; +} + +.tab-transponder .text span { + margin-left: 0px; +} + +.tab-transponder input { + float: left; +} + +.tab-transponder span { + margin: 0px; +} + +.tab-transponder .text + { + margin-bottom: 5px; + clear: left; + padding-bottom: 5px; + border-bottom: 1px solid #ddd; + width: 100%; + float: left; +} + +.tab-transponder .text:last-child { + border-bottom: none; + padding-bottom: 0px; + margin-bottom: 0px; +} + +.tab-transponder .textspacer { + float: left; + width: 115px; + height: 21px; +} + +.tab-transponder .gui_box span { + font-style: normal; + font-family: 'open_sansregular', Arial; + line-height: 19px; + color: #4F4F4F; + font-size: 11px; +} + +.require-transponder-supported, +.tab-transponder.transponder-supported .require-transponder-unsupported { + display: none; +} + +.tab-transponder.transponder-supported .require-transponder-supported { + display: block; +} diff --git a/tabs/transponder.html b/tabs/transponder.html new file mode 100644 index 00000000..7dd70a72 --- /dev/null +++ b/tabs/transponder.html @@ -0,0 +1,52 @@ +
    +
    +
    Transponder
    +
    + +
    + +
    +
    +

    +
    +
    + +
    + +
    +
    +

    +
    +
    + +
    +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    + +
    +
    +

    +
    +
    + +
    +
    +
    + +
    +
    +
    \ No newline at end of file diff --git a/tabs/transponder.js b/tabs/transponder.js new file mode 100644 index 00000000..c8b1d00b --- /dev/null +++ b/tabs/transponder.js @@ -0,0 +1,105 @@ +'use strict'; + +TABS.transponder = { + available: false +}; + +TABS.transponder.initialize = function (callback, scrollPosition) { + var self = this; + + if (GUI.active_tab != 'transponder') { + GUI.active_tab = 'transponder'; + googleAnalytics.sendAppView('Transponder'); + } + + // transponder supported added in MSP API Version 1.16.0 + TABS.transponder.available = semver.gte(CONFIG.apiVersion, "1.16.0"); + + if (!TABS.transponder.available) { + load_html(); + return; + } + + function load_html() { + $('#content').load("./tabs/transponder.html", process_html); + } + + // get the transponder data and a flag to see if transponder support is enabled on the FC + MSP.send_message(MSP_codes.MSP_TRANSPONDER_CONFIG, false, false, load_html); + + // Convert a hex string to a byte array + function hexToBytes(hex) { + for (var bytes = [], c = 0; c < hex.length; c += 2) + bytes.push(~parseInt(hex.substr(c, 2), 16)); + return bytes; + } + + function pad(n, width) { + n = n + ''; + return n.length >= width ? n : new Array(width - n.length + 1).join('0') + n; + } + + // Convert a byte array to a hex string + function bytesToHex(bytes) { + for (var hex = [], i = 0; i < bytes.length; i++) { + hex.push(pad(((~bytes[i]) & 0xFF).toString(16),2)); + } + return hex.join("").toUpperCase(); + } + function process_html() { + // translate to user-selected language + localize(); + + $(".tab-transponder") + .toggleClass("transponder-supported", TABS.transponder.available && TRANSPONDER.supported); + + if (TABS.transponder.available) { + + var data = bytesToHex(TRANSPONDER.data); + + $('input[name="data"]').val(data); + $('input[name="data"]').prop('maxLength', data.length); + + $('a.save').click(function () { + + + // gather data that doesn't have automatic change event bound + + var dataString = $('input[name="data"]').val(); + var expectedLength = TRANSPONDER.data.length; + var hexRegExp = new RegExp('[0-9a-fA-F]{' + (expectedLength * 2) + '}', 'gi'); + if (!dataString.match(hexRegExp)) { + GUI.log(chrome.i18n.getMessage('transponderDataInvalid')); + return; + } + + TRANSPONDER.data = hexToBytes(dataString); + + + // + // send data to FC + // + function save_transponder_config() { + MSP.send_message(MSP_codes.MSP_SET_TRANSPONDER_CONFIG, MSP.crunch(MSP_codes.MSP_SET_TRANSPONDER_CONFIG), false, save_to_eeprom); + } + function save_to_eeprom() { + MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () { + GUI.log(chrome.i18n.getMessage('transponderEepromSaved')); + }); + } + + save_transponder_config(); + }); + } + // status data pulled via separate timer with static speed + GUI.interval_add('status_pull', function status_pull() { + MSP.send_message(MSP_codes.MSP_STATUS); + }, 250, true); + + GUI.content_ready(callback); + } +}; + +TABS.transponder.cleanup = function (callback) { + if (callback) callback(); +}; From 509adcb6fff8c31d9150a1eb82aeead7f3c97d59 Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Mon, 11 Jan 2016 15:37:36 +0100 Subject: [PATCH 08/13] Update servo angles to match https://github.com/cleanflight/cleanflight/pull/1573 --- js/backup_restore.js | 4 ++-- js/msp.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/backup_restore.js b/js/backup_restore.js index db1667aa..717e67ef 100644 --- a/js/backup_restore.js +++ b/js/backup_restore.js @@ -478,8 +478,8 @@ function configuration_restore(callback) { for (var i = 0; i < configuration.profiles[profileIndex].ServoConfig.length; i++) { var servoConfig = profiles[profileIndex].ServoConfig; - servoConfig[i].angleAtMin = 90; - servoConfig[i].angleAtMax = 90; + servoConfig[i].angleAtMin = 45; + servoConfig[i].angleAtMax = 45; servoConfig[i].reversedInputSources = 0; // set the rate to 0 if an invalid value is detected. diff --git a/js/msp.js b/js/msp.js index fd3fb8d9..26628092 100644 --- a/js/msp.js +++ b/js/msp.js @@ -512,8 +512,8 @@ var MSP = { 'max': data.getInt16(i + 2, 1), 'middle': data.getInt16(i + 4, 1), 'rate': data.getInt8(i + 6), - 'angleAtMin': 90, - 'angleAtMax': 90, + 'angleAtMin': 45, + 'angleAtMax': 45, 'indexOfChannelToForward': undefined, 'reversedInputSources': 0 }; From 2044fe879c2df872eab734efcda2582e11f057dd Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Tue, 12 Jan 2016 11:24:53 +0100 Subject: [PATCH 09/13] Fix for https://github.com/cleanflight/cleanflight/issues/1551 --- js/backup_restore.js | 10 ++++++++++ tabs/configuration.js | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/js/backup_restore.js b/js/backup_restore.js index 717e67ef..fb0cd6c4 100644 --- a/js/backup_restore.js +++ b/js/backup_restore.js @@ -594,6 +594,16 @@ function configuration_restore(callback) { appliedMigrationsCount++; } + if (compareVersions(migratedVersion, '1.2.0')) { + // old version of the configurator incorrectly had a 'disabled' option for GPS SBAS mode. + if (MISC.gps_ubx_sbas < 0) { + MISC.gps_ubx_sbas = 0; + } + migratedVersion = '1.2.0'; + + appliedMigrationsCount++; + } + if (appliedMigrationsCount > 0) { GUI.log(chrome.i18n.getMessage('configMigrationSuccessful', [appliedMigrationsCount])); } diff --git a/tabs/configuration.js b/tabs/configuration.js index 612139c7..c8fed2a8 100644 --- a/tabs/configuration.js +++ b/tabs/configuration.js @@ -266,7 +266,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) { ]; var gpsSbas = [ - 'Disabled', 'Auto-detect', 'European EGNOS', 'North American WAAS', @@ -305,7 +304,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) { var gps_ubx_sbas_e = $('select.gps_ubx_sbas'); for (var i = 0; i < gpsSbas.length; i++) { - gps_ubx_sbas_e.append(''); + gps_ubx_sbas_e.append(''); } gps_ubx_sbas_e.change(function () { From 2f6be0650f3ed7c6324e8041c3165783530c5ad9 Mon Sep 17 00:00:00 2001 From: Michael Corcoran Date: Wed, 23 Dec 2015 23:59:38 +1300 Subject: [PATCH 10/13] Serial: Attempt recovery of break condition --- js/serial.js | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/js/serial.js b/js/serial.js index 5f7c2824..bbb92de5 100644 --- a/js/serial.js +++ b/js/serial.js @@ -69,10 +69,30 @@ var serial = { } break; case 'break': - // This occurs on F1 boards with old firmware. - if (GUI.connected_to || GUI.connecting_to) { - $('a.connect').click(); - } + // This occurs on F1 boards with old firmware during reboot + // wait 50 ms and attempt recovery + setTimeout(function() { + chrome.serial.setPaused(info.connectionId, false, function() { + self.getInfo(function (info) { + if (info.paused) { + // assume unrecoverable, disconnect + console.log('SERIAL: Connection did not recover from break condition, disconnecting'); + GUI.log('Unrecoverable failure of serial connection, disconnecting...'); + googleAnalytics.sendException('Serial: break condition - unrecoverable', false); + + if (GUI.connected_to || GUI.connecting_to) { + $('a.connect').click(); + } else { + self.disconnect(); + } + } + else { + console.log('SERIAL: Connection recovered from break condition'); + googleAnalytics.sendException('Serial: break condition - recovered', false); + } + }); + }); + }, 50); break; case 'timeout': // TODO From ab7ad4b07dea7ca90d3c78bbf151fc7b9cb3b5ed Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Tue, 12 Jan 2016 19:35:13 +0100 Subject: [PATCH 11/13] Handle 'overrun' conditions the same way as 'break' conditions. --- js/serial.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/js/serial.js b/js/serial.js index bbb92de5..03b0adf5 100644 --- a/js/serial.js +++ b/js/serial.js @@ -68,17 +68,20 @@ var serial = { }); } break; + case 'break': // This occurs on F1 boards with old firmware during reboot + case 'overrun': // wait 50 ms and attempt recovery + self.error = info.error; setTimeout(function() { chrome.serial.setPaused(info.connectionId, false, function() { self.getInfo(function (info) { if (info.paused) { // assume unrecoverable, disconnect - console.log('SERIAL: Connection did not recover from break condition, disconnecting'); + console.log('SERIAL: Connection did not recover from ' + self.error + ' condition, disconnecting'); GUI.log('Unrecoverable failure of serial connection, disconnecting...'); - googleAnalytics.sendException('Serial: break condition - unrecoverable', false); + googleAnalytics.sendException('Serial: ' + self.error + ' - unrecoverable', false); if (GUI.connected_to || GUI.connecting_to) { $('a.connect').click(); @@ -87,19 +90,22 @@ var serial = { } } else { - console.log('SERIAL: Connection recovered from break condition'); - googleAnalytics.sendException('Serial: break condition - recovered', false); + console.log('SERIAL: Connection recovered from ' + self.error + ' condition'); + googleAnalytics.sendException('Serial: ' + self.error + ' - recovered', false); } }); }); }, 50); break; + case 'timeout': // TODO break; + case 'device_lost': // TODO break; + case 'disconnected': // TODO break; From cbe862d0184bad684171f01cf2dcacb49650fa37 Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Tue, 12 Jan 2016 20:19:23 +0100 Subject: [PATCH 12/13] Prevent users for creating mode ranges and adjustment activation ranges that are too small. --- tabs/adjustments.js | 1 + tabs/auxiliary.js | 1 + 2 files changed, 2 insertions(+) diff --git a/tabs/adjustments.js b/tabs/adjustments.js index 0e5fb8d2..c915b8b7 100644 --- a/tabs/adjustments.js +++ b/tabs/adjustments.js @@ -117,6 +117,7 @@ TABS.adjustments.initialize = function (callback) { $(rangeElement).find('.channel-slider').noUiSlider({ start: rangeValues, behaviour: 'snap-drag', + margin: 50, step: 25, connect: true, range: channel_range, diff --git a/tabs/auxiliary.js b/tabs/auxiliary.js index 33641154..f5c4bdaf 100644 --- a/tabs/auxiliary.js +++ b/tabs/auxiliary.js @@ -80,6 +80,7 @@ TABS.auxiliary.initialize = function (callback) { $(rangeElement).find('.channel-slider').noUiSlider({ start: rangeValues, behaviour: 'snap-drag', + margin: 50, step: 25, connect: true, range: channel_range, From 6009a3db56067ac8fda6dce905cfef792b0ad784 Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Thu, 14 Jan 2016 02:03:40 +0100 Subject: [PATCH 13/13] Fix led strip missing 'var' keyword. --- tabs/led_strip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tabs/led_strip.js b/tabs/led_strip.js index aa87bda9..a29c77a7 100644 --- a/tabs/led_strip.js +++ b/tabs/led_strip.js @@ -46,7 +46,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) { // Build Grid var theHTML = []; var theHTMLlength = 0; - for (i=0; i<256; i++) { + for (var i = 0; i < 256; i++) { theHTML[theHTMLlength++] = ('
    UD
    '); } $('.mainGrid').html(theHTML.join(''));