diff --git a/libraries/AP_Baro/AP_Baro.cpp b/libraries/AP_Baro/AP_Baro.cpp index 2777f10857..7388c31cd6 100644 --- a/libraries/AP_Baro/AP_Baro.cpp +++ b/libraries/AP_Baro/AP_Baro.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include "AP_Baro_SITL.h" @@ -43,7 +43,7 @@ #include "AP_Baro_DPS280.h" #include "AP_Baro_BMP388.h" #include "AP_Baro_Dummy.h" -#if HAL_WITH_UAVCAN +#if HAL_ENABLE_LIBUAVCAN_DRIVERS #include "AP_Baro_UAVCAN.h" #endif @@ -510,7 +510,7 @@ void AP_Baro::init(void) return; } -#if HAL_WITH_UAVCAN +#if HAL_ENABLE_LIBUAVCAN_DRIVERS // Detect UAVCAN Modules, try as many times as there are driver slots for (uint8_t i = 0; i < BARO_MAX_DRIVERS; i++) { ADD_BACKEND(AP_Baro_UAVCAN::probe(*this)); diff --git a/libraries/AP_Baro/AP_Baro_UAVCAN.cpp b/libraries/AP_Baro/AP_Baro_UAVCAN.cpp index 6d02ce0f23..50f883a9a3 100644 --- a/libraries/AP_Baro/AP_Baro_UAVCAN.cpp +++ b/libraries/AP_Baro/AP_Baro_UAVCAN.cpp @@ -1,10 +1,10 @@ #include -#if HAL_WITH_UAVCAN +#if HAL_ENABLE_LIBUAVCAN_DRIVERS #include "AP_Baro_UAVCAN.h" -#include +#include #include #include @@ -12,7 +12,7 @@ extern const AP_HAL::HAL& hal; -#define debug_baro_uavcan(level_debug, can_driver, fmt, args...) do { if ((level_debug) <= AP::can().get_debug_level_driver(can_driver)) { printf(fmt, ##args); }} while (0) +#define LOG_TAG "Baro" //UAVCAN Frontend Registry Binder UC_REGISTRY_BINDER(PressureCb, uavcan::equipment::air_data::StaticPressure); @@ -64,11 +64,11 @@ AP_Baro_Backend* AP_Baro_UAVCAN::probe(AP_Baro &baro) if (_detected_modules[i].driver == nullptr && _detected_modules[i].ap_uavcan != nullptr) { backend = new AP_Baro_UAVCAN(baro); if (backend == nullptr) { - debug_baro_uavcan(2, - _detected_modules[i].ap_uavcan->get_driver_index(), - "Failed register UAVCAN Baro Node %d on Bus %d\n", - _detected_modules[i].node_id, - _detected_modules[i].ap_uavcan->get_driver_index()); + AP::can().log_text(AP_CANManager::LOG_ERROR, + LOG_TAG, + "Failed register UAVCAN Baro Node %d on Bus %d\n", + _detected_modules[i].node_id, + _detected_modules[i].ap_uavcan->get_driver_index()); } else { _detected_modules[i].driver = backend; backend->_pressure = 0; @@ -81,11 +81,11 @@ AP_Baro_Backend* AP_Baro_UAVCAN::probe(AP_Baro &baro) _detected_modules[i].ap_uavcan->get_driver_index(), backend->_node_id, 0)); - debug_baro_uavcan(2, - _detected_modules[i].ap_uavcan->get_driver_index(), - "Registered UAVCAN Baro Node %d on Bus %d\n", - _detected_modules[i].node_id, - _detected_modules[i].ap_uavcan->get_driver_index()); + AP::can().log_text(AP_CANManager::LOG_INFO, + LOG_TAG, + "Registered UAVCAN Baro Node %d on Bus %d\n", + _detected_modules[i].node_id, + _detected_modules[i].ap_uavcan->get_driver_index()); } break; } @@ -194,5 +194,5 @@ void AP_Baro_UAVCAN::update(void) } } -#endif // HAL_WITH_UAVCAN +#endif // HAL_ENABLE_LIBUAVCAN_DRIVERS