|
|
@ -83,7 +83,7 @@ AP_Proximity_Backend *AP_Proximity_UAVCAN::probe(AP_Proximity &_frontend, |
|
|
|
return backend; |
|
|
|
return backend; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
AP_Proximity_UAVCAN *AP_Proximity_UAVCAN::get_uavcan_backend(AP_UAVCAN *ap_uavcan) |
|
|
|
AP_Proximity_UAVCAN *AP_Proximity_UAVCAN::get_uavcan_backend(AP_UAVCAN *ap_uavcan,uint8_t node_id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (ap_uavcan == nullptr) |
|
|
|
if (ap_uavcan == nullptr) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -93,7 +93,8 @@ AP_Proximity_UAVCAN *AP_Proximity_UAVCAN::get_uavcan_backend(AP_UAVCAN *ap_uavca |
|
|
|
for (uint8_t i = 0; i < PROXIMITY_MAX_INSTANCES; i++) |
|
|
|
for (uint8_t i = 0; i < PROXIMITY_MAX_INSTANCES; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (_detected_modules[i].driver != nullptr && |
|
|
|
if (_detected_modules[i].driver != nullptr && |
|
|
|
_detected_modules[i].ap_uavcan == ap_uavcan) |
|
|
|
_detected_modules[i].ap_uavcan == ap_uavcan&& |
|
|
|
|
|
|
|
_detected_modules[i].node_id == node_id)
|
|
|
|
{ |
|
|
|
{ |
|
|
|
return _detected_modules[i].driver; |
|
|
|
return _detected_modules[i].driver; |
|
|
|
} |
|
|
|
} |
|
|
@ -102,7 +103,8 @@ AP_Proximity_UAVCAN *AP_Proximity_UAVCAN::get_uavcan_backend(AP_UAVCAN *ap_uavca |
|
|
|
bool detected = false; |
|
|
|
bool detected = false; |
|
|
|
for (uint8_t i = 0; i < PROXIMITY_MAX_INSTANCES; i++) |
|
|
|
for (uint8_t i = 0; i < PROXIMITY_MAX_INSTANCES; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (_detected_modules[i].ap_uavcan == ap_uavcan) |
|
|
|
if (_detected_modules[i].ap_uavcan == ap_uavcan && |
|
|
|
|
|
|
|
_detected_modules[i].node_id == node_id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// detected
|
|
|
|
// detected
|
|
|
|
detected = true; |
|
|
|
detected = true; |
|
|
@ -117,6 +119,7 @@ AP_Proximity_UAVCAN *AP_Proximity_UAVCAN::get_uavcan_backend(AP_UAVCAN *ap_uavca |
|
|
|
if (_detected_modules[i].ap_uavcan == nullptr) |
|
|
|
if (_detected_modules[i].ap_uavcan == nullptr) |
|
|
|
{ |
|
|
|
{ |
|
|
|
_detected_modules[i].ap_uavcan = ap_uavcan; |
|
|
|
_detected_modules[i].ap_uavcan = ap_uavcan; |
|
|
|
|
|
|
|
_detected_modules[i].node_id = node_id; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -163,7 +166,7 @@ void AP_Proximity_UAVCAN::handle_proximity_data_trampoline(AP_UAVCAN *ap_uavcan, |
|
|
|
{ |
|
|
|
{ |
|
|
|
WITH_SEMAPHORE(_sem_registry); |
|
|
|
WITH_SEMAPHORE(_sem_registry); |
|
|
|
|
|
|
|
|
|
|
|
AP_Proximity_UAVCAN *driver = get_uavcan_backend(ap_uavcan); |
|
|
|
AP_Proximity_UAVCAN *driver = get_uavcan_backend(ap_uavcan,node_id); |
|
|
|
if (driver == nullptr) |
|
|
|
if (driver == nullptr) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return; |
|
|
|
return; |
|
|
|