mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-24 00:35:26 +03:00
Support for failsafe-switch-mode
This commit is contained in:
parent
e355fed2d1
commit
6700a1f9a4
7 changed files with 60 additions and 8 deletions
|
@ -605,7 +605,7 @@ function configuration_restore(callback) {
|
|||
failsafe_delay: 10,
|
||||
failsafe_off_delay: 200,
|
||||
failsafe_throttle: 1000,
|
||||
failsafe_kill_switch: 0,
|
||||
failsafe_switch_mode: 0,
|
||||
failsafe_throttle_low_delay: 100,
|
||||
failsafe_procedure: 0
|
||||
};
|
||||
|
|
|
@ -391,7 +391,7 @@ var FC = {
|
|||
failsafe_delay: 0,
|
||||
failsafe_off_delay: 0,
|
||||
failsafe_throttle: 0,
|
||||
failsafe_kill_switch: 0,
|
||||
failsafe_switch_mode: 0,
|
||||
failsafe_throttle_low_delay: 0,
|
||||
failsafe_procedure: 0.
|
||||
};
|
||||
|
|
|
@ -788,7 +788,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
FAILSAFE_CONFIG.failsafe_off_delay = data.readU8();
|
||||
FAILSAFE_CONFIG.failsafe_throttle = data.readU16();
|
||||
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
FAILSAFE_CONFIG.failsafe_kill_switch = data.readU8();
|
||||
FAILSAFE_CONFIG.failsafe_switch_mode = data.readU8();
|
||||
FAILSAFE_CONFIG.failsafe_throttle_low_delay = data.readU16();
|
||||
FAILSAFE_CONFIG.failsafe_procedure = data.readU8();
|
||||
}
|
||||
|
@ -1366,7 +1366,7 @@ MspHelper.prototype.crunch = function(code) {
|
|||
.push8(FAILSAFE_CONFIG.failsafe_off_delay)
|
||||
.push16(FAILSAFE_CONFIG.failsafe_throttle);
|
||||
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
buffer.push8(FAILSAFE_CONFIG.failsafe_kill_switch)
|
||||
buffer.push8(FAILSAFE_CONFIG.failsafe_switch_mode)
|
||||
.push16(FAILSAFE_CONFIG.failsafe_throttle_low_delay)
|
||||
.push8(FAILSAFE_CONFIG.failsafe_procedure);
|
||||
}
|
||||
|
|
|
@ -261,8 +261,17 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
|||
break;
|
||||
}
|
||||
|
||||
// set stage 2 kill switch option
|
||||
$('input[name="failsafe_kill_switch"]').prop('checked', FAILSAFE_CONFIG.failsafe_kill_switch);
|
||||
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
|
||||
// `failsafe_kill_switch` has been renamed to `failsafe_switch_mode`.
|
||||
// It is backwards compatible with `failsafe_kill_switch`
|
||||
$('select[name="failsafe_switch_mode"]').val(FAILSAFE_CONFIG.failsafe_switch_mode);
|
||||
$('div.kill_switch').hide();
|
||||
}
|
||||
else {
|
||||
$('input[name="failsafe_kill_switch"]').prop('checked', FAILSAFE_CONFIG.failsafe_switch_mode);
|
||||
$('div.failsafe_switch').hide();
|
||||
}
|
||||
|
||||
|
||||
|
||||
$('a.save').click(function () {
|
||||
|
@ -284,7 +293,12 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
|||
FAILSAFE_CONFIG.failsafe_procedure = 1;
|
||||
}
|
||||
|
||||
FAILSAFE_CONFIG.failsafe_kill_switch = $('input[name="failsafe_kill_switch"]').is(':checked') ? 1 : 0;
|
||||
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
|
||||
FAILSAFE_CONFIG.failsafe_switch_mode = $('select[name="failsafe_switch_mode"]').val();
|
||||
}
|
||||
else {
|
||||
FAILSAFE_CONFIG.failsafe_switch_mode = $('input[name="failsafe_kill_switch"]').is(':checked') ? 1 : 0;
|
||||
}
|
||||
|
||||
function save_failssafe_config() {
|
||||
MSP.send_message(MSPCodes.MSP_SET_FAILSAFE_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FAILSAFE_CONFIG), false, save_rxfail_config);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue