From 53ea3852912e27b6576e69a1fe35fcc3e2bb61a4 Mon Sep 17 00:00:00 2001 From: yaapu Date: Tue, 7 Sep 2021 10:21:16 +0200 Subject: [PATCH] AP_MSP: removed unnecessary pure virtual methods --- libraries/AP_MSP/AP_MSP_Telem_Backend.cpp | 38 +++++++++++++++++++ libraries/AP_MSP/AP_MSP_Telem_Backend.h | 6 +-- libraries/AP_MSP/AP_MSP_Telem_DJI.cpp | 32 ---------------- libraries/AP_MSP/AP_MSP_Telem_DJI.h | 2 - libraries/AP_MSP/AP_MSP_Telem_DisplayPort.cpp | 32 ---------------- libraries/AP_MSP/AP_MSP_Telem_DisplayPort.h | 2 - libraries/AP_MSP/AP_MSP_Telem_Generic.cpp | 38 ------------------- libraries/AP_MSP/AP_MSP_Telem_Generic.h | 3 -- 8 files changed, 41 insertions(+), 112 deletions(-) diff --git a/libraries/AP_MSP/AP_MSP_Telem_Backend.cpp b/libraries/AP_MSP/AP_MSP_Telem_Backend.cpp index a944ac0db5..599fa40947 100644 --- a/libraries/AP_MSP/AP_MSP_Telem_Backend.cpp +++ b/libraries/AP_MSP/AP_MSP_Telem_Backend.cpp @@ -576,6 +576,44 @@ void AP_MSP_Telem_Backend::msp_handle_airspeed(const MSP::msp_airspeed_data_mess #endif } +MSPCommandResult AP_MSP_Telem_Backend::msp_process_out_api_version(sbuf_t *dst) +{ + const struct { + uint8_t proto; + uint8_t major; + uint8_t minor; + } api_version { + proto : MSP_PROTOCOL_VERSION, + major : API_VERSION_MAJOR, + minor : API_VERSION_MINOR + }; + + sbuf_write_data(dst, &api_version, sizeof(api_version)); + return MSP_RESULT_ACK; +} + +MSPCommandResult AP_MSP_Telem_Backend::msp_process_out_fc_version(sbuf_t *dst) +{ + const struct { + uint8_t major; + uint8_t minor; + uint8_t patch; + } fc_version { + major : FC_VERSION_MAJOR, + minor : FC_VERSION_MINOR, + patch : FC_VERSION_PATCH_LEVEL + }; + + sbuf_write_data(dst, &fc_version, sizeof(fc_version)); + return MSP_RESULT_ACK; +} + +MSPCommandResult AP_MSP_Telem_Backend::msp_process_out_fc_variant(sbuf_t *dst) +{ + sbuf_write_data(dst, "ARDU", FLIGHT_CONTROLLER_IDENTIFIER_LENGTH); + return MSP_RESULT_ACK; +} + MSPCommandResult AP_MSP_Telem_Backend::msp_process_out_raw_gps(sbuf_t *dst) { #if OSD_ENABLED diff --git a/libraries/AP_MSP/AP_MSP_Telem_Backend.h b/libraries/AP_MSP/AP_MSP_Telem_Backend.h index 2decbabcfe..0ff57b5e1d 100644 --- a/libraries/AP_MSP/AP_MSP_Telem_Backend.h +++ b/libraries/AP_MSP/AP_MSP_Telem_Backend.h @@ -191,9 +191,9 @@ protected: virtual AP_SerialManager::SerialProtocol get_serial_protocol() const = 0; // implementation specific MSP out command processing - virtual MSP::MSPCommandResult msp_process_out_api_version(MSP::sbuf_t *dst) = 0; - virtual MSP::MSPCommandResult msp_process_out_fc_version(MSP::sbuf_t *dst) = 0; - virtual MSP::MSPCommandResult msp_process_out_fc_variant(MSP::sbuf_t *dst) = 0; + virtual MSP::MSPCommandResult msp_process_out_api_version(MSP::sbuf_t *dst); + virtual MSP::MSPCommandResult msp_process_out_fc_version(MSP::sbuf_t *dst); + virtual MSP::MSPCommandResult msp_process_out_fc_variant(MSP::sbuf_t *dst); virtual MSP::MSPCommandResult msp_process_out_uid(MSP::sbuf_t *dst); virtual MSP::MSPCommandResult msp_process_out_board_info(MSP::sbuf_t *dst); virtual MSP::MSPCommandResult msp_process_out_build_info(MSP::sbuf_t *dst); diff --git a/libraries/AP_MSP/AP_MSP_Telem_DJI.cpp b/libraries/AP_MSP/AP_MSP_Telem_DJI.cpp index b269614eee..d062a8d131 100644 --- a/libraries/AP_MSP/AP_MSP_Telem_DJI.cpp +++ b/libraries/AP_MSP/AP_MSP_Telem_DJI.cpp @@ -82,38 +82,6 @@ uint32_t AP_MSP_Telem_DJI::get_osd_flight_mode_bitmask(void) return mode_mask; } -MSPCommandResult AP_MSP_Telem_DJI::msp_process_out_api_version(sbuf_t *dst) -{ - const struct { - uint8_t proto; - uint8_t major; - uint8_t minor; - } api_version { - proto : MSP_PROTOCOL_VERSION, - major : API_VERSION_MAJOR, - minor : API_VERSION_MINOR - }; - - sbuf_write_data(dst, &api_version, sizeof(api_version)); - return MSP_RESULT_ACK; -} - -MSPCommandResult AP_MSP_Telem_DJI::msp_process_out_fc_version(sbuf_t *dst) -{ - const struct { - uint8_t major; - uint8_t minor; - uint8_t patch; - } fc_version { - major : FC_VERSION_MAJOR, - minor : FC_VERSION_MINOR, - patch : FC_VERSION_PATCH_LEVEL - }; - - sbuf_write_data(dst, &fc_version, sizeof(fc_version)); - return MSP_RESULT_ACK; -} - MSPCommandResult AP_MSP_Telem_DJI::msp_process_out_fc_variant(sbuf_t *dst) { sbuf_write_data(dst, "BTFL", FLIGHT_CONTROLLER_IDENTIFIER_LENGTH); diff --git a/libraries/AP_MSP/AP_MSP_Telem_DJI.h b/libraries/AP_MSP/AP_MSP_Telem_DJI.h index 29c62f12f2..60b4fb3b81 100644 --- a/libraries/AP_MSP/AP_MSP_Telem_DJI.h +++ b/libraries/AP_MSP/AP_MSP_Telem_DJI.h @@ -55,8 +55,6 @@ public: AP_SerialManager::SerialProtocol get_serial_protocol() const override { return AP_SerialManager::SerialProtocol::SerialProtocol_DJI_FPV; }; uint32_t get_osd_flight_mode_bitmask(void) override; void hide_osd_items(void) override; - MSP::MSPCommandResult msp_process_out_api_version(MSP::sbuf_t *dst) override; - MSP::MSPCommandResult msp_process_out_fc_version(MSP::sbuf_t *dst) override; MSP::MSPCommandResult msp_process_out_fc_variant(MSP::sbuf_t *dst) override; MSP::MSPCommandResult msp_process_out_esc_sensor_data(MSP::sbuf_t *dst) override; diff --git a/libraries/AP_MSP/AP_MSP_Telem_DisplayPort.cpp b/libraries/AP_MSP/AP_MSP_Telem_DisplayPort.cpp index 8d7d7cefaf..d95d009bda 100644 --- a/libraries/AP_MSP/AP_MSP_Telem_DisplayPort.cpp +++ b/libraries/AP_MSP/AP_MSP_Telem_DisplayPort.cpp @@ -25,38 +25,6 @@ extern const AP_HAL::HAL& hal; using namespace MSP; -MSPCommandResult AP_MSP_Telem_DisplayPort::msp_process_out_api_version(sbuf_t *dst) -{ - const struct { - uint8_t proto; - uint8_t major; - uint8_t minor; - } api_version { - proto : MSP_PROTOCOL_VERSION, - major : API_VERSION_MAJOR, - minor : API_VERSION_MINOR - }; - - sbuf_write_data(dst, &api_version, sizeof(api_version)); - return MSP_RESULT_ACK; -} - -MSPCommandResult AP_MSP_Telem_DisplayPort::msp_process_out_fc_version(sbuf_t *dst) -{ - const struct { - uint8_t major; - uint8_t minor; - uint8_t patch; - } fc_version { - major : FC_VERSION_MAJOR, - minor : FC_VERSION_MINOR, - patch : FC_VERSION_PATCH_LEVEL - }; - - sbuf_write_data(dst, &fc_version, sizeof(fc_version)); - return MSP_RESULT_ACK; -} - MSPCommandResult AP_MSP_Telem_DisplayPort::msp_process_out_fc_variant(sbuf_t *dst) { const AP_MSP *msp = AP::msp(); diff --git a/libraries/AP_MSP/AP_MSP_Telem_DisplayPort.h b/libraries/AP_MSP/AP_MSP_Telem_DisplayPort.h index e6d0df29b3..45b9bf5273 100644 --- a/libraries/AP_MSP/AP_MSP_Telem_DisplayPort.h +++ b/libraries/AP_MSP/AP_MSP_Telem_DisplayPort.h @@ -28,8 +28,6 @@ public: bool use_msp_thread() const override { return false; } AP_SerialManager::SerialProtocol get_serial_protocol() const override { return AP_SerialManager::SerialProtocol::SerialProtocol_MSP_DisplayPort; }; - MSP::MSPCommandResult msp_process_out_api_version(MSP::sbuf_t *dst) override; - MSP::MSPCommandResult msp_process_out_fc_version(MSP::sbuf_t *dst) override; MSP::MSPCommandResult msp_process_out_fc_variant(MSP::sbuf_t *dst) override; }; diff --git a/libraries/AP_MSP/AP_MSP_Telem_Generic.cpp b/libraries/AP_MSP/AP_MSP_Telem_Generic.cpp index c43a27bd76..eb5d192198 100644 --- a/libraries/AP_MSP/AP_MSP_Telem_Generic.cpp +++ b/libraries/AP_MSP/AP_MSP_Telem_Generic.cpp @@ -25,42 +25,4 @@ extern const AP_HAL::HAL& hal; using namespace MSP; -MSPCommandResult AP_MSP_Telem_Generic::msp_process_out_api_version(sbuf_t *dst) -{ - const struct { - uint8_t proto; - uint8_t major; - uint8_t minor; - } api_version { - proto : MSP_PROTOCOL_VERSION, - major : API_VERSION_MAJOR, - minor : API_VERSION_MINOR - }; - - sbuf_write_data(dst, &api_version, sizeof(api_version)); - return MSP_RESULT_ACK; -} - -MSPCommandResult AP_MSP_Telem_Generic::msp_process_out_fc_version(sbuf_t *dst) -{ - const struct { - uint8_t major; - uint8_t minor; - uint8_t patch; - } fc_version { - major : FC_VERSION_MAJOR, - minor : FC_VERSION_MINOR, - patch : FC_VERSION_PATCH_LEVEL - }; - - sbuf_write_data(dst, &fc_version, sizeof(fc_version)); - return MSP_RESULT_ACK; -} - -MSPCommandResult AP_MSP_Telem_Generic::msp_process_out_fc_variant(sbuf_t *dst) -{ - sbuf_write_data(dst, "ARDU", FLIGHT_CONTROLLER_IDENTIFIER_LENGTH); - return MSP_RESULT_ACK; -} - #endif //HAL_MSP_ENABLED diff --git a/libraries/AP_MSP/AP_MSP_Telem_Generic.h b/libraries/AP_MSP/AP_MSP_Telem_Generic.h index a33ea3bd97..e762cd6a59 100644 --- a/libraries/AP_MSP/AP_MSP_Telem_Generic.h +++ b/libraries/AP_MSP/AP_MSP_Telem_Generic.h @@ -26,9 +26,6 @@ class AP_MSP_Telem_Generic : public AP_MSP_Telem_Backend public: bool is_scheduler_enabled() const override { return false; } AP_SerialManager::SerialProtocol get_serial_protocol() const override { return AP_SerialManager::SerialProtocol::SerialProtocol_MSP; }; - MSP::MSPCommandResult msp_process_out_api_version(MSP::sbuf_t *dst) override; - MSP::MSPCommandResult msp_process_out_fc_version(MSP::sbuf_t *dst) override; - MSP::MSPCommandResult msp_process_out_fc_variant(MSP::sbuf_t *dst) override; }; #endif //HAL_MSP_ENABLED