From 3480a8f9f96b5dd4bd29f0c9b75d7d6c7d85b012 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Sat, 16 Jul 2022 10:42:08 +1000 Subject: [PATCH] ArduCopter: save some bytes by removing empty methods based on #ifs --- ArduCopter/GCS_Mavlink.cpp | 8 ++++---- ArduCopter/GCS_Mavlink.h | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ArduCopter/GCS_Mavlink.cpp b/ArduCopter/GCS_Mavlink.cpp index 73e5b7e0a0..2addbb8f0a 100644 --- a/ArduCopter/GCS_Mavlink.cpp +++ b/ArduCopter/GCS_Mavlink.cpp @@ -729,10 +729,10 @@ MAV_RESULT GCS_MAVLINK_Copter::handle_command_int_packet(const mavlink_command_i } } +#if HAL_MOUNT_ENABLED MAV_RESULT GCS_MAVLINK_Copter::handle_command_mount(const mavlink_command_long_t &packet) { switch (packet.command) { -#if HAL_MOUNT_ENABLED case MAV_CMD_DO_MOUNT_CONTROL: // if vehicle has a camera mount but it doesn't do pan control then yaw the entire vehicle instead if ((copter.camera_mount.get_mount_type() != copter.camera_mount.MountType::Mount_Type_None) && @@ -742,12 +742,12 @@ MAV_RESULT GCS_MAVLINK_Copter::handle_command_mount(const mavlink_command_long_t 0.0f); } break; -#endif default: break; } return GCS_MAVLINK::handle_command_mount(packet); } +#endif MAV_RESULT GCS_MAVLINK_Copter::handle_command_long_packet(const mavlink_command_long_t &packet) { @@ -1025,10 +1025,10 @@ MAV_RESULT GCS_MAVLINK_Copter::handle_command_pause_continue(const mavlink_comma return MAV_RESULT_DENIED; } +#if HAL_MOUNT_ENABLED void GCS_MAVLINK_Copter::handle_mount_message(const mavlink_message_t &msg) { switch (msg.msgid) { -#if HAL_MOUNT_ENABLED case MAVLINK_MSG_ID_MOUNT_CONTROL: // if vehicle has a camera mount but it doesn't do pan control then yaw the entire vehicle instead if ((copter.camera_mount.get_mount_type() != copter.camera_mount.MountType::Mount_Type_None) && @@ -1039,10 +1039,10 @@ void GCS_MAVLINK_Copter::handle_mount_message(const mavlink_message_t &msg) break; } -#endif } GCS_MAVLINK::handle_mount_message(msg); } +#endif void GCS_MAVLINK_Copter::handleMessage(const mavlink_message_t &msg) { diff --git a/ArduCopter/GCS_Mavlink.h b/ArduCopter/GCS_Mavlink.h index 74230150b2..4f9c662fd8 100644 --- a/ArduCopter/GCS_Mavlink.h +++ b/ArduCopter/GCS_Mavlink.h @@ -29,13 +29,17 @@ protected: MAV_RESULT handle_command_do_set_roi(const Location &roi_loc) override; MAV_RESULT handle_preflight_reboot(const mavlink_command_long_t &packet) override; +#if HAL_MOUNT_ENABLED MAV_RESULT handle_command_mount(const mavlink_command_long_t &packet) override; +#endif MAV_RESULT handle_command_int_packet(const mavlink_command_int_t &packet) override; MAV_RESULT handle_command_long_packet(const mavlink_command_long_t &packet) override; MAV_RESULT handle_command_int_do_reposition(const mavlink_command_int_t &packet); MAV_RESULT handle_command_pause_continue(const mavlink_command_int_t &packet); +#if HAL_MOUNT_ENABLED void handle_mount_message(const mavlink_message_t &msg) override; +#endif void handle_landing_target(const mavlink_landing_target_t &packet, uint32_t timestamp_ms) override;