GCS_MAVLink: Route MAVLink data to/from scripting

This commit is contained in:
Michael du Breuil 2020-02-24 17:38:16 -07:00 committed by Andrew Tridgell
parent 598919d8ad
commit a934c90e69
1 changed files with 17 additions and 0 deletions

View File

@ -1389,6 +1389,15 @@ void GCS_MAVLINK::update_send()
}
#endif
#ifdef AP_SCRIPTING_ENABLED
{
AP_Scripting *scripting = AP_Scripting::get_singleton();
if (scripting != nullptr) {
scripting->send_message(chan);
}
}
#endif // AP_SCRIPTING_ENABLED
if (!deferred_messages_initialised) {
initialise_message_intervals_from_streamrates();
#if HAL_MAVLINK_INTERVALS_FROM_FILES_ENABLED
@ -1697,6 +1706,14 @@ void GCS_MAVLINK::packetReceived(const mavlink_status_t &status,
handle_mount_message(msg);
#endif
}
#if AP_SCRIPTING_ENABLED
{
AP_Scripting *scripting = AP_Scripting::get_singleton();
if (scripting != nullptr) {
scripting->handle_message(msg, chan);
}
}
#endif // AP_SCRIPTING_ENABLED
if (!accept_packet(status, msg)) {
// e.g. enforce-sysid says we shouldn't look at this packet
return;