mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-23 16:25:22 +03:00
Add more parameters to GPS Rescue (#1812)
Add more parameters to GPS Rescue
This commit is contained in:
commit
53fb5944d1
7 changed files with 92 additions and 11 deletions
|
@ -504,6 +504,10 @@ var FC = {
|
|||
throttleHover: 0,
|
||||
sanityChecks: 0,
|
||||
minSats: 0,
|
||||
ascendRate: 0,
|
||||
descendRate: 0,
|
||||
allowArmingWithoutFix: 0,
|
||||
altitudeMode: 0,
|
||||
};
|
||||
|
||||
RXFAIL_CONFIG = [];
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue