mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-25 17:23:56 -04:00
AP_Compass: move to using CANManager library
This commit is contained in:
parent
ad2a63e173
commit
bf1a7799f8
@ -20,7 +20,7 @@
|
||||
#include "AP_Compass_LIS3MDL.h"
|
||||
#include "AP_Compass_AK09916.h"
|
||||
#include "AP_Compass_QMC5883L.h"
|
||||
#if HAL_WITH_UAVCAN
|
||||
#if HAL_ENABLE_LIBUAVCAN_DRIVERS
|
||||
#include "AP_Compass_UAVCAN.h"
|
||||
#endif
|
||||
#include "AP_Compass_MMC3416.h"
|
||||
@ -1272,7 +1272,7 @@ void Compass::_detect_backends(void)
|
||||
#endif
|
||||
|
||||
|
||||
#if HAL_WITH_UAVCAN
|
||||
#if HAL_ENABLE_LIBUAVCAN_DRIVERS
|
||||
if (_driver_enabled(DRIVER_UAVCAN)) {
|
||||
for (uint8_t i=0; i<COMPASS_MAX_BACKEND; i++) {
|
||||
AP_Compass_Backend* _uavcan_backend = AP_Compass_UAVCAN::probe(i);
|
||||
@ -1427,7 +1427,7 @@ void Compass::_reset_compass_id()
|
||||
void
|
||||
Compass::_detect_runtime(void)
|
||||
{
|
||||
#if HAL_WITH_UAVCAN
|
||||
#if HAL_ENABLE_LIBUAVCAN_DRIVERS
|
||||
//Don't try to add device while armed
|
||||
if (hal.util->get_soft_armed()) {
|
||||
return;
|
||||
|
@ -15,11 +15,11 @@
|
||||
|
||||
#include <AP_HAL/AP_HAL.h>
|
||||
|
||||
#if HAL_WITH_UAVCAN
|
||||
#if HAL_ENABLE_LIBUAVCAN_DRIVERS
|
||||
|
||||
#include "AP_Compass_UAVCAN.h"
|
||||
|
||||
#include <AP_BoardConfig/AP_BoardConfig_CAN.h>
|
||||
#include <AP_CANManager/AP_CANManager.h>
|
||||
#include <AP_UAVCAN/AP_UAVCAN.h>
|
||||
|
||||
#include <uavcan/equipment/ahrs/MagneticFieldStrength.hpp>
|
||||
@ -27,9 +27,7 @@
|
||||
|
||||
extern const AP_HAL::HAL& hal;
|
||||
|
||||
#define debug_mag_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 "COMPASS"
|
||||
// Frontend Registry Binders
|
||||
UC_REGISTRY_BINDER(MagCb, uavcan::equipment::ahrs::MagneticFieldStrength);
|
||||
UC_REGISTRY_BINDER(Mag2Cb, uavcan::equipment::ahrs::MagneticFieldStrength2);
|
||||
@ -83,8 +81,8 @@ AP_Compass_Backend* AP_Compass_UAVCAN::probe(uint8_t index)
|
||||
return nullptr;
|
||||
}
|
||||
_detected_modules[index].driver = driver;
|
||||
debug_mag_uavcan(2,
|
||||
_detected_modules[index].ap_uavcan->get_driver_index(),
|
||||
AP::can().log_text(AP_CANManager::LOG_INFO,
|
||||
LOG_TAG,
|
||||
"Found Mag Node %d on Bus %d Sensor ID %d\n",
|
||||
_detected_modules[index].node_id,
|
||||
_detected_modules[index].ap_uavcan->get_driver_index(),
|
||||
@ -104,7 +102,7 @@ bool AP_Compass_UAVCAN::init()
|
||||
set_dev_id(_instance, _devid);
|
||||
set_external(_instance, true);
|
||||
|
||||
debug_mag_uavcan(2, _ap_uavcan->get_driver_index(), "AP_Compass_UAVCAN loaded\n\r");
|
||||
AP::can().log_text(AP_CANManager::LOG_INFO, LOG_TAG, "AP_Compass_UAVCAN loaded\n\r");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user