Merge pull request #6404 from s0up/rescue_config_change

[GPS Rescue] - Allow minimum distance to home to be configurable.
This commit is contained in:
Michael Keller 2018-08-17 00:22:52 +12:00 committed by GitHub
commit 18cc9ef15a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

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

View File

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

View File

@ -768,6 +768,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_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_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_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, 1000 }, PG_GPS_RESCUE, offsetof(gpsRescueConfig_t, minRescueDth) },
#endif #endif
#endif #endif