From 4aa10a6c30acabdb395ea42643f1e97b21113ac6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 21 May 2020 12:24:02 +1000 Subject: [PATCH] AP_GPS: added force_disable_yaw() API --- libraries/AP_GPS/AP_GPS.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libraries/AP_GPS/AP_GPS.h b/libraries/AP_GPS/AP_GPS.h index 6550c7cbaf..49e016122e 100644 --- a/libraries/AP_GPS/AP_GPS.h +++ b/libraries/AP_GPS/AP_GPS.h @@ -379,7 +379,7 @@ public: // return true if the GPS currently has yaw available bool have_gps_yaw(uint8_t instance) const { - return state[instance].have_gps_yaw; + return !_force_disable_gps_yaw && state[instance].have_gps_yaw; } bool have_gps_yaw(void) const { return have_gps_yaw(primary_instance); @@ -468,6 +468,11 @@ public: _force_disable_gps = disable; } + // used to disable GPS yaw for GPS failure testing in flight + void set_force_disable_yaw(bool disable) { + _force_disable_gps_yaw = disable; + } + // handle possibly fragmented RTCM injection data void handle_gps_rtcm_fragment(uint8_t flags, const uint8_t *data, uint8_t len); @@ -630,6 +635,9 @@ private: // used for flight testing with GPS loss bool _force_disable_gps; + // used for flight testing with GPS yaw loss + bool _force_disable_gps_yaw; + // used to ensure we continue sending status messages if we ever detected the second GPS bool has_had_second_instance; };