1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-17 05:15:21 +03:00

Fix for failsafe feature.

This commit is contained in:
Michael Keller 2016-07-27 13:14:00 +12:00
parent 81ceba8a4c
commit b24ff4dfad
6 changed files with 37 additions and 66 deletions

View file

@ -486,9 +486,6 @@
"featureGPSTip": {
"message": "Configure port scenario first"
},
"featureFAILSAFE": {
"message": "Apply failsafe settings on RX signal loss"
},
"featureSONAR": {
"message": "Sonar"
},
@ -546,6 +543,12 @@
"featureOSD": {
"message": "On Screen Display"
},
"featureFAILSAFE": {
"message": "Apply failsafe 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)."
},
"configurationFeatureEnabled": {
"message": "Enabled"
},
@ -1634,12 +1637,6 @@
"failsafePaneTitleOld": {
"message": "Receiver failsafe"
},
"failsafeFeatureItemOld": {
"message": "Failsafe settings on RX signal loss"
},
"failsafeThrottleItemOld": {
"message": "Failsafe Throttle"
},
"failsafeFeaturesHelpNew": {
"message": "Failsafe has two stages. <strong>Stage 1</strong> is entered when a flightchannel has an invalid pulse length, the receiver reports failsafe mode or there is no signal from the receiver at all, the channel fallback settings are applied to <span style=\"color: red\">all channels</span> and a short amount of time is provided to allow for recovery. <strong>Stage 2</strong> is entered when the error condition takes longer than the configured guard time while the craft is <span style=\"color: red\">armed</span>, all channels will remain at the applied channel fallback setting unless overruled by the chosen procedure. <br /><strong>Note:</strong> Prior to entering stage 1, channel fallback settings are also applied to individual AUX channels that have invalid pulses."
},
@ -1670,12 +1667,6 @@
"failsafeStageTwoSettingsTitle": {
"message": "Stage 2 - Settings"
},
"failsafeFeatureItem": {
"message": "Failsafe Stage 2 enabled"
},
"failsafeFeatureHelp": {
"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)."
},
"failsafeDelayItem": {
"message": "Guard time for stage 2 activation after signal lost [1 = 0.1 sec.]"
},

View file

@ -10,7 +10,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'},
{bit: 8, group: 'rxFailsafe', 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

@ -130,7 +130,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
mixer_list_e.val(BF_CONFIG.mixerConfiguration).change();
var radioGroups = [];
var features_e = $('.features');
var features_e = $('.tab-configuration .features');
BF_CONFIG.features.generateElements(features_e);

View file

@ -22,13 +22,11 @@
<div class="spacer_box_title" i18n="failsafePaneTitleOld"></div>
</div>
<div class="spacer_box">
<div class="checkbox">
<div class="numberspacer" >
<input type="checkbox" name="failsafe_feature" class="feature toggle rxFailsafe" id="failsafe_feature" />
</div>
<label for="failsafe_feature"><span i18n="failsafeFeatureItemOld"></span>
</label>
</div>
<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>
@ -72,14 +70,11 @@
<div class="spacer_box_title" i18n="failsafeStageTwoSettingsTitle"></div>
</div>
<div class="spacer_box">
<div class="checkbox">
<div class="numberspacer" >
<input type="checkbox" name="failsafe_feature_new" class="feature toggle rxFailsafe" id="failsafe_feature_new" />
</div>
<label for="failsafe_feature_new"><span i18n="failsafeFeatureItem"></span>
</label>
<div class="helpicon cf_tip" i18n_title="failsafeFeatureHelp"></div>
</div>
<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,11 +63,6 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
}
function process_html() {
var failsafeFeature;
// translate to user-selected language
localize();
// Conditionally hide the old or the new control pane's
if(apiVersionGte1_15_0) {
var oldPane = $('div.oldpane');
@ -204,18 +199,22 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
channel_mode_array[i].change();
}
BF_CONFIG.features.generateElements($('.tab-failsafe .featuresNew'));
// fill stage 2 fields
failsafeFeature = $('input[name="failsafe_feature_new"]');
failsafeFeature.change(function () {
if ($(this).is(':checked')) {
function toggleStage2(doShow) {
if (doShow) {
$('div.stage2').show();
} else {
$('div.stage2').hide();
}
});
}
failsafeFeature.prop('checked', bit_check(BF_CONFIG.features, 8));
failsafeFeature.change();
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);
@ -262,28 +261,20 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
$('input[name="failsafe_kill_switch"]').prop('checked', FAILSAFE_CONFIG.failsafe_kill_switch);
} else {
// set FAILSAFE feature option (pre API 1.15.0)
failsafeFeature = $('input[name="failsafe_feature"]');
failsafeFeature.prop('checked', bit_check(BF_CONFIG.features, 8));
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);
}
$('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());
// get FAILSAFE feature option (>= API 1.15.0)
if ($('input[name="failsafe_feature_new"]').is(':checked')) {
BF_CONFIG.features = bit_set(BF_CONFIG.features, 8);
} else {
BF_CONFIG.features = bit_clear(BF_CONFIG.features, 8);
}
FAILSAFE_CONFIG.failsafe_throttle = parseInt($('input[name="failsafe_throttle"]').val());
FAILSAFE_CONFIG.failsafe_off_delay = parseInt($('input[name="failsafe_off_delay"]').val());
FAILSAFE_CONFIG.failsafe_throttle_low_delay = parseInt($('input[name="failsafe_throttle_low_delay"]').val());
@ -297,13 +288,6 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
FAILSAFE_CONFIG.failsafe_kill_switch = $('input[name="failsafe_kill_switch"]').is(':checked') ? 1 : 0;
} else {
// get FAILSAFE feature option (pre API 1.15.0)
if ($('input[name="failsafe_feature"]').is(':checked')) {
BF_CONFIG.features = bit_set(BF_CONFIG.features, 8);
} else {
BF_CONFIG.features = bit_clear(BF_CONFIG.features, 8);
}
// get failsafe_throttle field value (pre API 1.15.0)
MISC.failsafe_throttle = parseInt($('input[name="failsafe_throttle_old"]').val());
}
@ -364,6 +348,9 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
}
});
// translate to user-selected language
localize();
// status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function status_pull() {
MSP.send_message(MSP_codes.MSP_STATUS);

View file

@ -398,9 +398,7 @@ TABS.pid_tuning.initialize = function (callback) {
function process_html() {
if (semver.gte(CONFIG.flightControllerVersion, "2.8.0")) {
var features_e = $('.features');
BF_CONFIG.features.generateElements(features_e);
BF_CONFIG.features.generateElements($('.tab-pid_tuning .features'));
}
// translate to user-selected language