1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-26 17:55:28 +03:00

Move check for valid GPS heading to a function

Allows calling it from both the IMU and the wind estimator
This commit is contained in:
Alberto García Hierro 2017-11-03 15:18:02 +00:00
parent c52f687ec5
commit 78e62d36a8
3 changed files with 8 additions and 1 deletions

View file

@ -463,7 +463,7 @@ static void imuCalculateEstimatedAttitude(float dT)
#if defined(USE_GPS) #if defined(USE_GPS)
if (STATE(FIXED_WING)) { if (STATE(FIXED_WING)) {
bool canUseCOG = sensors(SENSOR_GPS) && STATE(GPS_FIX) && gpsSol.numSat >= 6 && gpsSol.groundSpeed >= 300; bool canUseCOG = isGPSHeadingValid();
if (canUseCOG) { if (canUseCOG) {
if (gpsHeadingInitialized) { if (gpsHeadingInitialized) {

View file

@ -546,4 +546,10 @@ bool isGPSHealthy(void)
{ {
return true; return true;
} }
bool isGPSHeadingValid(void)
{
return sensors(SENSOR_GPS) && STATE(GPS_FIX) && gpsSol.numSat >= 6 && gpsSol.groundSpeed >= 300;
}
#endif #endif

View file

@ -157,5 +157,6 @@ void gpsInit(void);
void gpsThread(void); void gpsThread(void);
void updateGpsIndicator(timeUs_t currentTimeUs); void updateGpsIndicator(timeUs_t currentTimeUs);
bool isGPSHealthy(void); bool isGPSHealthy(void);
bool isGPSHeadingValid(void);
struct serialPort_s; struct serialPort_s;
void gpsEnablePassthrough(struct serialPort_s *gpsPassthroughPort); void gpsEnablePassthrough(struct serialPort_s *gpsPassthroughPort);