From f2a780dffdbb1c338e2f6c137941b9afbe7fcd0a Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 4 Sep 2015 14:56:42 +0200 Subject: [PATCH] Manual control: Add switches --- src/modules/mavlink/mavlink_messages.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/mavlink/mavlink_messages.cpp b/src/modules/mavlink/mavlink_messages.cpp index 67809ed7be..2829b97cf3 100644 --- a/src/modules/mavlink/mavlink_messages.cpp +++ b/src/modules/mavlink/mavlink_messages.cpp @@ -2057,7 +2057,14 @@ protected: msg.y = manual.y * 1000; msg.z = manual.z * 1000; msg.r = manual.r * 1000; + unsigned shift = 2; msg.buttons = 0; + msg.buttons |= (manual.mode_switch << (shift * 0)); + msg.buttons |= (manual.return_switch << (shift * 1)); + msg.buttons |= (manual.posctl_switch << (shift * 2)); + msg.buttons |= (manual.loiter_switch << (shift * 3)); + msg.buttons |= (manual.acro_switch << (shift * 4)); + msg.buttons |= (manual.offboard_switch << (shift * 5)); _mavlink->send_message(MAVLINK_MSG_ID_MANUAL_CONTROL, &msg); }