Commit 168dc77b authored by Don Gagne's avatar Don Gagne

Warning on running out of mavlink channels

parent 564bd65c
...@@ -173,16 +173,23 @@ void LinkManager::_addLink(LinkInterface* link) ...@@ -173,16 +173,23 @@ void LinkManager::_addLink(LinkInterface* link)
} }
if (!_links.contains(link)) { if (!_links.contains(link)) {
bool channelSet = false;
// Find a mavlink channel to use for this link // Find a mavlink channel to use for this link
for (int i=0; i<32; i++) { for (int i=0; i<32; i++) {
if (!(_mavlinkChannelsUsedBitMask && 1 << i)) { if (!(_mavlinkChannelsUsedBitMask && 1 << i)) {
mavlink_reset_channel_status(i); mavlink_reset_channel_status(i);
link->_setMavlinkChannel(i); link->_setMavlinkChannel(i);
_mavlinkChannelsUsedBitMask |= i << i; _mavlinkChannelsUsedBitMask |= i << i;
channelSet = true;
break; break;
} }
} }
if (!channelSet) {
qWarning() << "Ran out of mavlink channels";
}
_links.append(link); _links.append(link);
emit newLink(link); emit newLink(link);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment