Copter: fence enable/disable via MAVLink

This commit is contained in:
Randy Mackay 2014-04-27 16:17:05 +09:00
parent d3411e45bb
commit b9b3a39a83
1 changed files with 20 additions and 0 deletions

View File

@ -1316,6 +1316,26 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
}
break;
case MAV_CMD_DO_FENCE_ENABLE:
#if AC_FENCE == ENABLED
result = MAV_RESULT_ACCEPTED;
switch ((uint16_t)packet.param1) {
case 0:
fence.enable(false);
break;
case 1:
fence.enable(true);
break;
default:
result = MAV_RESULT_FAILED;
break;
}
#else
// if fence code is not included return failure
result = MAV_RESULT_FAILED;
#endif
break;
default:
result = MAV_RESULT_UNSUPPORTED;
break;