|
|
|
@ -1,10 +1,10 @@
@@ -1,10 +1,10 @@
|
|
|
|
|
#include <AP_HAL/AP_HAL.h> |
|
|
|
|
|
|
|
|
|
#if HAL_WITH_UAVCAN |
|
|
|
|
#if HAL_ENABLE_LIBUAVCAN_DRIVERS |
|
|
|
|
|
|
|
|
|
#include "AP_Baro_UAVCAN.h" |
|
|
|
|
|
|
|
|
|
#include <AP_BoardConfig/AP_BoardConfig_CAN.h> |
|
|
|
|
#include <AP_CANManager/AP_CANManager.h> |
|
|
|
|
#include <AP_UAVCAN/AP_UAVCAN.h> |
|
|
|
|
|
|
|
|
|
#include <uavcan/equipment/air_data/StaticPressure.hpp> |
|
|
|
@ -12,7 +12,7 @@
@@ -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)
@@ -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)
@@ -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)
@@ -194,5 +194,5 @@ void AP_Baro_UAVCAN::update(void)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif // HAL_WITH_UAVCAN
|
|
|
|
|
#endif // HAL_ENABLE_LIBUAVCAN_DRIVERS
|
|
|
|
|
|
|
|
|
|