uavcan: bug fix sensor bridge init failure

Fixes case where a UAVCAN SensorBridge has callback channels available,
but NuttX / uORB does not have an additional driver / topic instance
available.
This commit is contained in:
JacobCrabill 2020-03-30 15:07:51 -07:00 committed by Daniel Agar
parent 531efc2d53
commit 46aab317d5

View File

@ -185,8 +185,13 @@ uavcan_bridge::Channel *UavcanCDevSensorBridgeBase::get_channel_for_node(int nod
int ret = init_driver(channel);
if (ret != PX4_OK) {
// Driver initialization failed - probably out of channels. Return nullptr so
// the callback exits gracefully, and clear the assigned node_id for the channel
// so future callbacks exit immediately.
DEVICE_LOG("INIT ERROR node %d errno %d", channel->node_id, ret);
return channel;
channel->node_id = -1;
_out_of_channels = true;
return nullptr;
}
DEVICE_LOG("channel %d class instance %d ok", channel->node_id, channel->class_instance);