GCS_MAVLink: allow scripting to block commands

This commit is contained in:
Iampete1 2023-06-18 14:00:04 +01:00 committed by Andrew Tridgell
parent 1c5f3c708a
commit 352f721626
1 changed files with 16 additions and 0 deletions

View File

@ -4918,6 +4918,14 @@ void GCS_MAVLINK::handle_command_long(const mavlink_message_t &msg)
mavlink_command_long_t packet;
mavlink_msg_command_long_decode(&msg, &packet);
#if AP_SCRIPTING_ENABLED
AP_Scripting *scripting = AP_Scripting::get_singleton();
if (scripting != nullptr && scripting->is_handling_command(packet.command)) {
// Scripting has registered to receive this command, do not procces it internaly
return;
}
#endif
hal.util->persistent_data.last_mavlink_cmd = packet.command;
MAV_RESULT result;
@ -5183,6 +5191,14 @@ void GCS_MAVLINK::handle_command_int(const mavlink_message_t &msg)
mavlink_command_int_t packet;
mavlink_msg_command_int_decode(&msg, &packet);
#if AP_SCRIPTING_ENABLED
AP_Scripting *scripting = AP_Scripting::get_singleton();
if (scripting != nullptr && scripting->is_handling_command(packet.command)) {
// Scripting has registered to receive this command, do not procces it internaly
return;
}
#endif
hal.util->persistent_data.last_mavlink_cmd = packet.command;
MAV_RESULT result;