157,7 → 157,7 |
//---------------------------------------------------------------- |
void MK3MAG_SendCommand(u8 command) |
{ |
// trya to catch the I2C buffer |
// try to catch the I2C buffer |
if(I2C_LockBuffer(0)) |
{ |
u16 TxBytes = 0; |
279,17 → 279,17 |
} |
if(MK3MAG_WriteCal.CalByte == 2) |
{ |
Compass_UpdateMagVector(); |
if(MagVector.X > x_max) { x_max = MagVector.X; BeepTime = 30; }; |
if(MagVector.Y > y_max) { y_max = MagVector.Y; BeepTime = 30; }; |
if(MagVector.X < x_min) { x_min = MagVector.X; BeepTime = 30; }; |
if(MagVector.Y < y_min) { y_min = MagVector.Y; BeepTime = 30; }; |
MK3MAG_SendCommand(MK3MAG_CMD_READ_MAGVECT); |
if(MagVector.X > x_max) { x_max = MagVector.X; BeepTime = 30; }; |
if(MagVector.Y > y_max) { y_max = MagVector.Y; BeepTime = 30; }; |
if(MagVector.X < x_min) { x_min = MagVector.X; BeepTime = 30; }; |
if(MagVector.Y < y_min) { y_min = MagVector.Y; BeepTime = 30; }; |
} |
if(MK3MAG_WriteCal.CalByte == 4) |
{ |
Compass_UpdateMagVector(); |
if(MagVector.Z > z_max) { z_max = MagVector.Z; BeepTime = 30; }; |
if(MagVector.Z < z_min) { z_min = MagVector.Z; BeepTime = 30; }; |
MK3MAG_SendCommand(MK3MAG_CMD_READ_MAGVECT); |
if(MagVector.Z > z_max) { z_max = MagVector.Z; BeepTime = 30; }; |
if(MagVector.Z < z_min) { z_min = MagVector.Z; BeepTime = 30; }; |
} |
else // request current heading |
{ |