ardupilot/libraries/AP_Compass/AP_Compass_PX4.h
Andrew Tridgell 0fce0eb488 AP_Compass_PX4: fixed handling of a saturated compass
a saturated compass is now marked unhealthy, rather than causing the
code to spin waiting for a valid sample. This fixes a problem with
strong magnets causing the main flight loop to stop
2013-05-01 08:54:53 +10:00

30 lines
644 B
C++

/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#ifndef AP_Compass_PX4_H
#define AP_Compass_PX4_H
#include "Compass.h"
class AP_Compass_PX4 : public Compass
{
public:
AP_Compass_PX4() : Compass() {
product_id = AP_COMPASS_TYPE_PX4;
}
bool init(void);
bool read(void);
void accumulate(void);
private:
static int _mag_fd;
static Vector3f _sum;
static uint32_t _count;
static uint32_t _last_timer;
static uint64_t _last_timestamp;
static void _accumulate(void);
static void _compass_timer(uint32_t now);
};
#endif // AP_Compass_PX4_H