Skip to content

Commit

Permalink
rearrange rescue phase enum and keep Mag during landing (betaflight#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
ctzsnooze authored Oct 11, 2023
1 parent 5d16fee commit e805c73
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/flight/gps_rescue.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ typedef enum {
RESCUE_FLY_HOME,
RESCUE_DESCENT,
RESCUE_LANDING,
RESCUE_DO_NOTHING,
RESCUE_ABORT,
RESCUE_COMPLETE,
RESCUE_DO_NOTHING
RESCUE_COMPLETE
} rescuePhase_e;

typedef enum {
Expand Down Expand Up @@ -988,7 +988,9 @@ bool gpsRescueIsDisabled(void)
#ifdef USE_MAG
bool gpsRescueDisableMag(void)
{
return ((!gpsRescueConfig()->useMag || magForceDisable) && (rescueState.phase >= RESCUE_INITIALIZE) && (rescueState.phase <= RESCUE_LANDING));
// Enable mag on user request, but don't use it during fly home or if force disabled
// Note that while flying home the course over ground from GPS provides a heading that is less affected by wind
return !(gpsRescueConfig()->useMag && rescueState.phase != RESCUE_FLY_HOME && !magForceDisable);
}
#endif
#endif

0 comments on commit e805c73

Please sign in to comment.