Skip to content

Commit

Permalink
add failsafe logic
Browse files Browse the repository at this point in the history
  • Loading branch information
breadoven committed Jun 13, 2024
1 parent 8449e0d commit 456c49a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -3474,7 +3474,7 @@ Defines at what altitude the descent velocity should start to be `nav_land_minal

### nav_landing_bump_detection

Allows immediate landing detection based on G bump at touchdown when set to ON. Requires a barometer and currently only works for multirotors.
Allows immediate landing detection based on G bump at touchdown when set to ON. Requires a barometer and GPS and currently only works for multirotors (Note: will work during Failsafe without need for a GPS).

| Default | Min | Max |
| --- | --- | --- |
Expand Down
2 changes: 1 addition & 1 deletion src/main/fc/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2463,7 +2463,7 @@ groups:
min: 1
max: 15
- name: nav_landing_bump_detection
description: "Allows immediate landing detection based on G bump at touchdown when set to ON. Requires a barometer and currently only works for multirotors."
description: "Allows immediate landing detection based on G bump at touchdown when set to ON. Requires a barometer and GPS and currently only works for multirotors (Note: will work during Failsafe without need for a GPS)."
default_value: OFF
field: general.flags.landing_bump_detection
type: bool
Expand Down
9 changes: 5 additions & 4 deletions src/main/navigation/navigation_multicopter.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,11 +802,12 @@ bool isMulticopterLandingDetected(void)
const timeMs_t currentTimeMs = millis();

#if defined(USE_BARO)
/* G bump landing detection only active when xy velocity is usable and low */
if (sensors(SENSOR_BARO) && navConfig()->general.flags.landing_bump_detection &&
posControl.flags.estPosStatus >= EST_USABLE && posControl.actualState.velXY < MC_LAND_CHECK_VEL_XY_MOVING &&
isLandingGbumpDetected(currentTimeMs)) { // CR129
/* G bump landing detection only used when xy velocity is usable and low or failsafe is active */
bool gBumpDetectionUsable = navConfig()->general.flags.landing_bump_detection && sensors(SENSOR_BARO) &&
((posControl.flags.estPosStatus >= EST_USABLE && posControl.actualState.velXY < MC_LAND_CHECK_VEL_XY_MOVING) ||
FLIGHT_MODE(FAILSAFE_MODE));

if (gBumpDetectionUsable && isLandingGbumpDetected(currentTimeMs)) {
return true; // Landing flagged immediately if landing bump detected
}
#endif
Expand Down

0 comments on commit 456c49a

Please sign in to comment.