Skip to content

Commit

Permalink
GCS_Mavlink: Add lua method for command_long
Browse files Browse the repository at this point in the history
  • Loading branch information
stephendade committed Jan 30, 2025
1 parent d529601 commit 5e126d3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions libraries/GCS_MAVLink/GCS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,20 @@ MAV_RESULT GCS::lua_command_int_packet(const mavlink_command_int_t &packet)

return ch->handle_command_int_packet(packet, msg);
}

MAV_RESULT GCS::lua_command_long_packet(const mavlink_command_long_t &packet)
{
// for now we assume channel 0. In the future we may create a dedicated channel
auto *ch = chan(0);
if (ch == nullptr) {
return MAV_RESULT_UNSUPPORTED;
}
// we need a dummy message for some calls
mavlink_message_t msg {};

return ch->try_command_long_as_command_int(packet, msg);
}

#endif // AP_SCRIPTING_ENABLED

#endif // HAL_GCS_ENABLED
3 changes: 2 additions & 1 deletion libraries/GCS_MAVLink/GCS.h
Original file line number Diff line number Diff line change
Expand Up @@ -1294,8 +1294,9 @@ class GCS
virtual uint8_t sysid_this_mav() const = 0;

#if AP_SCRIPTING_ENABLED
// lua access to command_int
// lua access to command_int and command_long
MAV_RESULT lua_command_int_packet(const mavlink_command_int_t &packet);
MAV_RESULT lua_command_long_packet(const mavlink_command_long_t &packet);
#endif

// Sequence number should be incremented when available modes changes
Expand Down

0 comments on commit 5e126d3

Please sign in to comment.