From 6bc060d8abb6894319d2899563de5fe255b15a71 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 7 Apr 2023 10:18:02 +1000 Subject: [PATCH] AP_OpticalFlow: rename AP_UAVCAN to AP_DroneCAN --- .../AP_OpticalFlow/AP_OpticalFlow_HereFlow.cpp | 18 +++++++++--------- .../AP_OpticalFlow/AP_OpticalFlow_HereFlow.h | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libraries/AP_OpticalFlow/AP_OpticalFlow_HereFlow.cpp b/libraries/AP_OpticalFlow/AP_OpticalFlow_HereFlow.cpp index d3c506992d..e7a9470442 100644 --- a/libraries/AP_OpticalFlow/AP_OpticalFlow_HereFlow.cpp +++ b/libraries/AP_OpticalFlow/AP_OpticalFlow_HereFlow.cpp @@ -5,14 +5,14 @@ #include #include -#include +#include #include extern const AP_HAL::HAL& hal; uint8_t AP_OpticalFlow_HereFlow::_node_id = 0; AP_OpticalFlow_HereFlow* AP_OpticalFlow_HereFlow::_driver = nullptr; -AP_UAVCAN* AP_OpticalFlow_HereFlow::_ap_uavcan = nullptr; +AP_DroneCAN* AP_OpticalFlow_HereFlow::_ap_dronecan = nullptr; /* constructor - registers instance at top Flow driver */ @@ -26,31 +26,31 @@ AP_OpticalFlow_HereFlow::AP_OpticalFlow_HereFlow(AP_OpticalFlow &flow) : } //links the HereFlow messages to the backend -void AP_OpticalFlow_HereFlow::subscribe_msgs(AP_UAVCAN* ap_uavcan) +void AP_OpticalFlow_HereFlow::subscribe_msgs(AP_DroneCAN* ap_dronecan) { - if (ap_uavcan == nullptr) { + if (ap_dronecan == nullptr) { return; } - if (Canard::allocate_sub_arg_callback(ap_uavcan, &handle_measurement, ap_uavcan->get_driver_index()) == nullptr) { + if (Canard::allocate_sub_arg_callback(ap_dronecan, &handle_measurement, ap_dronecan->get_driver_index()) == nullptr) { AP_BoardConfig::allocation_error("measurement_sub"); } } //updates driver states based on received HereFlow messages -void AP_OpticalFlow_HereFlow::handle_measurement(AP_UAVCAN *ap_uavcan, const CanardRxTransfer& transfer, const com_hex_equipment_flow_Measurement &msg) +void AP_OpticalFlow_HereFlow::handle_measurement(AP_DroneCAN *ap_dronecan, const CanardRxTransfer& transfer, const com_hex_equipment_flow_Measurement &msg) { if (_driver == nullptr) { return; } //protect from data coming from duplicate sensors, //as we only handle one Here Flow at a time as of now - if (_ap_uavcan == nullptr) { - _ap_uavcan = ap_uavcan; + if (_ap_dronecan == nullptr) { + _ap_dronecan = ap_dronecan; _node_id = transfer.source_node_id; } - if (_ap_uavcan == ap_uavcan && _node_id == transfer.source_node_id) { + if (_ap_dronecan == ap_dronecan && _node_id == transfer.source_node_id) { WITH_SEMAPHORE(_driver->_sem); _driver->new_data = true; _driver->flowRate = Vector2f(msg.flow_integral[0], msg.flow_integral[1]); diff --git a/libraries/AP_OpticalFlow/AP_OpticalFlow_HereFlow.h b/libraries/AP_OpticalFlow/AP_OpticalFlow_HereFlow.h index 941fe26681..145d875448 100644 --- a/libraries/AP_OpticalFlow/AP_OpticalFlow_HereFlow.h +++ b/libraries/AP_OpticalFlow/AP_OpticalFlow_HereFlow.h @@ -8,7 +8,7 @@ #if AP_OPTICALFLOW_HEREFLOW_ENABLED -#include +#include class AP_OpticalFlow_HereFlow : public OpticalFlow_backend { public: @@ -18,9 +18,9 @@ public: void update() override; - static void subscribe_msgs(AP_UAVCAN* ap_uavcan); + static void subscribe_msgs(AP_DroneCAN* ap_dronecan); - static void handle_measurement(AP_UAVCAN *ap_uavcan, const CanardRxTransfer& transfer, const com_hex_equipment_flow_Measurement &msg); + static void handle_measurement(AP_DroneCAN *ap_dronecan, const CanardRxTransfer& transfer, const com_hex_equipment_flow_Measurement &msg); private: @@ -31,7 +31,7 @@ private: static uint8_t _node_id; static AP_OpticalFlow_HereFlow* _driver; - static AP_UAVCAN* _ap_uavcan; + static AP_DroneCAN* _ap_dronecan; void _push_state(void); };