1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

Moved compass health check into compass.c

This commit is contained in:
Martin Budden 2018-01-20 11:59:20 +00:00
parent ded85bfce1
commit 3116ef4008
4 changed files with 13 additions and 9 deletions

View file

@ -262,6 +262,11 @@ bool compassInit(void)
return true;
}
bool compassIsHealthy(void)
{
return (mag.magADC[X] != 0) && (mag.magADC[Y] != 0) && (mag.magADC[Z] != 0);
}
void compassUpdate(timeUs_t currentTimeUs)
{
static timeUs_t tCal = 0;
@ -310,4 +315,4 @@ void compassUpdate(timeUs_t currentTimeUs)
}
}
}
#endif
#endif // USE_MAG

View file

@ -17,9 +17,9 @@
#pragma once
#include "common/time.h"
#include "drivers/io_types.h"
#include "drivers/sensor.h"
#include "common/time.h"
#include "pg/pg.h"
#include "sensors/sensors.h"
@ -56,6 +56,7 @@ typedef struct compassConfig_s {
PG_DECLARE(compassConfig_t, compassConfig);
bool compassInit(void);
bool compassIsHealthy(void);
void compassUpdate(timeUs_t currentTime);
bool compassInit(void);