mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-02 10:23:25 +08:00
AP_DroneCAN: drop CAN log message calls
The infrastructure for these has been continually buggy and rarely used. Delete calls in preparation for ripping it out entirely.
This commit is contained in:
committed by
Thomas Watson
parent
78736986d3
commit
bd0bf4c92e
@@ -7,7 +7,6 @@
|
||||
#include <AP_Math/AP_Math.h>
|
||||
#include <dronecan_msgs.h>
|
||||
extern const AP_HAL::HAL& hal;
|
||||
#define LOG_TAG "DroneCANIface"
|
||||
#include <canard.h>
|
||||
#include <AP_CANManager/AP_CANSensor.h>
|
||||
|
||||
@@ -419,27 +418,21 @@ void CanardInterface::process(uint32_t duration_ms) {
|
||||
bool CanardInterface::add_interface(AP_HAL::CANIface *can_iface)
|
||||
{
|
||||
if (num_ifaces > HAL_NUM_CAN_IFACES) {
|
||||
AP::can().log_text(AP_CANManager::LOG_ERROR, LOG_TAG, "DroneCANIfaceMgr: Num Ifaces Exceeded\n");
|
||||
return false;
|
||||
}
|
||||
if (can_iface == nullptr) {
|
||||
AP::can().log_text(AP_CANManager::LOG_ERROR, LOG_TAG, "DroneCANIfaceMgr: Iface Null\n");
|
||||
return false;
|
||||
}
|
||||
if (ifaces[num_ifaces] != nullptr) {
|
||||
AP::can().log_text(AP_CANManager::LOG_ERROR, LOG_TAG, "DroneCANIfaceMgr: Iface already added\n");
|
||||
return false;
|
||||
}
|
||||
ifaces[num_ifaces] = can_iface;
|
||||
if (ifaces[num_ifaces] == nullptr) {
|
||||
AP::can().log_text(AP_CANManager::LOG_ERROR, LOG_TAG, "DroneCANIfaceMgr: Can't alloc uavcan::iface\n");
|
||||
return false;
|
||||
}
|
||||
if (!can_iface->set_event_handle(&sem_handle)) {
|
||||
AP::can().log_text(AP_CANManager::LOG_ERROR, LOG_TAG, "DroneCANIfaceMgr: Setting event handle failed\n");
|
||||
return false;
|
||||
}
|
||||
AP::can().log_text(AP_CANManager::LOG_INFO, LOG_TAG, "DroneCANIfaceMgr: Successfully added interface %d\n", int(num_ifaces));
|
||||
num_ifaces++;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -87,8 +87,6 @@ extern const AP_HAL::HAL& hal;
|
||||
|
||||
#define AP_DRONECAN_GETSET_TIMEOUT_MS 100 // timeout waiting for response from node after 0.1 sec
|
||||
|
||||
#define debug_dronecan(level_debug, fmt, args...) do { AP::can().log_text(level_debug, "DroneCAN", fmt, ##args); } while (0)
|
||||
|
||||
// Translation of all messages from DroneCAN structures into AP structures is done
|
||||
// in AP_DroneCAN and not in corresponding drivers.
|
||||
// The overhead of including definitions of DSDL is very high and it is best to
|
||||
@@ -291,8 +289,6 @@ _dna_server(*this, canard_iface, driver_index)
|
||||
_SRV_conf[i].esc_pending = false;
|
||||
_SRV_conf[i].servo_pending = false;
|
||||
}
|
||||
|
||||
debug_dronecan(AP_CANManager::LOG_INFO, "AP_DroneCAN constructed\n\r");
|
||||
}
|
||||
|
||||
AP_DroneCAN::~AP_DroneCAN()
|
||||
@@ -311,7 +307,6 @@ AP_DroneCAN *AP_DroneCAN::get_dronecan(uint8_t driver_index)
|
||||
bool AP_DroneCAN::add_interface(AP_HAL::CANIface* can_iface)
|
||||
{
|
||||
if (!canard_iface.add_interface(can_iface)) {
|
||||
debug_dronecan(AP_CANManager::LOG_ERROR, "DroneCAN: can't add DroneCAN interface\n\r");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -320,11 +315,9 @@ bool AP_DroneCAN::add_interface(AP_HAL::CANIface* can_iface)
|
||||
void AP_DroneCAN::init(uint8_t driver_index)
|
||||
{
|
||||
if (driver_index != _driver_index) {
|
||||
debug_dronecan(AP_CANManager::LOG_ERROR, "DroneCAN: init called with wrong driver_index");
|
||||
return;
|
||||
}
|
||||
if (_initialized) {
|
||||
debug_dronecan(AP_CANManager::LOG_ERROR, "DroneCAN: init called more than once\n\r");
|
||||
return;
|
||||
}
|
||||
uint8_t node = _dronecan_node;
|
||||
@@ -351,7 +344,6 @@ void AP_DroneCAN::init(uint8_t driver_index)
|
||||
|
||||
mem_pool = NEW_NOTHROW uint32_t[_pool_size/sizeof(uint32_t)];
|
||||
if (mem_pool == nullptr) {
|
||||
debug_dronecan(AP_CANManager::LOG_ERROR, "DroneCAN: Failed to allocate memory pool\n\r");
|
||||
return;
|
||||
}
|
||||
canard_iface.init(mem_pool, (_pool_size/sizeof(uint32_t))*sizeof(uint32_t), node);
|
||||
@@ -364,7 +356,6 @@ void AP_DroneCAN::init(uint8_t driver_index)
|
||||
|
||||
//Start Servers
|
||||
if (!_dna_server.init(unique_id, uid_len, node)) {
|
||||
debug_dronecan(AP_CANManager::LOG_ERROR, "DroneCAN: Failed to start DNA Server\n\r");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -507,7 +498,6 @@ void AP_DroneCAN::init(uint8_t driver_index)
|
||||
hal.util->snprintf(_thread_name, sizeof(_thread_name), "dronecan_%u", driver_index);
|
||||
|
||||
if (!hal.scheduler->thread_create(FUNCTOR_BIND_MEMBER(&AP_DroneCAN::loop, void), _thread_name, DRONECAN_STACK_SIZE, AP_HAL::Scheduler::PRIORITY_CAN, 0)) {
|
||||
debug_dronecan(AP_CANManager::LOG_ERROR, "DroneCAN: couldn't create thread\n\r");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -516,7 +506,6 @@ void AP_DroneCAN::init(uint8_t driver_index)
|
||||
#endif
|
||||
|
||||
_initialized = true;
|
||||
debug_dronecan(AP_CANManager::LOG_INFO, "DroneCAN: init done\n\r");
|
||||
}
|
||||
|
||||
void AP_DroneCAN::loop(void)
|
||||
|
||||
@@ -39,8 +39,6 @@ extern const AP_HAL::HAL& hal;
|
||||
#define MAX_NODE_ID 125
|
||||
#define NODERECORD_LOC(node_id) ((node_id * sizeof(NodeRecord)) + NODERECORD_MAGIC_LEN)
|
||||
|
||||
#define debug_dronecan(level_debug, fmt, args...) do { AP::can().log_text(level_debug, "DroneCAN", fmt, ##args); } while (0)
|
||||
|
||||
// database is currently shared by all DNA servers
|
||||
AP_DroneCAN_DNA_Server::Database AP_DroneCAN_DNA_Server::db;
|
||||
|
||||
@@ -526,16 +524,6 @@ void AP_DroneCAN_DNA_Server::handle_allocation(const CanardRxTransfer& transfer,
|
||||
return; // not first part but we are expecting one, ignore
|
||||
}
|
||||
|
||||
if (rcvd_unique_id_offset) {
|
||||
debug_dronecan(AP_CANManager::LOG_DEBUG, "TIME: %lu -- Accepting Followup part! %u\n",
|
||||
(unsigned long)now,
|
||||
unsigned((now - last_alloc_msg_ms)));
|
||||
} else {
|
||||
debug_dronecan(AP_CANManager::LOG_DEBUG, "TIME: %lu -- Accepting First part! %u\n",
|
||||
(unsigned long)now,
|
||||
unsigned((now - last_alloc_msg_ms)));
|
||||
}
|
||||
|
||||
last_alloc_msg_ms = now;
|
||||
if ((rcvd_unique_id_offset + msg.unique_id.len) > sizeof(rcvd_unique_id)) {
|
||||
rcvd_unique_id_offset = 0; // reset state, request contains an over-long ID
|
||||
|
||||
Reference in New Issue
Block a user