mirror of https://github.com/ArduPilot/ardupilot
AP_ExternalAHRS: create and use backend defines for AP_ExternalAHRS
This commit is contained in:
parent
eca456e521
commit
b471f9bfac
|
@ -16,12 +16,15 @@
|
|||
suppport for serial connected AHRS systems
|
||||
*/
|
||||
|
||||
#include "AP_ExternalAHRS.h"
|
||||
#include "AP_ExternalAHRS_VectorNav.h"
|
||||
#include "AP_ExternalAHRS_LORD.h"
|
||||
#include "AP_ExternalAHRS_config.h"
|
||||
|
||||
#if HAL_EXTERNAL_AHRS_ENABLED
|
||||
|
||||
#include "AP_ExternalAHRS.h"
|
||||
#include "AP_ExternalAHRS_backend.h"
|
||||
#include "AP_ExternalAHRS_VectorNav.h"
|
||||
#include "AP_ExternalAHRS_LORD.h"
|
||||
|
||||
#include <GCS_MAVLink/GCS.h>
|
||||
|
||||
extern const AP_HAL::HAL &hal;
|
||||
|
@ -90,13 +93,17 @@ void AP_ExternalAHRS::init(void)
|
|||
case DevType::None:
|
||||
// nothing to do
|
||||
break;
|
||||
#if AP_EXTERNAL_AHRS_VECTORNAV_ENABLED
|
||||
case DevType::VecNav:
|
||||
backend = new AP_ExternalAHRS_VectorNav(this, state);
|
||||
break;
|
||||
#endif
|
||||
#if AP_EXTERNAL_AHRS_LORD_ENABLED
|
||||
case DevType::LORD:
|
||||
backend = new AP_ExternalAHRS_LORD(this, state);
|
||||
break;
|
||||
default:
|
||||
#endif
|
||||
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Unsupported ExternalAHRS type %u", unsigned(devtype));
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,12 @@ public:
|
|||
|
||||
enum class DevType : uint8_t {
|
||||
None = 0,
|
||||
#if AP_EXTERNAL_AHRS_VECTORNAV_ENABLED
|
||||
VecNav = 1,
|
||||
#endif
|
||||
#if AP_EXTERNAL_AHRS_LORD_ENABLED
|
||||
LORD = 2,
|
||||
#endif
|
||||
};
|
||||
|
||||
static AP_ExternalAHRS *get_singleton(void) {
|
||||
|
|
|
@ -16,8 +16,11 @@
|
|||
|
||||
#define ALLOW_DOUBLE_MATH_FUNCTIONS
|
||||
|
||||
#include "AP_ExternalAHRS_config.h"
|
||||
|
||||
#if AP_EXTERNAL_AHRS_LORD_ENABLED
|
||||
|
||||
#include "AP_ExternalAHRS_LORD.h"
|
||||
#if HAL_EXTERNAL_AHRS_LORD_ENABLED
|
||||
#include <AP_Baro/AP_Baro.h>
|
||||
#include <AP_Compass/AP_Compass.h>
|
||||
#include <AP_GPS/AP_GPS.h>
|
||||
|
@ -582,5 +585,4 @@ double AP_ExternalAHRS_LORD::extract_double(const uint8_t *data, uint8_t offset)
|
|||
return *reinterpret_cast<double*>(&tmp);
|
||||
}
|
||||
|
||||
#endif // HAL_EXTERNAL_AHRS_ENABLED
|
||||
|
||||
#endif // AP_EXTERNAL_AHRS_LORD_ENABLE
|
||||
|
|
|
@ -16,15 +16,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "AP_ExternalAHRS_config.h"
|
||||
|
||||
#if AP_EXTERNAL_AHRS_LORD_ENABLED
|
||||
|
||||
#include "AP_ExternalAHRS_backend.h"
|
||||
|
||||
#ifndef HAL_EXTERNAL_AHRS_LORD_ENABLED
|
||||
#define HAL_EXTERNAL_AHRS_LORD_ENABLED HAL_EXTERNAL_AHRS_ENABLED
|
||||
#endif
|
||||
|
||||
#if HAL_EXTERNAL_AHRS_LORD_ENABLED
|
||||
|
||||
#include <GCS_MAVLink/GCS_MAVLink.h>
|
||||
#include <AP_GPS/AP_GPS.h>
|
||||
|
||||
class AP_ExternalAHRS_LORD: public AP_ExternalAHRS_backend
|
||||
{
|
||||
|
@ -153,5 +150,4 @@ private:
|
|||
|
||||
};
|
||||
|
||||
#endif // HAL_EXTERNAL_AHRS_ENABLED
|
||||
|
||||
#endif // AP_EXTERNAL_AHRS_LORD_ENABLED
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
|
||||
#define ALLOW_DOUBLE_MATH_FUNCTIONS
|
||||
|
||||
#include "AP_ExternalAHRS_config.h"
|
||||
|
||||
#if AP_EXTERNAL_AHRS_VECTORNAV_ENABLED
|
||||
|
||||
#include "AP_ExternalAHRS_VectorNav.h"
|
||||
#include <AP_Math/AP_Math.h>
|
||||
#include <AP_Math/crc.h>
|
||||
|
@ -31,8 +35,6 @@
|
|||
#include <stdio.h>
|
||||
#include <AP_BoardConfig/AP_BoardConfig.h>
|
||||
|
||||
#if HAL_EXTERNAL_AHRS_ENABLED
|
||||
|
||||
extern const AP_HAL::HAL &hal;
|
||||
|
||||
/*
|
||||
|
@ -819,5 +821,4 @@ void AP_ExternalAHRS_VectorNav::send_status_report(GCS_MAVLINK &link) const
|
|||
mag_var, 0, 0);
|
||||
}
|
||||
|
||||
#endif // HAL_EXTERNAL_AHRS_ENABLED
|
||||
|
||||
#endif // AP_EXTERNAL_AHRS_VECTORNAV_ENABLED
|
||||
|
|
|
@ -18,9 +18,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "AP_ExternalAHRS_backend.h"
|
||||
#include "AP_ExternalAHRS_config.h"
|
||||
|
||||
#if HAL_EXTERNAL_AHRS_ENABLED
|
||||
#if AP_EXTERNAL_AHRS_VECTORNAV_ENABLED
|
||||
|
||||
#include "AP_ExternalAHRS_backend.h"
|
||||
|
||||
class AP_ExternalAHRS_VectorNav : public AP_ExternalAHRS_backend {
|
||||
|
||||
|
@ -92,5 +94,4 @@ private:
|
|||
|
||||
};
|
||||
|
||||
#endif // HAL_EXTERNAL_AHRS_ENABLED
|
||||
|
||||
#endif // AP_EXTERNAL_AHRS_VECTORNAV_ENABLED
|
||||
|
|
|
@ -5,3 +5,15 @@
|
|||
#ifndef HAL_EXTERNAL_AHRS_ENABLED
|
||||
#define HAL_EXTERNAL_AHRS_ENABLED BOARD_FLASH_SIZE > 1024
|
||||
#endif
|
||||
|
||||
#ifndef AP_EXTERNAL_AHRS_BACKEND_DEFAULT_ENABLED
|
||||
#define AP_EXTERNAL_AHRS_BACKEND_DEFAULT_ENABLED HAL_EXTERNAL_AHRS_ENABLED
|
||||
#endif
|
||||
|
||||
#ifndef AP_EXTERNAL_AHRS_LORD_ENABLED
|
||||
#define AP_EXTERNAL_AHRS_LORD_ENABLED AP_EXTERNAL_AHRS_BACKEND_DEFAULT_ENABLED
|
||||
#endif
|
||||
|
||||
#ifndef AP_EXTERNAL_AHRS_VECTORNAV_ENABLED
|
||||
#define AP_EXTERNAL_AHRS_VECTORNAV_ENABLED AP_EXTERNAL_AHRS_BACKEND_DEFAULT_ENABLED
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue