1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 05:15:25 +03:00

add gps rescue mode

This commit is contained in:
s0up 2018-05-15 14:32:03 -07:00 committed by Diego Basch
parent 43c706fc95
commit ac6b8088c9
24 changed files with 653 additions and 32 deletions

View file

@ -90,6 +90,7 @@
#include "flight/mixer.h"
#include "flight/pid.h"
#include "flight/servos.h"
#include "flight/gps_rescue.h"
// June 2013 V2.2-dev
@ -254,6 +255,16 @@ void updateArmingStatus(void)
}
}
#ifdef USE_GPS_RESCUE
if (isModeActivationConditionPresent(BOXGPSRESCUE)) {
if (rescueState.sensor.numSat < gpsRescue()->minSats) {
setArmingDisabled(ARMING_DISABLED_GPS);
} else {
unsetArmingDisabled(ARMING_DISABLED_GPS);
}
}
#endif
if (IS_RC_MODE_ACTIVE(BOXPARALYZE) && paralyzeModeAllowed) {
setArmingDisabled(ARMING_DISABLED_PARALYZE);
dispatchAdd(&preventModeChangesDispatchEntry, PARALYZE_PREVENT_MODE_CHANGES_DELAY_US);
@ -737,6 +748,14 @@ bool processRx(timeUs_t currentTimeUs)
DISABLE_FLIGHT_MODE(HORIZON_MODE);
}
if (IS_RC_MODE_ACTIVE(BOXGPSRESCUE) || (failsafeIsActive() && failsafeConfig()->failsafe_procedure == FAILSAFE_PROCEDURE_GPS_RESCUE)) {
if (!FLIGHT_MODE(GPS_RESCUE_MODE)) {
ENABLE_FLIGHT_MODE(GPS_RESCUE_MODE);
}
} else {
DISABLE_FLIGHT_MODE(GPS_RESCUE_MODE);
}
if (FLIGHT_MODE(ANGLE_MODE) || FLIGHT_MODE(HORIZON_MODE)) {
LED1_ON;
// increase frequency of attitude task to reduce drift when in angle or horizon mode
@ -884,6 +903,10 @@ static NOINLINE void subTaskMainSubprocesses(timeUs_t currentTimeUs)
updateMagHold();
}
#endif
#ifdef USE_GPS_RESCUE
updateGPSRescueState();
#endif
// If we're armed, at minimum throttle, and we do arming via the
// sticks, do not process yaw input from the rx. We do this so the