Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 227 → Rev 228

/trunk/i2c.c
188,7 → 188,6
VIC_Config(I2C1_ITLine, VIC_IRQ , PRIORITY_I2C1);
 
I2C1_Timeout = SetDelay(10*I2C1_TIMEOUT);
I2C_Heading.Heading = -1;
I2C_GenerateSTOP(I2C1, ENABLE);
I2C_State = I2C_IDLE;
 
230,7 → 229,7
I2C_RxBufferSize = 0;
 
I2C1_Timeout = SetDelay(10*I2C1_TIMEOUT);
I2C_Heading.Heading = -1;
I2C_Heading.Heading = -2;
 
UART1_PutString("ok");
}
/trunk/main.c
134,7 → 134,7
ErrorCode = 3;
StopNavigation = 1;
}
else if(CheckDelay(I2C1_Timeout))
else if((CheckDelay(I2C1_Timeout)) || (I2C_Heading.Heading == -2))
{
LED_RED_ON;
sprintf(ErrorMSG,"no MK3Mag communication ");
241,6 → 241,7
// initialize SPI0 to FC
SPI0_Init();
// initialize i2c bus to MK3MAG (needs Timer 1)
I2C_Heading.Heading = -1;
I2C1_Init();
// initialize the gps position controller (needs Timer 1)
Fat16_Init();
281,7 → 282,7
VIC_Config(EXTIT3_ITLine, VIC_IRQ, PRIORITY_SW);
// enable interrupts
VIC_ITCmd(EXTIT3_ITLine, ENABLE);
 
I2C1_Timeout = SetDelay(1000);
for (;;) // the endless main loop
{
UART0_ProcessRxData(); // process request
304,7 → 305,7
if(SerialLinkOkay) SerialLinkOkay--;
if(SerialLinkOkay < 250 - 5) NCFlags |= NC_FLAG_NOSERIALLINK; // 5 seconds timeout for serial communication
else NCFlags &= ~NC_FLAG_NOSERIALLINK;
if(StopNavigation && (Parameter.NaviGpsModeControl >= 50)) BeepTime = 500;
if(StopNavigation && (Parameter.NaviGpsModeControl >= 50)) BeepTime = 1000;
}
// ---------------- Logging ---------------------------------------
Logging_Update(); // could be block some time for at max. 2 seconds, therefore move time critical part of the mainloop into the ISR of timer 1
/trunk/main.h
3,13 → 3,13
 
#define VERSION_MAJOR 0
#define VERSION_MINOR 19
#define VERSION_PATCH 2
#define VERSION_PATCH 3
 
#define VERSION_SERIAL_MAJOR 11
#define VERSION_SERIAL_MINOR 0
 
#define FC_SPI_COMPATIBLE 13
#define MK3MAG_I2C_COMPATIBLE 3
#define MK3MAG_I2C_COMPATIBLE 4
// FC FLAGS
#define FCFLAG_MOTOR_RUN 0x01
/trunk/spi_slave.c
283,7 → 283,7
VIC_ITCmd(SSP0_ITLine, DISABLE); // disable SPI interrupt
ToFlightCtrl.CompassHeading = I2C_Heading.Heading;
DebugOut.Analog[10] = ToFlightCtrl.CompassHeading;
ToFlightCtrl.CompassHeading = (360 + ToFlightCtrl.CompassHeading + FromFlightCtrl.GyroYaw / 12) % 360;
if(ToFlightCtrl.CompassHeading >= 0) ToFlightCtrl.CompassHeading = (360 + ToFlightCtrl.CompassHeading + FromFlightCtrl.GyroYaw / 12) % 360;
// cycle spi commands
ToFlightCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++];
// restart command cycle at the end
314,10 → 314,10
ToFlightCtrl.Param.Byte[0] = GPSData.Flags;
ToFlightCtrl.Param.Byte[1] = GPSData.NumOfSats;
ToFlightCtrl.Param.Byte[2] = GPSData.SatFix;
ToFlightCtrl.Param.Byte[3] = GPSData.Speed_Ground / 100;
ToFlightCtrl.Param.Int[2] = NaviData.HomePositionDeviation.Distance; // dm
ToFlightCtrl.Param.sInt[3] = NaviData.HomePositionDeviation.Bearing; // deg
ToFlightCtrl.Param.sInt[3] = NaviData.HomePositionDeviation.Bearing; // deg
break;
 
default:
break;
}