1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-15 20:35:23 +03:00

Add more parameters to GPS Rescue

This commit is contained in:
Miguel Angel Mulero Martinez 2019-11-07 15:27:15 +01:00
parent e69c904730
commit 1672a44dc2
7 changed files with 92 additions and 11 deletions

View file

@ -3649,9 +3649,30 @@
"failsafeGpsRescueItemThrottleHover": {
"message": "Throttle hover"
},
"failsafeGpsRescueItemAscendRate": {
"message": "Ascend rate (meters/second)"
},
"failsafeGpsRescueItemDescendRate": {
"message": "Descend rate (meters/second)"
},
"failsafeGpsRescueItemMinSats": {
"message": "Minimum satellites"
},
"failsafeGpsRescueItemAllowArmingWithoutFix": {
"message": "Allow arming without fix - <span class=\"message-negative\">WARNING: the GPS Rescue will not be available</span>"
},
"failsafeGpsRescueItemAltitudeMode": {
"message": "Altitude mode"
},
"failsafeGpsRescueItemAltitudeModeMaxAlt": {
"message": "Maximum altitude"
},
"failsafeGpsRescueItemAltitudeModeFixedAlt": {
"message": "Fixed altitude"
},
"failsafeGpsRescueItemAltitudeModeCurrentAlt": {
"message": "Current altitude"
},
"failsafeGpsRescueItemSanityChecks": {
"message": "Sanity checks"
},

View file

@ -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 {

View file

@ -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;

View file

@ -502,6 +502,10 @@ var FC = {
throttleHover: 0,
sanityChecks: 0,
minSats: 0,
ascendRate: 0,
descendRate: 0,
allowArmingWithoutFix: 0,
altitudeMode: 0,
};
RXFAIL_CONFIG = [];

View file

@ -435,6 +435,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();
@ -1705,6 +1711,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));

View file

@ -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);
}

View file

@ -44,7 +44,7 @@
<div class="spacer_box_title" i18n="failsafeSwitchTitle"></div>
</div>
<div class="spacer_box">
<div class="selectSwitchMode">
<div class="number">
<label>
<select class="switchMode" name="failsafe_switch_mode">
<option value="0" i18n="failsafeSwitchOptionStage1"></option>
@ -152,12 +152,37 @@
i18n="failsafeGpsRescueItemThrottleHover"></span>
</label>
</div>
<div class="number">
<label> <input type="number" name="gps_rescue_ascend_rate" min="1.00" max="25.00" step="0.01" /> <span
i18n="failsafeGpsRescueItemAscendRate"></span>
</label>
</div>
<div class="number">
<label> <input type="number" name="gps_rescue_descend_rate" min="1.00" max="5.00" step="0.01" /> <span
i18n="failsafeGpsRescueItemDescendRate"></span>
</label>
</div>
<div class="number">
<label> <input type="number" name="gps_rescue_min_sats" min="5" max="50" /> <span
i18n="failsafeGpsRescueItemMinSats"></span>
</label>
</div>
<div class="selectSwitchMode">
<div class="number">
<label> <input type="checkbox" name="gps_rescue_allow_arming_without_fix" class="toggle" /> <span
i18n="failsafeGpsRescueItemAllowArmingWithoutFix"></span>
</label>
</div>
<div class="number">
<label>
<select 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>
</select>
<span i18n="failsafeGpsRescueItemAltitudeMode"></span>
</label>
</div>
<div class="number">
<label>
<select class="switchMode" name="gps_rescue_sanity_checks">
<option value="0" i18n="failsafeGpsRescueItemSanityChecksOff"></option>