1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-26 01:35:23 +03:00

failsafe changes for 1.6

This commit is contained in:
Pawel Spychalski (DzikuVx) 2017-03-10 16:53:25 +01:00
parent 46ac4bd3c4
commit 9e1978f3ec
6 changed files with 123 additions and 27 deletions

View file

@ -1656,16 +1656,16 @@
"message": "<strong>Hold</strong> means maintain the last good value received. <strong>Set</strong> means the value given here will be used" "message": "<strong>Hold</strong> means maintain the last good value received. <strong>Set</strong> means the value given here will be used"
}, },
"failsafeStageTwoSettingsTitle": { "failsafeStageTwoSettingsTitle": {
"message": "Stage 2 - Settings" "message": "Settings"
}, },
"failsafeFeatureItem": { "failsafeFeatureItem": {
"message": "Failsafe Stage 2 enabled" "message": "Enabled"
}, },
"failsafeFeatureHelp": { "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)." "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": { "failsafeDelayItem": {
"message": "Guard time for stage 2 activation after signal lost [1 = 0.1 sec.]" "message": "Guard time for activation after signal lost [1 = 0.1 sec.]"
}, },
"failsafeDelayHelp": { "failsafeDelayHelp": {
"message": "Time for stage 1 to wait for recovery" "message": "Time for stage 1 to wait for recovery"
@ -1686,7 +1686,7 @@
"message": "Time to stay in landing mode untill the motors are turned off and the craft is disarmed" "message": "Time to stay in landing mode untill the motors are turned off and the craft is disarmed"
}, },
"failsafeSubTitle1": { "failsafeSubTitle1": {
"message": "Stage 2 - Failsafe Procedure" "message": "Procedure"
}, },
"failsafeProcedureItemSelect1": { "failsafeProcedureItemSelect1": {
"message": "Land" "message": "Land"
@ -1697,6 +1697,9 @@
"failsafeProcedureItemSelect3": { "failsafeProcedureItemSelect3": {
"message": "RTH" "message": "RTH"
}, },
"failsafeProcedureItemSelect4": {
"message": "Do nothing"
},
"failsafeKillSwitchItem": { "failsafeKillSwitchItem": {
"message": "Failsafe Kill Switch (setup Failsafe in Modes Tab)" "message": "Failsafe Kill Switch (setup Failsafe in Modes Tab)"
}, },

View file

@ -15490,15 +15490,27 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
} }
function load_rxfail_config() { function load_rxfail_config() {
MSP.send_message(MSPCodes.MSP_RXFAIL_CONFIG, false, false, get_box_names); if (semver.lt(CONFIG.flightControllerVersion, "1.6.0")) {
MSP.send_message(MSPCodes.MSP_RXFAIL_CONFIG, false, false, get_box_names);
} else {
get_box_names();
}
} }
function get_box_names() { function get_box_names() {
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_mode_ranges); if (semver.lt(CONFIG.flightControllerVersion, "1.6.0")) {
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_mode_ranges);
} else {
get_mode_ranges();
}
} }
function get_mode_ranges() { function get_mode_ranges() {
MSP.send_message(MSPCodes.MSP_MODE_RANGES, false, false, get_box_ids); if (semver.lt(CONFIG.flightControllerVersion, "1.6.0")) {
MSP.send_message(MSPCodes.MSP_MODE_RANGES, false, false, get_box_ids);
} else {
get_box_ids();
}
} }
function get_box_ids() { function get_box_ids() {
@ -15524,6 +15536,12 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
load_rx_config(); load_rx_config();
function process_html() { function process_html() {
if (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) {
$('.pre-v1_6').hide();
$('.requires-v1_6').show();
}
var failsafeFeature; var failsafeFeature;
// translate to user-selected language // translate to user-selected language
@ -15653,6 +15671,14 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
channel_mode_array[i].change(); channel_mode_array[i].change();
} }
var isFailsafeEnabled;
if (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) {
isFailsafeEnabled = true;
} else {
isFailsafeEnabled = bit_check(BF_CONFIG.features, 8);
}
// fill stage 2 fields // fill stage 2 fields
failsafeFeature = $('input[name="failsafe_feature_new"]'); failsafeFeature = $('input[name="failsafe_feature_new"]');
failsafeFeature.change(function () { failsafeFeature.change(function () {
@ -15663,7 +15689,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
} }
}); });
failsafeFeature.prop('checked', bit_check(BF_CONFIG.features, 8)); failsafeFeature.prop('checked', isFailsafeEnabled);
failsafeFeature.change(); failsafeFeature.change();
$('input[name="failsafe_throttle"]').val(FAILSAFE_CONFIG.failsafe_throttle); $('input[name="failsafe_throttle"]').val(FAILSAFE_CONFIG.failsafe_throttle);
@ -15710,6 +15736,11 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
element.prop('checked', true); element.prop('checked', true);
element.change(); element.change();
break; break;
case 3:
element = $('input[id="nothing"]');
element.prop('checked', true);
element.change();
break;
} }
// set stage 2 kill switch option // set stage 2 kill switch option
@ -15720,11 +15751,12 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
RX_CONFIG.rx_min_usec = parseInt($('input[name="rx_min_usec"]').val()); RX_CONFIG.rx_min_usec = parseInt($('input[name="rx_min_usec"]').val());
RX_CONFIG.rx_max_usec = parseInt($('input[name="rx_max_usec"]').val()); RX_CONFIG.rx_max_usec = parseInt($('input[name="rx_max_usec"]').val());
// get FAILSAFE feature option (>= API 1.15.0) if (semver.lt(CONFIG.flightControllerVersion, "1.6.0")) {
if ($('input[name="failsafe_feature_new"]').is(':checked')) { if ($('input[name="failsafe_feature_new"]').is(':checked')) {
BF_CONFIG.features = bit_set(BF_CONFIG.features, 8); BF_CONFIG.features = bit_set(BF_CONFIG.features, 8);
} else { } else {
BF_CONFIG.features = bit_clear(BF_CONFIG.features, 8); BF_CONFIG.features = bit_clear(BF_CONFIG.features, 8);
}
} }
FAILSAFE_CONFIG.failsafe_throttle = parseInt($('input[name="failsafe_throttle"]').val()); FAILSAFE_CONFIG.failsafe_throttle = parseInt($('input[name="failsafe_throttle"]').val());
@ -15738,6 +15770,8 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
FAILSAFE_CONFIG.failsafe_procedure = 1; FAILSAFE_CONFIG.failsafe_procedure = 1;
} else if ($('input[id="rth"]').is(':checked')) { } else if ($('input[id="rth"]').is(':checked')) {
FAILSAFE_CONFIG.failsafe_procedure = 2; FAILSAFE_CONFIG.failsafe_procedure = 2;
} else if ($('input[id="nothing"]').is(':checked')) {
FAILSAFE_CONFIG.failsafe_procedure = 3;
} }
FAILSAFE_CONFIG.failsafe_kill_switch = $('input[name="failsafe_kill_switch"]').is(':checked') ? 1 : 0; FAILSAFE_CONFIG.failsafe_kill_switch = $('input[name="failsafe_kill_switch"]').is(':checked') ? 1 : 0;
@ -15747,7 +15781,11 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
} }
function save_rxfail_config() { function save_rxfail_config() {
mspHelper.sendRxFailConfig(save_bf_config); if (semver.lt(CONFIG.flightControllerVersion, "1.6.0")) {
mspHelper.sendRxFailConfig(save_bf_config);
} else {
save_bf_config();
}
} }
function save_bf_config() { function save_bf_config() {

View file

@ -2753,6 +2753,12 @@ hr {
background-size: 200px; background-size: 200px;
} }
.tab-failsafe .pro5 {
background-color: #fafafa;
background-size: 200px;
height: auto;
}
.tab-failsafe .spacer_box .helpicon { .tab-failsafe .spacer_box .helpicon {
margin-top: 3px; margin-top: 3px;
margin-right: 0; margin-right: 0;

View file

@ -111,6 +111,12 @@
background-size: 200px; background-size: 200px;
} }
.tab-failsafe .pro5 {
background-color: #fafafa;
background-size: 200px;
height: auto;
}
.tab-failsafe .spacer_box .helpicon { .tab-failsafe .spacer_box .helpicon {
margin-top: 3px; margin-top: 3px;
margin-right: 0; margin-right: 0;

View file

@ -4,7 +4,7 @@
<div class="cf_doc_version_bt"> <div class="cf_doc_version_bt">
<a id="button-documentation" href="https://github.com/iNavFlight/inav/releases" target="_blank"></a> <a id="button-documentation" href="https://github.com/iNavFlight/inav/releases" target="_blank"></a>
</div> </div>
<div class="note"> <div class="note pre-v1_6">
<div class="note_spacer"> <div class="note_spacer">
<p data-i18n="failsafeFeaturesHelpNew"></p> <p data-i18n="failsafeFeaturesHelpNew"></p>
</div> </div>
@ -28,7 +28,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="gui_box grey stage1"> <div class="gui_box grey stage1 pre-v1_6">
<div class="gui_box_titlebar"> <div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="failsafeChannelFallbackSettingsTitle"></div> <div class="spacer_box_title" data-i18n="failsafeChannelFallbackSettingsTitle"></div>
<div class="helpicon cf_tip" data-i18n_title="failsafeChannelFallbackSettingsHelp"></div> <div class="helpicon cf_tip" data-i18n_title="failsafeChannelFallbackSettingsHelp"></div>
@ -46,7 +46,7 @@
<div class="spacer_box_title" data-i18n="failsafeStageTwoSettingsTitle"></div> <div class="spacer_box_title" data-i18n="failsafeStageTwoSettingsTitle"></div>
</div> </div>
<div class="spacer_box"> <div class="spacer_box">
<div class="checkbox"> <div class="checkbox pre-v1_6">
<div class="numberspacer" > <div class="numberspacer" >
<input type="checkbox" name="failsafe_feature_new" class="feature toggle rxFailsafe" id="failsafe_feature_new" /> <input type="checkbox" name="failsafe_feature_new" class="feature toggle rxFailsafe" id="failsafe_feature_new" />
</div> </div>
@ -104,6 +104,11 @@
<label for="rth" data-i18n="failsafeProcedureItemSelect3"></label> <label for="rth" data-i18n="failsafeProcedureItemSelect3"></label>
</div> </div>
</div> </div>
<div class="radioarea pro5 stage2 requires-v1_6">
<div class="radiobuttons"><input class="procedure" id="nothing" name="group1" type="radio"/>
<label for="nothing" data-i18n="failsafeProcedureItemSelect4"></label>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -18,15 +18,27 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
} }
function load_rxfail_config() { function load_rxfail_config() {
MSP.send_message(MSPCodes.MSP_RXFAIL_CONFIG, false, false, get_box_names); if (semver.lt(CONFIG.flightControllerVersion, "1.6.0")) {
MSP.send_message(MSPCodes.MSP_RXFAIL_CONFIG, false, false, get_box_names);
} else {
get_box_names();
}
} }
function get_box_names() { function get_box_names() {
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_mode_ranges); if (semver.lt(CONFIG.flightControllerVersion, "1.6.0")) {
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_mode_ranges);
} else {
get_mode_ranges();
}
} }
function get_mode_ranges() { function get_mode_ranges() {
MSP.send_message(MSPCodes.MSP_MODE_RANGES, false, false, get_box_ids); if (semver.lt(CONFIG.flightControllerVersion, "1.6.0")) {
MSP.send_message(MSPCodes.MSP_MODE_RANGES, false, false, get_box_ids);
} else {
get_box_ids();
}
} }
function get_box_ids() { function get_box_ids() {
@ -52,6 +64,12 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
load_rx_config(); load_rx_config();
function process_html() { function process_html() {
if (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) {
$('.pre-v1_6').hide();
$('.requires-v1_6').show();
}
var failsafeFeature; var failsafeFeature;
// translate to user-selected language // translate to user-selected language
@ -181,6 +199,14 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
channel_mode_array[i].change(); channel_mode_array[i].change();
} }
var isFailsafeEnabled;
if (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) {
isFailsafeEnabled = true;
} else {
isFailsafeEnabled = bit_check(BF_CONFIG.features, 8);
}
// fill stage 2 fields // fill stage 2 fields
failsafeFeature = $('input[name="failsafe_feature_new"]'); failsafeFeature = $('input[name="failsafe_feature_new"]');
failsafeFeature.change(function () { failsafeFeature.change(function () {
@ -191,7 +217,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
} }
}); });
failsafeFeature.prop('checked', bit_check(BF_CONFIG.features, 8)); failsafeFeature.prop('checked', isFailsafeEnabled);
failsafeFeature.change(); failsafeFeature.change();
$('input[name="failsafe_throttle"]').val(FAILSAFE_CONFIG.failsafe_throttle); $('input[name="failsafe_throttle"]').val(FAILSAFE_CONFIG.failsafe_throttle);
@ -238,6 +264,11 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
element.prop('checked', true); element.prop('checked', true);
element.change(); element.change();
break; break;
case 3:
element = $('input[id="nothing"]');
element.prop('checked', true);
element.change();
break;
} }
// set stage 2 kill switch option // set stage 2 kill switch option
@ -248,11 +279,12 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
RX_CONFIG.rx_min_usec = parseInt($('input[name="rx_min_usec"]').val()); RX_CONFIG.rx_min_usec = parseInt($('input[name="rx_min_usec"]').val());
RX_CONFIG.rx_max_usec = parseInt($('input[name="rx_max_usec"]').val()); RX_CONFIG.rx_max_usec = parseInt($('input[name="rx_max_usec"]').val());
// get FAILSAFE feature option (>= API 1.15.0) if (semver.lt(CONFIG.flightControllerVersion, "1.6.0")) {
if ($('input[name="failsafe_feature_new"]').is(':checked')) { if ($('input[name="failsafe_feature_new"]').is(':checked')) {
BF_CONFIG.features = bit_set(BF_CONFIG.features, 8); BF_CONFIG.features = bit_set(BF_CONFIG.features, 8);
} else { } else {
BF_CONFIG.features = bit_clear(BF_CONFIG.features, 8); BF_CONFIG.features = bit_clear(BF_CONFIG.features, 8);
}
} }
FAILSAFE_CONFIG.failsafe_throttle = parseInt($('input[name="failsafe_throttle"]').val()); FAILSAFE_CONFIG.failsafe_throttle = parseInt($('input[name="failsafe_throttle"]').val());
@ -266,6 +298,8 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
FAILSAFE_CONFIG.failsafe_procedure = 1; FAILSAFE_CONFIG.failsafe_procedure = 1;
} else if ($('input[id="rth"]').is(':checked')) { } else if ($('input[id="rth"]').is(':checked')) {
FAILSAFE_CONFIG.failsafe_procedure = 2; FAILSAFE_CONFIG.failsafe_procedure = 2;
} else if ($('input[id="nothing"]').is(':checked')) {
FAILSAFE_CONFIG.failsafe_procedure = 3;
} }
FAILSAFE_CONFIG.failsafe_kill_switch = $('input[name="failsafe_kill_switch"]').is(':checked') ? 1 : 0; FAILSAFE_CONFIG.failsafe_kill_switch = $('input[name="failsafe_kill_switch"]').is(':checked') ? 1 : 0;
@ -275,7 +309,11 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
} }
function save_rxfail_config() { function save_rxfail_config() {
mspHelper.sendRxFailConfig(save_bf_config); if (semver.lt(CONFIG.flightControllerVersion, "1.6.0")) {
mspHelper.sendRxFailConfig(save_bf_config);
} else {
save_bf_config();
}
} }
function save_bf_config() { function save_bf_config() {