ardupilot/libraries/AP_Compass/AP_Compass_HIL.h
Andrew Tridgell c59bdc12df AP_Compass: fix the milligauss handling
the previous approach assumed a 1:1 mapping between compass backends
and compass instances, which isn't true on PX4.

It also only setup milligauss offsets on a set_and_save call, which is
not the only way offsets change

this adds a milligauss_ratio per instance, which is considerably
simpler
2015-09-09 14:53:11 +10:00

28 lines
551 B
C++

/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#ifndef AP_Compass_HIL_H
#define AP_Compass_HIL_H
#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:
AP_Compass_HIL(Compass &compass);
void read(void);
bool init(void);
// detect the sensor
static AP_Compass_Backend *detect(Compass &compass);
private:
uint8_t _compass_instance[HIL_NUM_COMPASSES];
};
#endif