From 0690b7bd683299ed85589d533fcf408b34398ba7 Mon Sep 17 00:00:00 2001 From: Siddharth Purohit Date: Sun, 31 May 2020 17:36:29 +0530 Subject: [PATCH] AP_GPS: move to using CANManager library --- libraries/AP_GPS/AP_GPS.cpp | 6 +++--- libraries/AP_GPS/AP_GPS_UAVCAN.cpp | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libraries/AP_GPS/AP_GPS.cpp b/libraries/AP_GPS/AP_GPS.cpp index 8ed92ca967..da0e75ea37 100644 --- a/libraries/AP_GPS/AP_GPS.cpp +++ b/libraries/AP_GPS/AP_GPS.cpp @@ -37,8 +37,8 @@ #include "AP_GPS_MAV.h" #include "GPS_Backend.h" -#if HAL_WITH_UAVCAN -#include +#if HAL_ENABLE_LIBUAVCAN_DRIVERS +#include #include #include "AP_GPS_UAVCAN.h" #endif @@ -509,7 +509,7 @@ void AP_GPS::detect_instance(uint8_t instance) // user has to explicitly set the UAVCAN type, do not use AUTO case GPS_TYPE_UAVCAN: -#if HAL_WITH_UAVCAN +#if HAL_ENABLE_LIBUAVCAN_DRIVERS dstate->auto_detected_baud = false; // specified, not detected new_gps = AP_GPS_UAVCAN::probe(*this, state[instance]); goto found_gps; diff --git a/libraries/AP_GPS/AP_GPS_UAVCAN.cpp b/libraries/AP_GPS/AP_GPS_UAVCAN.cpp index 433d8da0b9..9b7f7fd318 100644 --- a/libraries/AP_GPS/AP_GPS_UAVCAN.cpp +++ b/libraries/AP_GPS/AP_GPS_UAVCAN.cpp @@ -18,10 +18,10 @@ // #include -#if HAL_WITH_UAVCAN +#if HAL_ENABLE_LIBUAVCAN_DRIVERS #include "AP_GPS_UAVCAN.h" -#include +#include #include #include @@ -30,7 +30,7 @@ extern const AP_HAL::HAL& hal; -#define debug_gps_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 "GPS" UC_REGISTRY_BINDER(FixCb, uavcan::equipment::gnss::Fix); UC_REGISTRY_BINDER(Fix2Cb, uavcan::equipment::gnss::Fix2); @@ -93,16 +93,16 @@ AP_GPS_Backend* AP_GPS_UAVCAN::probe(AP_GPS &_gps, AP_GPS::GPS_State &_state) if (_detected_modules[i].driver == nullptr && _detected_modules[i].ap_uavcan != nullptr) { backend = new AP_GPS_UAVCAN(_gps, _state); if (backend == nullptr) { - debug_gps_uavcan(2, - _detected_modules[i].ap_uavcan->get_driver_index(), + AP::can().log_text(AP_CANManager::LOG_ERROR, + LOG_TAG, "Failed to register UAVCAN GPS 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->_detected_module = i; - debug_gps_uavcan(2, - _detected_modules[i].ap_uavcan->get_driver_index(), + AP::can().log_text(AP_CANManager::LOG_INFO, + LOG_TAG, "Registered UAVCAN GPS Node %d on Bus %d\n", _detected_modules[i].node_id, _detected_modules[i].ap_uavcan->get_driver_index()); @@ -452,4 +452,4 @@ void AP_GPS_UAVCAN::inject_data(const uint8_t *data, uint16_t len) } } -#endif // HAL_WITH_UAVCAN +#endif // HAL_ENABLE_LIBUAVCAN_DRIVERS