forked from Archive/PX4-Autopilot
mavlink: Allow mavlink_send to take component_ID into account. Still use a default argument in case the user does not supply a component_ID
This commit is contained in:
parent
b4edf92627
commit
309a767c06
|
@ -746,7 +746,7 @@ Mavlink::get_free_tx_buf()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Mavlink::send_message(const uint8_t msgid, const void *msg)
|
Mavlink::send_message(const uint8_t msgid, const void *msg, uint8_t component_ID)
|
||||||
{
|
{
|
||||||
/* If the wait until transmit flag is on, only transmit after we've received messages.
|
/* If the wait until transmit flag is on, only transmit after we've received messages.
|
||||||
Otherwise, transmit all the time. */
|
Otherwise, transmit all the time. */
|
||||||
|
@ -780,7 +780,7 @@ Mavlink::send_message(const uint8_t msgid, const void *msg)
|
||||||
/* use mavlink's internal counter for the TX seq */
|
/* use mavlink's internal counter for the TX seq */
|
||||||
buf[2] = mavlink_get_channel_status(_channel)->current_tx_seq++;
|
buf[2] = mavlink_get_channel_status(_channel)->current_tx_seq++;
|
||||||
buf[3] = mavlink_system.sysid;
|
buf[3] = mavlink_system.sysid;
|
||||||
buf[4] = mavlink_system.compid;
|
buf[4] = component_ID==0 ? mavlink_system.compid:component_ID;
|
||||||
buf[5] = msgid;
|
buf[5] = msgid;
|
||||||
|
|
||||||
/* payload */
|
/* payload */
|
||||||
|
|
|
@ -169,7 +169,7 @@ public:
|
||||||
*/
|
*/
|
||||||
int set_hil_enabled(bool hil_enabled);
|
int set_hil_enabled(bool hil_enabled);
|
||||||
|
|
||||||
void send_message(const uint8_t msgid, const void *msg);
|
void send_message(const uint8_t msgid, const void *msg, uint8_t component_ID = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resend message as is, don't change sequence number and CRC.
|
* Resend message as is, don't change sequence number and CRC.
|
||||||
|
|
Loading…
Reference in New Issue