mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-03 12:14:10 -04:00
AP_Compass: add and use AP_SIM_COMPASS_ENABLED
This commit is contained in:
parent
48abb57a8a
commit
ed608d37f6
@ -1227,7 +1227,7 @@ void Compass::_detect_backends(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
#if AP_SIM_COMPASS_ENABLED
|
||||||
ADD_BACKEND(DRIVER_SITL, new AP_Compass_SITL());
|
ADD_BACKEND(DRIVER_SITL, new AP_Compass_SITL());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -70,6 +70,10 @@
|
|||||||
|
|
||||||
#define MAX_CONNECTED_MAGS (COMPASS_MAX_UNREG_DEV+COMPASS_MAX_INSTANCES)
|
#define MAX_CONNECTED_MAGS (COMPASS_MAX_UNREG_DEV+COMPASS_MAX_INSTANCES)
|
||||||
|
|
||||||
|
#ifndef AP_SIM_COMPASS_ENABLED
|
||||||
|
#define AP_SIM_COMPASS_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "CompassCalibrator.h"
|
#include "CompassCalibrator.h"
|
||||||
|
|
||||||
class CompassLearn;
|
class CompassLearn;
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#include "AP_Compass_SITL.h"
|
#include "AP_Compass_SITL.h"
|
||||||
|
|
||||||
|
#if AP_SIM_COMPASS_ENABLED
|
||||||
|
|
||||||
#include <AP_HAL/AP_HAL.h>
|
#include <AP_HAL/AP_HAL.h>
|
||||||
|
|
||||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
|
||||||
extern const AP_HAL::HAL& hal;
|
extern const AP_HAL::HAL& hal;
|
||||||
|
|
||||||
AP_Compass_SITL::AP_Compass_SITL()
|
AP_Compass_SITL::AP_Compass_SITL()
|
||||||
@ -158,4 +159,4 @@ void AP_Compass_SITL::read()
|
|||||||
drain_accumulated_samples(_compass_instance[i], nullptr);
|
drain_accumulated_samples(_compass_instance[i], nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif // AP_SIM_COMPASS_ENABLED
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "AP_Compass.h"
|
#include "AP_Compass.h"
|
||||||
|
|
||||||
|
#if AP_SIM_COMPASS_ENABLED
|
||||||
|
|
||||||
#include "AP_Compass_Backend.h"
|
#include "AP_Compass_Backend.h"
|
||||||
|
|
||||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
|
||||||
#include <SITL/SITL.h>
|
|
||||||
#include <AP_Math/vectorN.h>
|
#include <AP_Math/vectorN.h>
|
||||||
#include <AP_Math/AP_Math.h>
|
#include <AP_Math/AP_Math.h>
|
||||||
#include <AP_Declination/AP_Declination.h>
|
#include <AP_Declination/AP_Declination.h>
|
||||||
|
#include <SITL/SITL.h>
|
||||||
|
|
||||||
#define MAX_SITL_COMPASSES 3
|
#define MAX_SITL_COMPASSES 3
|
||||||
|
|
||||||
@ -42,4 +44,4 @@ private:
|
|||||||
Vector3f _last_odi;
|
Vector3f _last_odi;
|
||||||
Vector3f _last_data[MAX_SITL_COMPASSES];
|
Vector3f _last_data[MAX_SITL_COMPASSES];
|
||||||
};
|
};
|
||||||
#endif // CONFIG_HAL_BOARD
|
#endif // AP_SIM_COMPASS_ENABLED
|
||||||
|
Loading…
Reference in New Issue
Block a user