Skip to content

Commit

Permalink
Dynamic GPS Rescue 'return altitude' field + removed unnecessary warning
Browse files Browse the repository at this point in the history
  • Loading branch information
hntirgeam committed Jan 20, 2025
1 parent b4a9fab commit 16eeabf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4794,7 +4794,7 @@
"message": "The distance the aircraft will climb, above the current altitude, when a rescue is initiated and the altitude mode is set to CURRENT Altitude; also added when in MAX Altitude mode."
},
"failsafeGpsRescueItemReturnAltitude": {
"message": "Return altitude (meters) - <strong>only applies in Fixed Altitude mode</strong>"
"message": "Return altitude (meters)"
},
"failsafeGpsRescueItemAscendRate": {
"message": "Ascend rate (meters/second)"
Expand Down
12 changes: 12 additions & 0 deletions src/js/tabs/failsafe.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,18 @@ failsafe.initialize = function (callback) {
// Sort the element, if need to group, do it by lexical sort, ie. by naming of (the translated) selection text
$("#failsafeGpsRescueItemAltitudeSelect").sortSelect();

// Show the return altitude input if the alt mode equals to FixedAlt
function showReturnAlt() {
let altitude_number_field = $('input[name="gps_rescue_return_altitude"]').closest(".number");
if ($("#failsafeGpsRescueItemAltitudeSelect").val() === "1") {
altitude_number_field.show();
} else {
altitude_number_field.hide();
}
}
showReturnAlt();
$("#failsafeGpsRescueItemAltitudeSelect").on("change", showReturnAlt);

// Introduced in 1.43
$('input[name="gps_rescue_ascend_rate"]').val((FC.GPS_RESCUE.ascendRate / 100).toFixed(1));
$('input[name="gps_rescue_descend_rate"]').val((FC.GPS_RESCUE.descendRate / 100).toFixed(1));
Expand Down

0 comments on commit 16eeabf

Please sign in to comment.