Skip to content

Commit

Permalink
AP_MSP: aligned opflow and rangefinder struct names to gps, baro and mag
Browse files Browse the repository at this point in the history
  • Loading branch information
yaapu authored and tridge committed Sep 8, 2020
1 parent e95a44e commit 747bf73
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
8 changes: 4 additions & 4 deletions libraries/AP_MSP/AP_MSP_Telem_Backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand All @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions libraries/AP_MSP/AP_MSP_Telem_Backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ class AP_MSP_Telem_Backend : AP_RCTelemetry
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);
Expand Down
8 changes: 3 additions & 5 deletions libraries/AP_MSP/msp_sensors.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 747bf73

Please sign in to comment.