From b14964eb1e70b5cf793e0dec8872282d14bb9cc8 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 14 Jul 2017 12:45:51 +1000 Subject: [PATCH] Copter: move mavlink support for servo/relay up --- ArduCopter/GCS_Mavlink.cpp | 29 +++++------------------------ ArduCopter/GCS_Mavlink.h | 1 + 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/ArduCopter/GCS_Mavlink.cpp b/ArduCopter/GCS_Mavlink.cpp index 07f71f0815..ed69898b5d 100644 --- a/ArduCopter/GCS_Mavlink.cpp +++ b/ArduCopter/GCS_Mavlink.cpp @@ -1259,30 +1259,6 @@ void GCS_MAVLINK_Copter::handleMessage(mavlink_message_t* msg) } break; - case MAV_CMD_DO_SET_SERVO: - if (copter.ServoRelayEvents.do_set_servo(packet.param1, packet.param2)) { - result = MAV_RESULT_ACCEPTED; - } - break; - - case MAV_CMD_DO_REPEAT_SERVO: - if (copter.ServoRelayEvents.do_repeat_servo(packet.param1, packet.param2, packet.param3, packet.param4*1000)) { - result = MAV_RESULT_ACCEPTED; - } - break; - - case MAV_CMD_DO_SET_RELAY: - if (copter.ServoRelayEvents.do_set_relay(packet.param1, packet.param2)) { - result = MAV_RESULT_ACCEPTED; - } - break; - - case MAV_CMD_DO_REPEAT_RELAY: - if (copter.ServoRelayEvents.do_repeat_relay(packet.param1, packet.param2, packet.param3*1000)) { - result = MAV_RESULT_ACCEPTED; - } - break; - case MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN: if (is_equal(packet.param1,1.0f) || is_equal(packet.param1,3.0f)) { AP_Notify::flags.firmware_update = 1; @@ -1976,6 +1952,11 @@ AP_Mission *GCS_MAVLINK_Copter::get_mission() return &copter.mission; } +AP_ServoRelayEvents *GCS_MAVLINK_Copter::get_servorelayevents() const +{ + return &copter.ServoRelayEvents; +} + AP_Rally *GCS_MAVLINK_Copter::get_rally() const { #if AC_RALLY == ENABLED diff --git a/ArduCopter/GCS_Mavlink.h b/ArduCopter/GCS_Mavlink.h index 2653858f9f..abeaae10da 100644 --- a/ArduCopter/GCS_Mavlink.h +++ b/ArduCopter/GCS_Mavlink.h @@ -20,6 +20,7 @@ protected: AP_Mission *get_mission() override; AP_Rally *get_rally() const override; + AP_ServoRelayEvents *get_servorelayevents() const override; uint8_t sysid_my_gcs() const override;