From be7086017229367175f27e6c99ad5ead49cd4225 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Sun, 6 Aug 2017 13:12:28 +0100 Subject: [PATCH] Add arming disable flags to setup tab --- _locales/en/messages.json | 6 ++++++ js/fc.js | 1 + js/msp/MSPHelper.js | 12 ++++++++++++ tabs/setup.html | 4 ++++ tabs/setup.js | 9 ++++++++- 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index f81e54b5..27598782 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -436,6 +436,12 @@ "initialSetupRSSIValue": { "message": "$1 %" }, + "initialSetupArmingDisableFlags": { + "message": "Arming Disable Flags:" + }, + "initialSetupArmingAllowed": { + "message": "Arming Allowed" + }, "initialSetupGPSHead": { "message": "GPS" }, diff --git a/js/fc.js b/js/fc.js index 820b7f6b..400c521f 100644 --- a/js/fc.js +++ b/js/fc.js @@ -78,6 +78,7 @@ var FC = { numProfiles: 3, rateProfile: 0, boardType: 0, + armingDisableFlags: 0, }; BF_CONFIG = { diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index a50bdc2c..a61647ad 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -83,6 +83,18 @@ MspHelper.prototype.process_data = function(dataHandler) { CONFIG.numProfiles = data.readU8(); CONFIG.rateProfile = data.readU8(); + if (semver.gte(CONFIG.apiVersion, "1.36.0")) { + // Read flight mode flags + var byteCount = data.readU8(); + for (var i = 0; i < byteCount; i++) { + data.readU8(); + } + + // Read arming disable flags + data.readU8(); // Flag count + CONFIG.armingDisableFlags = data.readU32(); + } + TABS.pid_tuning.checkUpdateProfile(true); } diff --git a/tabs/setup.html b/tabs/setup.html index 2152c920..a757e0a0 100644 --- a/tabs/setup.html +++ b/tabs/setup.html @@ -95,6 +95,10 @@
+ + + + diff --git a/tabs/setup.js b/tabs/setup.js index e48924d3..bed3c085 100755 --- a/tabs/setup.js +++ b/tabs/setup.js @@ -156,6 +156,7 @@ TABS.setup.initialize = function (callback) { bat_mah_drawn_e = $('.bat-mah-drawn'), bat_mah_drawing_e = $('.bat-mah-drawing'), rssi_e = $('.rssi'), + arming_disable_flags_e = $('.arming-disable-flags'), gpsFix_e = $('.gpsFix'), gpsSats_e = $('.gpsSats'), gpsLat_e = $('.gpsLat'), @@ -164,8 +165,14 @@ TABS.setup.initialize = function (callback) { pitch_e = $('dd.pitch'), heading_e = $('dd.heading'); + if (semver.lt(CONFIG.apiVersion, "1.36.0")) { + arming_disable_flags_e.hide(); + } + function get_slow_data() { - MSP.send_message(MSPCodes.MSP_STATUS); + MSP.send_message(MSPCodes.MSP_STATUS, false, false, function() { + arming_disable_flags_e.text(CONFIG.armingDisableFlags == 0 ? chrome.i18n.getMessage('initialSetupArmingAllowed') : CONFIG.armingDisableFlags.toString(2)); + }); MSP.send_message(MSPCodes.MSP_ANALOG, false, false, function () { bat_voltage_e.text(chrome.i18n.getMessage('initialSetupBatteryValue', [ANALOG.voltage]));
0
0 V