mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-05 22:24:47 +08:00
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:
committed by
Daniel Agar
parent
531efc2d53
commit
46aab317d5
@@ -185,8 +185,13 @@ uavcan_bridge::Channel *UavcanCDevSensorBridgeBase::get_channel_for_node(int nod
|
|||||||
int ret = init_driver(channel);
|
int ret = init_driver(channel);
|
||||||
|
|
||||||
if (ret != PX4_OK) {
|
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);
|
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);
|
DEVICE_LOG("channel %d class instance %d ok", channel->node_id, channel->class_instance);
|
||||||
|
|||||||
Reference in New Issue
Block a user