GCS_MAVLink: implement handling of MAV_CMD_DO_SET_MODE

This commit is contained in:
Peter Barker 2017-09-16 21:50:59 +10:00 committed by Francisco Ferreira
parent 8507763a1c
commit 6bd7089718
2 changed files with 13 additions and 0 deletions

View File

@ -299,6 +299,7 @@ protected:
MAV_RESULT handle_command_long_message(mavlink_command_long_t &packet);
MAV_RESULT handle_command_camera(const mavlink_command_long_t &packet);
MAV_RESULT handle_command_do_send_banner(const mavlink_command_long_t &packet);
MAV_RESULT handle_command_do_set_mode(const mavlink_command_long_t &packet);
// vehicle-overridable message send function
virtual bool try_send_message(enum ap_message id);

View File

@ -2036,12 +2036,24 @@ MAV_RESULT GCS_MAVLINK::handle_command_do_send_banner(const mavlink_command_long
return MAV_RESULT_ACCEPTED;
}
MAV_RESULT GCS_MAVLINK::handle_command_do_set_mode(const mavlink_command_long_t &packet)
{
const MAV_MODE base_mode = (MAV_MODE)packet.param1;
const uint32_t custom_mode = (uint32_t)packet.param2;
return _set_mode_common(base_mode, custom_mode);
}
MAV_RESULT GCS_MAVLINK::handle_command_long_message(mavlink_command_long_t &packet)
{
MAV_RESULT result = MAV_RESULT_FAILED;
switch (packet.command) {
case MAV_CMD_DO_SET_MODE:
result = handle_command_do_set_mode(packet);
break;
case MAV_CMD_DO_SEND_BANNER:
result = handle_command_do_send_banner(packet);
break;