AP_MSP: aligned opflow and rangefinder struct names to gps, baro and mag

This commit is contained in:
yaapu 2020-09-08 00:27:45 +02:00 committed by Andrew Tridgell
parent e95a44e73c
commit 747bf73fec
3 changed files with 9 additions and 11 deletions

View File

@ -468,12 +468,12 @@ MSPCommandResult AP_MSP_Telem_Backend::msp_process_sensor_command(uint16_t cmd_m
switch (cmd_msp) {
case MSP2_SENSOR_RANGEFINDER: {
const MSP::msp_rangefinder_sensor_t *pkt = (const MSP::msp_rangefinder_sensor_t *)src->ptr;
const MSP::msp_rangefinder_data_message_t *pkt = (const MSP::msp_rangefinder_data_message_t *)src->ptr;
msp_handle_rangefinder(*pkt);
}
break;
case MSP2_SENSOR_OPTIC_FLOW: {
const MSP::msp_opflow_sensor_t *pkt = (const MSP::msp_opflow_sensor_t *)src->ptr;
const MSP::msp_opflow_data_message_t *pkt = (const MSP::msp_opflow_data_message_t *)src->ptr;
msp_handle_opflow(*pkt);
}
break;
@ -497,7 +497,7 @@ MSPCommandResult AP_MSP_Telem_Backend::msp_process_sensor_command(uint16_t cmd_m
return MSP_RESULT_NO_REPLY;
}
void AP_MSP_Telem_Backend::msp_handle_opflow(const MSP::msp_opflow_sensor_t &pkt)
void AP_MSP_Telem_Backend::msp_handle_opflow(const MSP::msp_opflow_data_message_t &pkt)
{
#if HAL_MSP_OPTICALFLOW_ENABLED
OpticalFlow *optflow = AP::opticalflow();
@ -508,7 +508,7 @@ void AP_MSP_Telem_Backend::msp_handle_opflow(const MSP::msp_opflow_sensor_t &pkt
#endif
}
void AP_MSP_Telem_Backend::msp_handle_rangefinder(const MSP::msp_rangefinder_sensor_t &pkt)
void AP_MSP_Telem_Backend::msp_handle_rangefinder(const MSP::msp_rangefinder_data_message_t &pkt)
{
#if HAL_MSP_RANGEFINDER_ENABLED
RangeFinder *rangefinder = AP::rangefinder();

View File

@ -159,8 +159,8 @@ protected:
MSP::MSPCommandResult msp_process_out_command(uint16_t cmd_msp, MSP::sbuf_t *dst);
// MSP sensor command processing
void msp_handle_opflow(const MSP::msp_opflow_sensor_t &pkt);
void msp_handle_rangefinder(const MSP::msp_rangefinder_sensor_t &pkt);
void msp_handle_opflow(const MSP::msp_opflow_data_message_t &pkt);
void msp_handle_rangefinder(const MSP::msp_rangefinder_data_message_t &pkt);
void msp_handle_gps(const MSP::msp_gps_data_message_t &pkt);
void msp_handle_compass(const MSP::msp_compass_data_message_t &pkt);
void msp_handle_baro(const MSP::msp_baro_data_message_t &pkt);

View File

@ -2,20 +2,18 @@
namespace MSP
{
// inav/src/main/io/rangefinder_msp.c
// src/main/msp/msp_protocol_v2_sensor_msg.h
typedef struct PACKED {
uint8_t quality; // [0;255]
int32_t distance_mm; // Negative value for out of range
} msp_rangefinder_sensor_t;
} msp_rangefinder_data_message_t;
// inav/src/main/io/opflow_msp.c
typedef struct PACKED {
uint8_t quality; // [0;255]
int32_t motion_x;
int32_t motion_y;
} msp_opflow_sensor_t;
} msp_opflow_data_message_t;
// inav/src/main/io/gps_msp.c
typedef struct PACKED {
uint8_t instance; // sensor instance number to support multi-sensor setups
uint16_t gps_week; // GPS week, 0xFFFF if not available