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.
This commit is contained in:
Peter Barker 2024-02-22 21:31:03 +11:00 committed by Peter Barker
parent 957b05e53e
commit fc1c30bc36
1 changed files with 5 additions and 1 deletions

View File

@ -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(); 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) void AP_MSP_Telem_Backend::update_gps_state(gps_state_t &gps_state)
{ {
AP_GPS& gps = AP::gps(); 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(); gps_state.ground_course_cd = gps.ground_course_cd();
} }
} }
#endif
#if AP_BATTERY_ENABLED #if AP_BATTERY_ENABLED
void AP_MSP_Telem_Backend::update_battery_state(battery_state_t &battery_state) 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; return MSP_RESULT_ERROR;
} }
#endif #endif
gps_state_t gps_state; gps_state_t gps_state {};
#if AP_GPS_ENABLED
update_gps_state(gps_state); update_gps_state(gps_state);
#endif
// handle airspeed override // handle airspeed override
bool airspeed_en = false; bool airspeed_en = false;