1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

add min rescue distance configuration parameter

This commit is contained in:
s0up 2018-07-19 23:29:48 -07:00
parent f2468fb894
commit d7909df3ba
3 changed files with 7 additions and 4 deletions

View file

@ -72,7 +72,8 @@ PG_RESET_TEMPLATE(gpsRescueConfig_t, gpsRescueConfig,
.throttleMax = 1600,
.throttleHover = 1280,
.sanityChecks = RESCUE_SANITY_ON,
.minSats = 8
.minSats = 8,
.minRescueDTH = 100
);
static uint16_t rescueThrottle;
@ -123,9 +124,9 @@ void updateGPSRescueState(void)
hoverThrottle = gpsRescueConfig()->throttleHover;
}
// Minimum distance detection (100m). Disarm regardless of sanity check configuration. Rescue too close is never a good idea.
if (rescueState.sensor.distanceToHome < 100) {
// Never allow rescue mode to engage as a failsafe within 100 meters or when disarmed.
// Minimum distance detection. Disarm regardless of sanity check configuration. Rescue too close is never a good idea.
if (rescueState.sensor.distanceToHome < gpsRescueConfig()->minRescueDTH) {
// Never allow rescue mode to engage as a failsafe when too close or when disarmed.
if (rescueState.isFailsafe || !ARMING_FLAG(ARMED)) {
rescueState.failure = RESCUE_TOO_CLOSE;
setArmingDisabled(ARMING_DISABLED_ARM_SWITCH);

View file

@ -37,6 +37,7 @@ typedef struct gpsRescue_s {
uint16_t throttleHover;
uint16_t velP, velI, velD;
uint8_t minSats;
uint8_t minRescueDTH; //meters
gpsRescueSanity_e sanityChecks;
} gpsRescueConfig_t;

View file

@ -761,6 +761,7 @@ const clivalue_t valueTable[] = {
{ "gps_rescue_throttle_hover", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 1000, 2000 }, PG_GPS_RESCUE, offsetof(gpsRescueConfig_t, throttleHover) },
{ "gps_rescue_sanity_checks", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_GPS_RESCUE }, PG_GPS_RESCUE, offsetof(gpsRescueConfig_t, sanityChecks) },
{ "gps_rescue_min_sats", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 50 }, PG_GPS_RESCUE, offsetof(gpsRescueConfig_t, minSats) },
{ "gps_rescue_min_dth", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 50, 32000 }, PG_GPS_RESCUE, offsetof(gpsRescueConfig_t, minRescueDTH) },
#endif
#endif