AP_MSP: check for MSP rangefinder enable

This commit is contained in:
Andrew Tridgell 2020-08-31 19:16:43 +10:00
parent 84f7589f2d
commit 8319b7b6b7

View File

@ -489,11 +489,13 @@ void AP_MSP_Telem_Backend::msp_handle_opflow(const msp_opflow_sensor_t &pkt)
void AP_MSP_Telem_Backend::msp_handle_rangefinder(const msp_rangefinder_sensor_t &pkt) void AP_MSP_Telem_Backend::msp_handle_rangefinder(const msp_rangefinder_sensor_t &pkt)
{ {
#if HAL_MSP_RANGEFINDER_ENABLED
RangeFinder *rangefinder = AP::rangefinder(); RangeFinder *rangefinder = AP::rangefinder();
if (rangefinder == nullptr) { if (rangefinder == nullptr) {
return; return;
} }
rangefinder->handle_msp(pkt); rangefinder->handle_msp(pkt);
#endif
} }
MSPCommandResult AP_MSP_Telem_Backend::msp_process_out_raw_gps(sbuf_t *dst) MSPCommandResult AP_MSP_Telem_Backend::msp_process_out_raw_gps(sbuf_t *dst)