From 55075961b2beadf6454660b320c32ad109835414 Mon Sep 17 00:00:00 2001 From: Andy Piper Date: Sun, 21 Jul 2024 13:29:21 +0200 Subject: [PATCH] AP_Mission: address minor review comments --- libraries/AP_Mission/AP_Mission.cpp | 1 - libraries/AP_Mission/AP_Mission_Commands.cpp | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/libraries/AP_Mission/AP_Mission.cpp b/libraries/AP_Mission/AP_Mission.cpp index 438b816176..3e138e7cac 100644 --- a/libraries/AP_Mission/AP_Mission.cpp +++ b/libraries/AP_Mission/AP_Mission.cpp @@ -1239,7 +1239,6 @@ MAV_MISSION_RESULT AP_Mission::mavlink_int_to_mission_cmd(const mavlink_mission_ case MAV_CMD_DO_FENCE_ENABLE: // MAV ID: 207 cmd.p1 = packet.param1; // action 0=disable, 1=enable, 2=disable floor - // packet.param2; // bitmask see FENCE_TYPE enum break; case MAV_CMD_DO_AUX_FUNCTION: diff --git a/libraries/AP_Mission/AP_Mission_Commands.cpp b/libraries/AP_Mission/AP_Mission_Commands.cpp index f296c0c268..bc03742320 100644 --- a/libraries/AP_Mission/AP_Mission_Commands.cpp +++ b/libraries/AP_Mission/AP_Mission_Commands.cpp @@ -357,15 +357,15 @@ bool AP_Mission::start_command_fence(const AP_Mission::Mission_Command& cmd) return false; } - if (cmd.p1 == 0) { // disable fence + if (cmd.p1 == uint8_t(AC_Fence::MavlinkFenceActions::DISABLE_FENCE)) { // disable fence uint8_t fences = fence->enable_configured(false); fence->print_fence_message("disabled", fences); return true; - } else if (cmd.p1 == 1) { // enable fence + } else if (cmd.p1 == uint8_t(AC_Fence::MavlinkFenceActions::ENABLE_FENCE)) { // enable fence uint8_t fences = fence->enable_configured(true); fence->print_fence_message("enabled", fences); return true; - } else if (cmd.p1 == 2) { // disable fence floor only + } else if (cmd.p1 == uint8_t(AC_Fence::MavlinkFenceActions::DISABLE_ALT_MIN_FENCE)) { // disable fence floor only fence->disable_floor(); fence->print_fence_message("disabled", AC_FENCE_TYPE_ALT_MIN); return true;