Rev 223 | Rev 231 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 223 | Rev 228 | ||
---|---|---|---|
Line 281... | Line 281... | ||
281 | { |
281 | { |
282 | // avoid sending data via SPI during the update of the ToFlightCtrl structure |
282 | // avoid sending data via SPI during the update of the ToFlightCtrl structure |
283 | VIC_ITCmd(SSP0_ITLine, DISABLE); // disable SPI interrupt |
283 | VIC_ITCmd(SSP0_ITLine, DISABLE); // disable SPI interrupt |
284 | ToFlightCtrl.CompassHeading = I2C_Heading.Heading; |
284 | ToFlightCtrl.CompassHeading = I2C_Heading.Heading; |
285 | DebugOut.Analog[10] = ToFlightCtrl.CompassHeading; |
285 | DebugOut.Analog[10] = ToFlightCtrl.CompassHeading; |
286 | ToFlightCtrl.CompassHeading = (360 + ToFlightCtrl.CompassHeading + FromFlightCtrl.GyroYaw / 12) % 360; |
286 | if(ToFlightCtrl.CompassHeading >= 0) ToFlightCtrl.CompassHeading = (360 + ToFlightCtrl.CompassHeading + FromFlightCtrl.GyroYaw / 12) % 360; |
287 | // cycle spi commands |
287 | // cycle spi commands |
288 | ToFlightCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++]; |
288 | ToFlightCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++]; |
289 | // restart command cycle at the end |
289 | // restart command cycle at the end |
290 | if (SPI_CommandCounter >= sizeof(SPI_CommandSequence)) SPI_CommandCounter = 0; |
290 | if (SPI_CommandCounter >= sizeof(SPI_CommandSequence)) SPI_CommandCounter = 0; |
Line 312... | Line 312... | ||
312 | 312 | ||
313 | case SPI_NCCMD_GPSINFO: |
313 | case SPI_NCCMD_GPSINFO: |
314 | ToFlightCtrl.Param.Byte[0] = GPSData.Flags; |
314 | ToFlightCtrl.Param.Byte[0] = GPSData.Flags; |
315 | ToFlightCtrl.Param.Byte[1] = GPSData.NumOfSats; |
315 | ToFlightCtrl.Param.Byte[1] = GPSData.NumOfSats; |
- | 316 | ToFlightCtrl.Param.Byte[2] = GPSData.SatFix; |
|
316 | ToFlightCtrl.Param.Byte[2] = GPSData.SatFix; |
317 | ToFlightCtrl.Param.Byte[3] = GPSData.Speed_Ground / 100; |
317 | ToFlightCtrl.Param.Int[2] = NaviData.HomePositionDeviation.Distance; // dm |
318 | ToFlightCtrl.Param.Int[2] = NaviData.HomePositionDeviation.Distance; // dm |
318 | ToFlightCtrl.Param.sInt[3] = NaviData.HomePositionDeviation.Bearing; // deg |
319 | ToFlightCtrl.Param.sInt[3] = NaviData.HomePositionDeviation.Bearing; // deg |
319 | break; |
- | |
320 | 320 | break; |
|
321 | default: |
321 | default: |
322 | break; |
322 | break; |
323 | } |
323 | } |