From fc1c30bc3686fee3e9c6d53f1f6380d0a2f8ca15 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 22 Feb 2024 21:31:03 +1100 Subject: [PATCH] AP_MSP: correct compilation when GPS disabled ../../libraries/AP_MSP/AP_MSP_Telem_Backend.cpp: In member function 'virtual void AP_MSP_Telem_Backend::update_gps_state(AP_MSP_Telem_Backend::gps_state_t&)': ../../libraries/AP_MSP/AP_MSP_Telem_Backend.cpp:206:5: error: 'AP_GPS' was not declared in this scope; did you mean 'RAW_GPS'? 206 | AP_GPS& gps = AP::gps(); | ^~~~~~ | RAW_GPS compilation terminated due to -Wfatal-errors. --- libraries/AP_MSP/AP_MSP_Telem_Backend.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/AP_MSP/AP_MSP_Telem_Backend.cpp b/libraries/AP_MSP/AP_MSP_Telem_Backend.cpp index e107dffe5f..9a2d09ba18 100644 --- a/libraries/AP_MSP/AP_MSP_Telem_Backend.cpp +++ b/libraries/AP_MSP/AP_MSP_Telem_Backend.cpp @@ -201,6 +201,7 @@ void AP_MSP_Telem_Backend::update_home_pos(home_state_t &home_state) home_state.home_is_set = _ahrs.home_is_set(); } +#if AP_GPS_ENABLED void AP_MSP_Telem_Backend::update_gps_state(gps_state_t &gps_state) { AP_GPS& gps = AP::gps(); @@ -220,6 +221,7 @@ void AP_MSP_Telem_Backend::update_gps_state(gps_state_t &gps_state) gps_state.ground_course_cd = gps.ground_course_cd(); } } +#endif #if AP_BATTERY_ENABLED void AP_MSP_Telem_Backend::update_battery_state(battery_state_t &battery_state) @@ -645,8 +647,10 @@ MSPCommandResult AP_MSP_Telem_Backend::msp_process_out_raw_gps(sbuf_t *dst) return MSP_RESULT_ERROR; } #endif - gps_state_t gps_state; + gps_state_t gps_state {}; +#if AP_GPS_ENABLED update_gps_state(gps_state); +#endif // handle airspeed override bool airspeed_en = false;