From a987de68b95fd13639a4b5d72002c3e2395cec12 Mon Sep 17 00:00:00 2001 From: mikeller Date: Wed, 17 Aug 2016 23:58:07 +1200 Subject: [PATCH] Moved FAILSAFE feature switch into configuration tab, made failsafe tab hidden if FAILSAFE is disabled. Added warning about using failsafe. --- _locales/en/messages.json | 4 ++-- js/Features.js | 2 +- main.js | 6 ++++++ tabs/failsafe.css | 31 ------------------------------- tabs/failsafe.html | 10 ---------- tabs/failsafe.js | 20 -------------------- 6 files changed, 9 insertions(+), 64 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 33de7e27..b4c5cd90 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -544,10 +544,10 @@ "message": "On Screen Display" }, "featureFAILSAFE": { - "message": "Apply failsafe on RX signal loss" + "message": "Override failsafe behaviour on RX signal loss" }, "featureFAILSAFETip": { - "message": "Note: When Stage 2 is DISABLED, the fallback setting Auto is used instead of the user settings for all flightchannels (Roll, Pitch, Yaw and Throttle)." + "message": "Warning: Use this only if you know what you are doing. The default behaviour on RX signal loss (deactivate all motors to bring craft to the ground) is the safest option in most situations." }, "configurationFeatureEnabled": { "message": "Enabled" diff --git a/js/Features.js b/js/Features.js index 1ee7db07..94155d93 100644 --- a/js/Features.js +++ b/js/Features.js @@ -12,7 +12,7 @@ var Features = function (config) { {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', haveTip: true}, + {bit: 8, group: 'other', name: 'FAILSAFE', haveTip: true}, {bit: 9, group: 'other', name: 'SONAR'}, {bit: 10, group: 'other', name: 'TELEMETRY'}, {bit: 11, group: 'batteryCurrent', name: 'CURRENT_METER'}, diff --git a/main.js b/main.js index e1811dea..0f85ae9f 100644 --- a/main.js +++ b/main.js @@ -406,6 +406,12 @@ function updateTabList(features) { $('#tabs ul.mode-connected li.tab_gps').hide(); } + if (features.isEnabled('FAILSAFE')) { + $('#tabs ul.mode-connected li.tab_failsafe').show(); + } else { + $('#tabs ul.mode-connected li.tab_failsafe').hide(); + } + if (features.isEnabled('LED_STRIP')) { $('#tabs ul.mode-connected li.tab_led_strip').show(); } else { diff --git a/tabs/failsafe.css b/tabs/failsafe.css index 27ea6fd9..f9e59c42 100644 --- a/tabs/failsafe.css +++ b/tabs/failsafe.css @@ -252,37 +252,6 @@ height: 90px; } -.tab-failsafe .featuresNew { - width: 100%; -} - -.tab-failsafe .featuresNew tr { - width: 100%; - border-bottom: 1px solid #ddd; - float: left; - padding: 0px; - padding-bottom: 6px; - margin-bottom: 3px; -} - -.tab-failsafe .featuresNew td:first-child { - width: 52px; -} - -.tab-failsafe .featuresNew td:last-child { - width: calc(100% - 125px); - margin-right: 0px; -} - -.tab-failsafe .featuresNew td { - float: left; - margin-right: 10px; -} - -.tab-failsafe .featuresNew .helpicon { - margin-right: -2px; -} - .tab-failsafe table { width: 100%; } diff --git a/tabs/failsafe.html b/tabs/failsafe.html index 55e5a8c1..6c568664 100644 --- a/tabs/failsafe.html +++ b/tabs/failsafe.html @@ -22,11 +22,6 @@
- - - - -
- - - - -
diff --git a/tabs/failsafe.js b/tabs/failsafe.js index 28a9fcce..a7fdb58c 100644 --- a/tabs/failsafe.js +++ b/tabs/failsafe.js @@ -63,15 +63,6 @@ TABS.failsafe.initialize = function (callback, scrollPosition) { } function process_html() { - // fill stage 2 fields - function toggleStage2(doShow) { - if (doShow) { - $('div.stage2').show(); - } else { - $('div.stage2').hide(); - } - } - // Conditionally hide the old or the new control pane's if(apiVersionGte1_15_0) { var oldPane = $('div.oldpane'); @@ -208,14 +199,6 @@ TABS.failsafe.initialize = function (callback, scrollPosition) { channel_mode_array[i].change(); } - BF_CONFIG.features.generateElements($('.tab-failsafe .featuresNew')); - - var failsafeFeature = $('input[name="FAILSAFE"]'); - failsafeFeature.change(function () { - toggleStage2($(this).is(':checked')); - }); - toggleStage2(BF_CONFIG.features.isEnabled('FAILSAFE')); - $('input[name="failsafe_throttle"]').val(FAILSAFE_CONFIG.failsafe_throttle); $('input[name="failsafe_off_delay"]').val(FAILSAFE_CONFIG.failsafe_off_delay); $('input[name="failsafe_throttle_low_delay"]').val(FAILSAFE_CONFIG.failsafe_throttle_low_delay); @@ -261,7 +244,6 @@ TABS.failsafe.initialize = function (callback, scrollPosition) { $('input[name="failsafe_kill_switch"]').prop('checked', FAILSAFE_CONFIG.failsafe_kill_switch); } else { - BF_CONFIG.features.generateElements($('.tab-failsafe .featuresOld')); // fill failsafe_throttle field (pre API 1.15.0) $('input[name="failsafe_throttle_old"]').val(MISC.failsafe_throttle); } @@ -269,8 +251,6 @@ TABS.failsafe.initialize = function (callback, scrollPosition) { $('a.save').click(function () { // gather data that doesn't have automatic change event bound - BF_CONFIG.features.updateData($('input[name="FAILSAFE"]')); - if(apiVersionGte1_15_0) { RX_CONFIG.rx_min_usec = parseInt($('input[name="rx_min_usec"]').val()); RX_CONFIG.rx_max_usec = parseInt($('input[name="rx_max_usec"]').val());