324,7 → 324,7 |
// Save values |
if(Compass_CalState != OldCalState) // avoid continously writing of eeprom! |
{ |
#define MIN_CALIBRATION 512 |
#define MIN_CALIBRATION 256 |
Calibration.MagX.Range = Xmax - Xmin; |
Calibration.MagX.Offset = (Xmin + Xmax) / 2; |
Calibration.MagY.Range = Ymax - Ymin; |
678,9 → 678,9 |
// activate positive bias field |
NCMAG_SetMagConfig(); |
// check scale for all axes |
xscale = (XMax - XMin)/(2*AVERAGE); |
// prepare scale limits |
LIMITS(xscale, scale_min, scale_max); |
xscale = (XMax - XMin)/(2*AVERAGE); |
if((xscale > scale_max) || (xscale < scale_min)) |
{ |
retval = 0; |
687,8 → 687,8 |
sprintf(msg, "\r\n Value X: %d not %d-%d !", xscale, scale_min,scale_max); |
UART1_PutString(msg); |
} |
LIMITS(yscale, scale_min, scale_max); |
yscale = (YMax - YMin)/(2*AVERAGE); |
LIMITS(yscale, scale_min, scale_max); |
if((yscale > scale_max) || (yscale < scale_min)) |
{ |
retval = 0; |
695,8 → 695,8 |
sprintf(msg, "\r\n Value Y: %d not %d-%d !", yscale, scale_min,scale_max); |
UART1_PutString(msg); |
} |
LIMITS(zscale, scale_min, scale_max); |
zscale = (ZMax - ZMin)/(2*AVERAGE); |
LIMITS(zscale, scale_min, scale_max); |
if((zscale > scale_max) || (zscale < scale_min)) |
{ |
retval = 0; |