AP_Compass: setup HIL/SITL for two compasses

This commit is contained in:
Andrew Tridgell 2015-05-16 07:06:04 +10:00
parent ab687ab0f5
commit 2475ee9630
2 changed files with 8 additions and 2 deletions

View File

@ -51,7 +51,7 @@ bool
AP_Compass_HIL::init(void)
{
// register two compass instances
for (uint8_t i=0; i<COMPASS_MAX_INSTANCES; i++) {
for (uint8_t i=0; i<HIL_NUM_COMPASSES; i++) {
_compass_instance[i] = register_compass();
}
return true;

View File

@ -4,6 +4,12 @@
#include "Compass.h"
#if COMPASS_MAX_INSTANCES == 1
# define HIL_NUM_COMPASSES 1
#else
# define HIL_NUM_COMPASSES 2
#endif
class AP_Compass_HIL : public AP_Compass_Backend
{
public:
@ -15,7 +21,7 @@ public:
static AP_Compass_Backend *detect(Compass &compass);
private:
uint8_t _compass_instance[COMPASS_MAX_INSTANCES];
uint8_t _compass_instance[HIL_NUM_COMPASSES];
};
#endif