mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-18 06:38:29 -04:00
AP_Notify: UAVCAN_RGB_LED: don't init if no UAVCAN backends
This allows us to consider enabling UAVCAN_RGB_LED as a more general default, as it won't consume one of our limited backend slots if UAVCAN is not enabled.
This commit is contained in:
parent
240bfeb6bd
commit
bde695d11f
@ -45,7 +45,15 @@ UAVCAN_RGB_LED::UAVCAN_RGB_LED(uint8_t led_index, uint8_t led_off,
|
||||
|
||||
bool UAVCAN_RGB_LED::init()
|
||||
{
|
||||
const uint8_t can_num_drivers = AP::can().get_num_drivers();
|
||||
for (uint8_t i = 0; i < can_num_drivers; i++) {
|
||||
AP_UAVCAN *uavcan = AP_UAVCAN::get_uavcan(i);
|
||||
if (uavcan != nullptr) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// no UAVCAN drivers
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user