diff options
author | philipoe <philipp.oettershagen@mavt.ethz.ch> | 2015-04-09 19:12:38 +0200 |
---|---|---|
committer | philipoe <philipp.oettershagen@mavt.ethz.ch> | 2015-04-09 19:12:38 +0200 |
commit | 309a767c06d707f5a95b165b19123c8728659510 (patch) | |
tree | aed47fe7313ac4dd6b1fe3cfbe9444d0433dea4b /src/modules/mavlink | |
parent | b4edf926271f78e695d7e5d4d1fdf1d9a76c48c1 (diff) | |
download | px4-firmware-309a767c06d707f5a95b165b19123c8728659510.tar.gz px4-firmware-309a767c06d707f5a95b165b19123c8728659510.tar.bz2 px4-firmware-309a767c06d707f5a95b165b19123c8728659510.zip |
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
Diffstat (limited to 'src/modules/mavlink')
-rw-r--r-- | src/modules/mavlink/mavlink_main.cpp | 4 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_main.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index 74395ec03..209ac5d8f 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -746,7 +746,7 @@ Mavlink::get_free_tx_buf() } 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. 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 */ buf[2] = mavlink_get_channel_status(_channel)->current_tx_seq++; buf[3] = mavlink_system.sysid; - buf[4] = mavlink_system.compid; + buf[4] = component_ID==0 ? mavlink_system.compid:component_ID; buf[5] = msgid; /* payload */ diff --git a/src/modules/mavlink/mavlink_main.h b/src/modules/mavlink/mavlink_main.h index 6eef594f5..c285bc405 100644 --- a/src/modules/mavlink/mavlink_main.h +++ b/src/modules/mavlink/mavlink_main.h @@ -169,7 +169,7 @@ public: */ 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. |