Merge pull request #229 from mikeller/hide_failsafe_tab_if_disabled

Moved FAILSAFE feature switch into configuration tab, made failsafe tab hidden if FAILSAFE is disabled. Added warning about using failsafe.
10.3.x-maintenance
Anton Stålheim 2016-08-17 21:57:19 +02:00 committed by GitHub
commit 6275b8b462
6 changed files with 9 additions and 64 deletions

View File

@ -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": "<strong>Note:</strong> When Stage 2 is DISABLED, the fallback setting <strong>Auto</strong> is used instead of the user settings for all flightchannels (Roll, Pitch, Yaw and Throttle)."
"message": "<strong>Warning:</strong> 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"

View File

@ -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'},

View File

@ -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 {

View File

@ -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%;
}

View File

@ -22,11 +22,6 @@
<div class="spacer_box_title" i18n="failsafePaneTitleOld"></div>
</div>
<div class="spacer_box">
<table>
<tbody class="featuresOld rxFailsafe">
<!-- table generated here -->
</tbody>
</table>
<div class="number">
<label> <input type="number" name="failsafe_throttle_old" min="0" max="2000" /> <span
i18n="failsafeThrottleItemOld"></span>
@ -70,11 +65,6 @@
<div class="spacer_box_title" i18n="failsafeStageTwoSettingsTitle"></div>
</div>
<div class="spacer_box">
<table>
<tbody class="featuresNew rxFailsafe">
<!-- table generated here -->
</tbody>
</table>
<div class="checkbox stage2">
<div class="numberspacer" >
<input type="checkbox" name="failsafe_kill_switch" class="toggle" id="failsafe_kill_switch" />

View File

@ -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());