Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 222 → Rev 223

/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;
ToFlightCtrl.CompassHeading = (360 + ToFlightCtrl.CompassHeading + FromFlightCtrl.GyroYaw / 12) % 360;
// cycle spi commands
ToFlightCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++];
// restart command cycle at the end
292,7 → 292,7
switch (ToFlightCtrl.Command)
{
case SPI_NCCMD_KALMAN:
CalcHeadFree();
CalcHeadFree();
ToFlightCtrl.Param.sByte[0] = (s8) Kalman_K;
ToFlightCtrl.Param.sByte[1] = (s8) Kalman_MaxFusion;
ToFlightCtrl.Param.sByte[2] = (s8) Kalman_MaxDrift;
299,7 → 299,7
ToFlightCtrl.Param.Byte[3] = (u8) SerialLinkOkay;
ToFlightCtrl.Param.sByte[4] = (s8) ToFcGpsZ;
ToFlightCtrl.Param.Byte[5] = (s8) ToFC_Rotate_C;
ToFlightCtrl.Param.Byte[6] = (s8) ToFC_Rotate_S;
ToFlightCtrl.Param.Byte[6] = (s8) ToFC_Rotate_S;
break;
 
case SPI_NCCMD_VERSION:
309,7 → 309,7
ToFlightCtrl.Param.Byte[3] = FC_SPI_COMPATIBLE;
ToFlightCtrl.Param.Byte[4] = BoardRelease;
break;
 
case SPI_NCCMD_GPSINFO:
ToFlightCtrl.Param.Byte[0] = GPSData.Flags;
ToFlightCtrl.Param.Byte[1] = GPSData.NumOfSats;
340,15 → 340,15
FC.Flags = 0;
ClearFCFlags = 0;
}
FC.Flags |= FromFlightCtrl.Param.Byte[8];
Parameter.ActiveSetting = FromFlightCtrl.Param.Byte[9];
FC.Flags |= FromFlightCtrl.Param.Byte[8];
Parameter.ActiveSetting = FromFlightCtrl.Param.Byte[9];
DebugOut.Analog[5] = FC.Flags;
NaviData.FCFlags = FC.Flags;
HeadFreeStartAngle = (s32) FromFlightCtrl.Param.Byte[10] * 20;
HeadFreeStartAngle = (s32) FromFlightCtrl.Param.Byte[10] * 20; // convert to 0.1°
break;
 
case SPI_FCCMD_ACCU:
FC.BAT_Current = FromFlightCtrl.Param.Int[0];
FC.BAT_Current = FromFlightCtrl.Param.Int[0];
FC.BAT_UsedCapacity = FromFlightCtrl.Param.Int[1];
FC.BAT_Voltage = FromFlightCtrl.Param.Byte[4];
Parameter.LowVoltageWarning = FromFlightCtrl.Param.Byte[5];