diff --git a/libraries/AP_RCProtocol/AP_RCProtocol_DroneCAN.cpp b/libraries/AP_RCProtocol/AP_RCProtocol_DroneCAN.cpp index 879344e323..80b7cf9fdc 100644 --- a/libraries/AP_RCProtocol/AP_RCProtocol_DroneCAN.cpp +++ b/libraries/AP_RCProtocol/AP_RCProtocol_DroneCAN.cpp @@ -14,15 +14,11 @@ extern const AP_HAL::HAL& hal; AP_RCProtocol_DroneCAN::Registry AP_RCProtocol_DroneCAN::registry; AP_RCProtocol_DroneCAN *AP_RCProtocol_DroneCAN::_singleton; -void AP_RCProtocol_DroneCAN::subscribe_msgs(AP_DroneCAN* ap_dronecan) +bool AP_RCProtocol_DroneCAN::subscribe_msgs(AP_DroneCAN* ap_dronecan) { - if (ap_dronecan == nullptr) { - return; - } + const auto driver_index = ap_dronecan->get_driver_index(); - if (Canard::allocate_sub_arg_callback(ap_dronecan, &handle_rcinput, ap_dronecan->get_driver_index()) == nullptr) { - AP_BoardConfig::allocation_error("rc_sub"); - } + return (Canard::allocate_sub_arg_callback(ap_dronecan, &handle_rcinput, driver_index) != nullptr); } AP_RCProtocol_DroneCAN* AP_RCProtocol_DroneCAN::get_dronecan_backend(AP_DroneCAN* ap_dronecan, uint8_t node_id) diff --git a/libraries/AP_RCProtocol/AP_RCProtocol_DroneCAN.h b/libraries/AP_RCProtocol/AP_RCProtocol_DroneCAN.h index d2c81025d7..aa4693020d 100644 --- a/libraries/AP_RCProtocol/AP_RCProtocol_DroneCAN.h +++ b/libraries/AP_RCProtocol/AP_RCProtocol_DroneCAN.h @@ -18,7 +18,7 @@ public: _singleton = this; } - static void subscribe_msgs(AP_DroneCAN* ap_dronecan); + static bool subscribe_msgs(AP_DroneCAN* ap_dronecan); void update() override;