Skip to content

Commit

Permalink
AP_DroneCAN: fixed using 2 serial ports with one node
Browse files Browse the repository at this point in the history
we need to match node ID and serial port index, while allowing for
wildcard of -1
  • Loading branch information
tridge committed Oct 8, 2024
1 parent 4df758f commit 715cee2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libraries/AP_DroneCAN/AP_DroneCAN_serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ void AP_DroneCAN_Serial::handle_tunnel_targetted(AP_DroneCAN *dronecan,
}
auto &s = *serial[driver_index];
for (auto &p : s.ports) {
if (p.idx == msg.serial_id && transfer.source_node_id == p.node) {
if (p.idx == msg.serial_id &&
transfer.source_node_id == p.node &&
(msg.serial_id == p.idx || p.idx == -1)) {
WITH_SEMAPHORE(p.sem);
if (p.readbuffer != nullptr) {
p.readbuffer->write(msg.buffer.data, msg.buffer.len);
Expand Down

0 comments on commit 715cee2

Please sign in to comment.