Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 231 → Rev 232

/trunk/main.c
150,15 → 150,14
 
void CheckErrors(void)
{
UART_VersionInfo.HardwareError[0] = 0;
UART_VersionInfo.HardwareError[0] = 0;
 
if((MK3MAG_Version.Compatible != MK3MAG_I2C_COMPATIBLE) || (CheckDelay(I2C1_Timeout)) || (MK3MAG_Version.Compatible != MK3MAG_I2C_COMPATIBLE) || (I2C_Heading.Heading < 0)) DebugOut.Status[1] |= 0x08;
else DebugOut.Status[1] &= ~0x08; // MK3Mag green status
if((FC_ErrorCode[1] & DEFEKT_I2C) || (FC_ErrorCode[1] & DEFEKT_BL_MISSING)) DebugOut.Status[1] |= 0x02;
else DebugOut.Status[1] &= ~0x02; // BL-Ctrl green status
if((MK3MAG_Version.Compatible != MK3MAG_I2C_COMPATIBLE) || CheckDelay(I2C1_Timeout) || (I2C_Heading.Heading < 0)) DebugOut.Status[1] |= 0x08;
else DebugOut.Status[1] &= ~0x08; // MK3Mag green status
 
if((FC_ErrorCode[1] & DEFEKT_I2C) || (FC_ErrorCode[1] & DEFEKT_BL_MISSING)) DebugOut.Status[1] |= 0x02;
else DebugOut.Status[1] &= ~0x02; // BL-Ctrl green status
 
if(CheckDelay(SPI0_Timeout))
{
LED_RED_ON;
166,7 → 165,7
ErrorCode = 3;
StopNavigation = 1;
DebugOut.Status[0] &= ~0x01; // status of FC Present
DebugOut.Status[0] &= ~0x02; // status of BL Present
DebugOut.Status[0] &= ~0x02; // status of BL Present
UART_VersionInfo.HardwareError[0] |= ERROR_FC_COMMUNICATION;
}
else if(CheckDelay(I2C1_Timeout))
179,7 → 178,7
ErrorCode = 4;
StopNavigation = 1;
UART_VersionInfo.HardwareError[0] |= ERROR_MK3_COMMUNICATION;
DebugOut.Status[1] |= 0x08;
DebugOut.Status[1] |= 0x08;
}
else if(FC_Version.Compatible != FC_SPI_COMPATIBLE)
{
195,61 → 194,61
LED_RED_ON;
sprintf(ErrorMSG,"ERR: FC Nick Gyro");
ErrorCode = 10;
}
}
else if(FC_ErrorCode[0] & DEFEKT_G_ROLL)
{
LED_RED_ON;
sprintf(ErrorMSG,"ERR: FC Roll Gyro");
ErrorCode = 11;
}
}
else if(FC_ErrorCode[0] & DEFEKT_G_GIER)
{
LED_RED_ON;
sprintf(ErrorMSG,"ERR: FC Yaw Gyro");
ErrorCode = 12;
}
}
else if(FC_ErrorCode[0] & DEFEKT_A_NICK)
{
LED_RED_ON;
sprintf(ErrorMSG,"ERR: FC Nick ACC");
ErrorCode = 13;
}
}
else if(FC_ErrorCode[0] & DEFEKT_A_ROLL)
{
LED_RED_ON;
sprintf(ErrorMSG,"ERR: FC Roll ACC");
ErrorCode = 14;
}
}
else if(FC_ErrorCode[0] & DEFEKT_A_Z)
{
LED_RED_ON;
sprintf(ErrorMSG,"ERR: FC Z-ACC");
ErrorCode = 15;
}
}
else if(FC_ErrorCode[0] & DEFEKT_PRESSURE)
{
LED_RED_ON;
sprintf(ErrorMSG,"ERR: Pressure sensor");
ErrorCode = 16;
}
}
else if(FC_ErrorCode[1] & DEFEKT_I2C)
{
LED_RED_ON;
sprintf(ErrorMSG,"ERR: FC I2C");
ErrorCode = 17;
}
}
else if(FC_ErrorCode[1] & DEFEKT_BL_MISSING)
{
LED_RED_ON;
sprintf(ErrorMSG,"ERR: Bl Missing");
ErrorCode = 18;
}
}
else if(FC_ErrorCode[1] & DEFEKT_MIXER_ERR)
{
LED_RED_ON;
sprintf(ErrorMSG,"Mixer Error");
ErrorCode = 19;
}
}
else if(MK3MAG_Version.Compatible != MK3MAG_I2C_COMPATIBLE)
{
sprintf(ErrorMSG,"MK3Mag not compatible ");
286,7 → 285,7
LED_RED_ON;
sprintf(ErrorMSG,"FC: Carefree Error");
ErrorCode = 20;
}
}
else if(FC.RC_Quality < 100)
{
LED_RED_ON;
300,8 → 299,8
StopNavigation = 0;
LED_RED_OFF;
}
if(UART_VersionInfo.HardwareError[0] || UART_VersionInfo.HardwareError[1] || UART_VersionInfo.HardwareError[0]) DebugOut.Status[1] |= 0x04;
else DebugOut.Status[1] &= ~0x04;
if(UART_VersionInfo.HardwareError[0] || UART_VersionInfo.HardwareError[1]) DebugOut.Status[1] |= 0x04;
else DebugOut.Status[1] &= ~0x04;
}
 
// the handler will be cyclic called by the timer 1 ISR
/trunk/spi_slave.c
317,7 → 317,7
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.Byte[3] = GPSData.Speed_Ground / 100; // m/s
ToFlightCtrl.Param.Int[2] = NaviData.HomePositionDeviation.Distance; // dm
ToFlightCtrl.Param.sInt[3] = NaviData.HomePositionDeviation.Bearing; // deg
break;
436,8 → 436,9
FC_ErrorCode[1] = FromFlightCtrl.Param.Byte[6];
FC_ErrorCode[2] = FromFlightCtrl.Param.Byte[7];
DebugOut.Status[0] |= 0x01; // status of FC Present
DebugOut.Status[0] |= 0x02; // status of BL Present
if(FC_ErrorCode[0] || FC_ErrorCode[1] || FC_ErrorCode[2]) DebugOut.Status[1] |= 0x01; else DebugOut.Status[1] &= ~0x01;
DebugOut.Status[0] |= 0x02; // status of BL Present
if(FC_ErrorCode[0] || FC_ErrorCode[1] || FC_ErrorCode[2]) DebugOut.Status[1] |= 0x01;
else DebugOut.Status[1] &= ~0x01;
break;
default:
break;