diff --git a/conf/airframes/AirborneCodeReorg/TinyFw.xml b/conf/airframes/AirborneCodeReorg/TinyFw.xml index d3b11146be..c2cb3c1c8c 100644 --- a/conf/airframes/AirborneCodeReorg/TinyFw.xml +++ b/conf/airframes/AirborneCodeReorg/TinyFw.xml @@ -162,14 +162,12 @@ - - - + diff --git a/sw/airborne/gps.h b/sw/airborne/gps.h index 6103d546bc..f6a213912c 100644 --- a/sw/airborne/gps.h +++ b/sw/airborne/gps.h @@ -27,7 +27,6 @@ * */ - #ifndef GPS_H #define GPS_H @@ -120,6 +119,12 @@ extern struct svinfo gps_svinfos[GPS_NB_CHANNELS]; #define GpsToggleLed() {} #endif +#ifdef GPS +#define GpsTimeoutError (cpu_time_sec - last_gps_msg_t > FAILSAFE_DELAY_WITHOUT_GPS) +#else +#define GpsTimeoutError 1 +#endif + #define UseGpsPosNoSend(_callback) { \ if (GpsFixValid()) { \ last_gps_msg_t = cpu_time_sec; \ diff --git a/sw/airborne/main_ap.c b/sw/airborne/main_ap.c index 3f53cc41fb..c0597deabe 100644 --- a/sw/airborne/main_ap.c +++ b/sw/airborne/main_ap.c @@ -193,6 +193,7 @@ float energy; // Fuel consumption (mAh) bool_t gps_lost = FALSE; + #define Min(x, y) (x < y ? x : y) #define Max(x, y) (x > y ? x : y) @@ -346,7 +347,7 @@ static void navigation_task( void ) { /** If aircraft is launched and is in autonomus mode, go into PPRZ_MODE_GPS_OUT_OF_ORDER mode (Failsafe) if we lost the GPS */ if (launch) { - if (cpu_time_sec - last_gps_msg_t > FAILSAFE_DELAY_WITHOUT_GPS) { + if (GpsTimeoutError) { if (pprz_mode == PPRZ_MODE_AUTO2 || pprz_mode == PPRZ_MODE_HOME) { last_pprz_mode = pprz_mode; pprz_mode = PPRZ_MODE_GPS_OUT_OF_ORDER;