Skip to content

Commit

Permalink
Sort of 3 optionlist at failsafe tab (#3211)
Browse files Browse the repository at this point in the history
Sort of 3 optionlist
  • Loading branch information
HThuren authored Jan 6, 2023
1 parent 3f21a67 commit 54ba222
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/js/tabs/failsafe.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ failsafe.initialize = function (callback) {
break;
}

// Sort the element, if need to group, do it by lexical sort, ie. by naming of (the translated) selection text
$('#failsafeSwitchSelect').sortSelect();

// `failsafe_kill_switch` has been renamed to `failsafe_switch_mode`.
// It is backwards compatible with `failsafe_kill_switch`
$('select[name="failsafe_switch_mode"]').val(FC.FAILSAFE_CONFIG.failsafe_switch_mode);
Expand All @@ -265,8 +268,13 @@ failsafe.initialize = function (callback) {
$('input[name="gps_rescue_throttle_max"]').val(FC.GPS_RESCUE.throttleMax);
$('input[name="gps_rescue_throttle_hover"]').val(FC.GPS_RESCUE.throttleHover);
$('input[name="gps_rescue_min_sats"]').val(FC.GPS_RESCUE.minSats);
// Sort the element, if need to group, do it by lexical sort, ie. by naming of (the translated) selection text
$('#failsafeGpsRescueItemSanitySelect').sortSelect();
$('select[name="gps_rescue_sanity_checks"]').val(FC.GPS_RESCUE.sanityChecks);

// Sort the element, if need to group, do it by lexical sort, ie. by naming of (the translated) selection text
$('#failsafeGpsRescueItemAltitudeSelect').sortSelect();

if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) {
$('input[name="gps_rescue_ascend_rate"]').val((FC.GPS_RESCUE.ascendRate / 100).toFixed(2));
$('input[name="gps_rescue_descend_rate"]').val((FC.GPS_RESCUE.descendRate / 100).toFixed(2));
Expand Down
6 changes: 3 additions & 3 deletions src/tabs/failsafe.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<div class="spacer_box">
<div class="number">
<label>
<select class="switchMode" name="failsafe_switch_mode">
<select id="failsafeSwitchSelect" class="switchMode" name="failsafe_switch_mode">
<option value="0" i18n="failsafeSwitchOptionStage1"></option>
<option value="2" i18n="failsafeSwitchOptionStage2"></option>
<option value="1" i18n="failsafeSwitchOptionKill"></option>
Expand Down Expand Up @@ -181,7 +181,7 @@
</div>
<div class="number">
<label>
<select class="switchMode" name="gps_rescue_altitude_mode">
<select id="failsafeGpsRescueItemAltitudeSelect" class="switchMode" name="gps_rescue_altitude_mode">
<option value="0" i18n="failsafeGpsRescueItemAltitudeModeMaxAlt"></option>
<option value="1" i18n="failsafeGpsRescueItemAltitudeModeFixedAlt"></option>
<option value="2" i18n="failsafeGpsRescueItemAltitudeModeCurrentAlt"></option>
Expand All @@ -191,7 +191,7 @@
</div>
<div class="number">
<label>
<select class="switchMode" name="gps_rescue_sanity_checks">
<select id="failsafeGpsRescueItemSanitySelect" class="switchMode" name="gps_rescue_sanity_checks">
<option value="0" i18n="failsafeGpsRescueItemSanityChecksOff"></option>
<option value="1" i18n="failsafeGpsRescueItemSanityChecksOn"></option>
<option value="2" i18n="failsafeGpsRescueItemSanityChecksFSOnly"></option>
Expand Down

0 comments on commit 54ba222

Please sign in to comment.