Skip to content

Commit

Permalink
AP_MSP: correct compilation when GPS disabled
Browse files Browse the repository at this point in the history
../../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.
  • Loading branch information
peterbarker committed Feb 25, 2024
1 parent 957b05e commit fc1c30b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libraries/AP_MSP/AP_MSP_Telem_Backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit fc1c30b

Please sign in to comment.