21 #define F_USING_MAG 0x0002 // normally should be defined in build.h 27 #define MAGBUFFSIZEX 14 28 #define MAGBUFFSIZEY (2 * MAGBUFFSIZEX)
29 #define MINMEASUREMENTS4CAL 110
30 #define MINMEASUREMENTS7CAL 220
31 #define MINMEASUREMENTS10CAL 330
32 #define MAXMEASUREMENTS 360
33 #define CAL_INTERVAL_SECS 300
34 #define MINBFITUT 10.0F
35 #define MAXBFITUT 90.0F
36 #define FITERRORAGINGSECS 86400.0F
37 #define MESHDELTACOUNTS 50
38 #define DEFAULTB 50.0F
108 #else // if F_USING_MAG 119 #endif // if F_USING_MAG 120 #endif // #ifndef MAGNETIC_H void fUpdateMagCalibration10(struct MagCalibration *pthisMagCal, struct MagBuffer *pthisMagBuffer, struct MagSensor *pthisMag)
float fFitErrorpc
current fit error %
int16_t iMagBufferCount
number of magnetometer readings
void fUpdateMagCalibration4Slice(struct MagCalibration *pthisMagCal, struct MagBuffer *pthisMagBuffer, struct MagSensor *pthisMag)
int32_t iValidMagCal
solver used: 0 (no calibration) or 4, 7, 10 element
#define MAGBUFFSIZEX
x dimension in magnetometer buffer (12x24 equals 288 elements)
int32_t index[MAGBUFFSIZEX][MAGBUFFSIZEY]
array of time indices
The MagSensor structure stores raw and processed measurements for a 3-axis magnetic sensor...
int8_t i10ElementSolverTried
flag to denote at least one attempt made with 4 element calibration
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
int16_t tanarray[MAGBUFFSIZEX - 1]
array of tangents of (100 * angle)
#define MAGBUFFSIZEY
y dimension in magnetometer buffer (12x24 equals 288 elements)
float fYTY
Y^T.Y for 4 element calibration = (iB^2)^2.
float ftrFitErrorpc
trial value of fit error %
int16_t iBs[3][MAGBUFFSIZEX][MAGBUFFSIZEY]
uncalibrated magnetometer readings
void fUpdateMagCalibration10Slice(struct MagCalibration *pthisMagCal, struct MagBuffer *pthisMagBuffer, struct MagSensor *pthisMag)
void fInitializeMagCalibration(struct MagCalibration *pthisMagCal, struct MagBuffer *pthisMagBuffer)
void fUpdateMagCalibration7Slice(struct MagCalibration *pthisMagCal, struct MagBuffer *pthisMagBuffer, struct MagSensor *pthisMag)
float ftrB
trial value of geomagnetic field magnitude in uT
Magnetic Calibration Structure.
int8_t iInitiateMagCal
flag to start a new magnetic calibration
void fRunMagCalibration(struct MagCalibration *pthisMagCal, struct MagBuffer *pthisMagBuffer, struct MagSensor *pthisMag, int32_t loopcounter)
int8_t iNewCalibrationAvailable
flag denoting that a new calibration has been computed
int8_t i4ElementSolverTried
flag to denote at least one attempt made with 4 element calibration
void fUpdateMagCalibration7(struct MagCalibration *pthisMagCal, struct MagBuffer *pthisMagBuffer, struct MagSensor *pthisMag)
int32_t itimeslice
counter for tine slicing magnetic calibration calculations
int8_t i7ElementSolverTried
flag to denote at least one attempt made with 4 element calibration
int8_t iMagBufferReadOnly
flag to denote that the magnetic measurement buffer is temporarily read only
float fB
current geomagnetic field magnitude (uT)
void fUpdateMagCalibration4(struct MagCalibration *pthisMagCal, struct MagBuffer *pthisMagBuffer, struct MagSensor *pthisMag)
void fInvertMagCal(struct MagSensor *pthisMag, struct MagCalibration *pthisMagCal)
void iUpdateMagBuffer(struct MagBuffer *pthisMagBuffer, struct MagSensor *pthisMag, int32_t loopcounter)
int8_t iCalInProgress
flag denoting that a calibration is in progress
float fBSq
square of fB (uT^2)