diff --git a/locales/en/messages.json b/locales/en/messages.json index 2b1667c2..e7fcb1c8 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -3665,10 +3665,31 @@ "failsafeGpsRescueItemThrottleHover": { "message": "Throttle hover" }, + "failsafeGpsRescueItemAscendRate": { + "message": "Ascend rate (meters/second)" + }, + "failsafeGpsRescueItemDescendRate": { + "message": "Descend rate (meters/second)" + }, "failsafeGpsRescueItemMinSats": { "message": "Minimum satellites" }, - "failsafeGpsRescueItemSanityChecks": { + "failsafeGpsRescueItemAllowArmingWithoutFix": { + "message": "Allow arming without fix -
" + }, + "failsafeGpsRescueItemAltitudeMode": { + "message": "Altitude mode" + }, + "failsafeGpsRescueItemAltitudeModeMaxAlt": { + "message": "Maximum altitude" + }, + "failsafeGpsRescueItemAltitudeModeFixedAlt": { + "message": "Fixed altitude" + }, + "failsafeGpsRescueItemAltitudeModeCurrentAlt": { + "message": "Current altitude" + }, + "failsafeGpsRescueItemSanityChecks": { "message": "Sanity checks" }, "failsafeGpsRescueItemSanityChecksOff": { diff --git a/src/css/main.css b/src/css/main.css index 662b2149..25c6c969 100644 --- a/src/css/main.css +++ b/src/css/main.css @@ -140,8 +140,8 @@ input[type="number"]::-webkit-inner-spin-button { } .message-negative { - color: var(--error); - font-weight: bold; + color: var(--error) !important; + font-weight: bold !important; } .headerbar { diff --git a/src/css/tabs/failsafe.css b/src/css/tabs/failsafe.css index 5c47660b..47dcc74f 100644 --- a/src/css/tabs/failsafe.css +++ b/src/css/tabs/failsafe.css @@ -41,6 +41,10 @@ font-weight: normal; } +.tab-failsafe .number .switchery { + margin-right: 16px; +} + .tab-failsafe .number input:disabled { background-color: #ececec; } @@ -277,12 +281,6 @@ width: 100%; } -.tab-failsafe .selectSwitchMode { - clear: left; - width: 100%; - float: left; -} - .tab-failsafe .switchMode { border: 1px solid var(--subtleAccent); border-radius: 3px; diff --git a/src/js/fc.js b/src/js/fc.js index 625c3524..2caa175d 100644 --- a/src/js/fc.js +++ b/src/js/fc.js @@ -504,6 +504,10 @@ var FC = { throttleHover: 0, sanityChecks: 0, minSats: 0, + ascendRate: 0, + descendRate: 0, + allowArmingWithoutFix: 0, + altitudeMode: 0, }; RXFAIL_CONFIG = []; diff --git a/src/js/msp/MSPHelper.js b/src/js/msp/MSPHelper.js index df22e31d..0bb75a50 100644 --- a/src/js/msp/MSPHelper.js +++ b/src/js/msp/MSPHelper.js @@ -440,6 +440,12 @@ MspHelper.prototype.process_data = function(dataHandler) { GPS_RESCUE.throttleHover = data.readU16(); GPS_RESCUE.sanityChecks = data.readU8(); GPS_RESCUE.minSats = data.readU8(); + if (semver.gte(CONFIG.apiVersion, "1.43.0")) { + GPS_RESCUE.ascendRate = data.readU16(); + GPS_RESCUE.descendRate = data.readU16(); + GPS_RESCUE.allowArmingWithoutFix = data.readU8(); + GPS_RESCUE.altitudeMode = data.readU8(); + } break; case MSPCodes.MSP_RSSI_CONFIG: RSSI_CONFIG.channel = data.readU8(); @@ -1715,6 +1721,13 @@ MspHelper.prototype.crunch = function(code) { .push16(GPS_RESCUE.throttleHover) .push8(GPS_RESCUE.sanityChecks) .push8(GPS_RESCUE.minSats); + + if (semver.gte(CONFIG.apiVersion, "1.43.0")) { + buffer.push16(GPS_RESCUE.ascendRate) + .push16(GPS_RESCUE.descendRate) + .push8(GPS_RESCUE.allowArmingWithoutFix) + .push8(GPS_RESCUE.altitudeMode); + } break; case MSPCodes.MSP_SET_COMPASS_CONFIG: buffer.push16(Math.round(COMPASS_CONFIG.mag_declination * 100)); diff --git a/src/js/tabs/failsafe.js b/src/js/tabs/failsafe.js index afbe1aff..94fca351 100644 --- a/src/js/tabs/failsafe.js +++ b/src/js/tabs/failsafe.js @@ -312,6 +312,19 @@ TABS.failsafe.initialize = function (callback, scrollPosition) { $('input[name="gps_rescue_throttle_hover"]').val(GPS_RESCUE.throttleHover); $('input[name="gps_rescue_min_sats"]').val(GPS_RESCUE.minSats); $('select[name="gps_rescue_sanity_checks"]').val(GPS_RESCUE.sanityChecks); + + if (semver.gte(CONFIG.apiVersion, "1.43.0")) { + $('input[name="gps_rescue_ascend_rate"]').val((GPS_RESCUE.ascendRate / 100).toFixed(2)); + $('input[name="gps_rescue_descend_rate"]').val((GPS_RESCUE.descendRate / 100).toFixed(2)); + $('input[name="gps_rescue_allow_arming_without_fix"]').prop('checked', GPS_RESCUE.allowArmingWithoutFix > 0); + $('select[name="gps_rescue_altitude_mode"]').val(GPS_RESCUE.altitudeMode); + } else { + $('input[name="gps_rescue_ascend_rate"]').closest('.number').hide(); + $('input[name="gps_rescue_descend_rate"]').closest('.number').hide(); + $('input[name="gps_rescue_allow_arming_without_fix"]').closest('.number').hide(); + $('select[name="gps_rescue_altitude_mode"]').closest('.number').hide(); + } + } else { // GPS Rescue Parameters not available $('.pro4 > .proceduresettings').hide(); @@ -366,6 +379,13 @@ TABS.failsafe.initialize = function (callback, scrollPosition) { GPS_RESCUE.sanityChecks = $('select[name="gps_rescue_sanity_checks"]').val(); } + if (semver.gte(CONFIG.apiVersion, "1.43.0")) { + GPS_RESCUE.ascendRate = $('input[name="gps_rescue_ascend_rate"]').val() * 100; + GPS_RESCUE.descendRate = $('input[name="gps_rescue_descend_rate"]').val() * 100; + GPS_RESCUE.allowArmingWithoutFix = $('input[name="gps_rescue_allow_arming_without_fix"]').prop('checked') ? 1 : 0; + GPS_RESCUE.altitudeMode = parseInt($('select[name="gps_rescue_altitude_mode"]').val()); + } + function save_failssafe_config() { MSP.send_message(MSPCodes.MSP_SET_FAILSAFE_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FAILSAFE_CONFIG), false, save_rxfail_config); } diff --git a/src/tabs/failsafe.html b/src/tabs/failsafe.html index e7ad87d1..71b6d7ef 100644 --- a/src/tabs/failsafe.html +++ b/src/tabs/failsafe.html @@ -44,7 +44,7 @@