Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 266 → Rev 267

/trunk/menu.c
65,6 → 65,7
#include "spi_slave.h"
#include "menu.h"
#include "uart1.h"
#include "ncmag.h"
 
u8 DispPtr = 0;
s8 DisplayBuff[DISPLAYBUFFSIZE];
365,10 → 366,10
else
{
LCD_printfxy(0,0,"Magnetic Field");
LCD_printfxy(0,1,"X: %4i",MagVector.X);
LCD_printfxy(0,2,"Y: %4i",MagVector.Y);
LCD_printfxy(0,3,"Z: %4i",MagVector.Z);
LCD_printfxy(13,3,"(CALIB)");
LCD_printfxy(0,1,"X:%5i (%4i) ",MagVector.X, MagRawVector.X);
LCD_printfxy(0,2,"Y:%5i (%4i) ",MagVector.Y, MagRawVector.Y);
LCD_printfxy(0,3,"Z:%5i (%4i) ",MagVector.Z, MagRawVector.Z);
LCD_printfxy(15,3,"(CAL)");
}
if(Keys & KEY4) // next step
{
/trunk/ncmag.c
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;
/trunk/ncmag.h
4,6 → 4,7
#include "compass.h"
 
extern s16vec_t ACC_Vector;
extern volatile s16vec_t MagRawVector;
 
u8 NCMAG_Init(void);
void NCMAG_UpdateCompass(void);