Rev 241 | Rev 244 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 241 | Rev 242 | ||
---|---|---|---|
Line 59... | Line 59... | ||
59 | #include "91x_lib.h" |
59 | #include "91x_lib.h" |
60 | #include "led.h" |
60 | #include "led.h" |
61 | #include "gps.h" |
61 | #include "gps.h" |
62 | #include "uart1.h" |
62 | #include "uart1.h" |
63 | #include "spi_slave.h" |
63 | #include "spi_slave.h" |
64 | #include "mk3mag.h" |
64 | #include "compass.h" |
65 | #include "timer1.h" |
65 | #include "timer1.h" |
66 | #include "timer2.h" |
66 | #include "timer2.h" |
67 | #include "config.h" |
67 | #include "config.h" |
68 | #include "main.h" |
68 | #include "main.h" |
69 | #include "fifo.h" |
69 | #include "fifo.h" |
- | 70 | #include "compass.h" |
|
Line 70... | Line 71... | ||
70 | 71 | ||
71 | 72 | ||
72 | #define SPI_RXSYNCBYTE1 0xAA |
73 | #define SPI_RXSYNCBYTE1 0xAA |
Line 280... | Line 281... | ||
280 | 281 | ||
281 | if (SPI_RxBuffer_Request) |
282 | if (SPI_RxBuffer_Request) |
282 | { |
283 | { |
283 | // avoid sending data via SPI during the update of the ToFlightCtrl structure |
284 | // avoid sending data via SPI during the update of the ToFlightCtrl structure |
284 | VIC_ITCmd(SSP0_ITLine, DISABLE); // disable SPI interrupt |
285 | VIC_ITCmd(SSP0_ITLine, DISABLE); // disable SPI interrupt |
285 | ToFlightCtrl.CompassHeading = MK3MAG_Heading.Heading; |
286 | ToFlightCtrl.CompassHeading = CompassHeading; |
286 | DebugOut.Analog[10] = ToFlightCtrl.CompassHeading; |
287 | DebugOut.Analog[10] = ToFlightCtrl.CompassHeading; |
287 | if(ToFlightCtrl.CompassHeading >= 0) ToFlightCtrl.CompassHeading = (360 + ToFlightCtrl.CompassHeading + FromFlightCtrl.GyroYaw / 12) % 360; |
288 | if(ToFlightCtrl.CompassHeading >= 0) ToFlightCtrl.CompassHeading = (360 + ToFlightCtrl.CompassHeading + FromFlightCtrl.GyroYaw / 12) % 360; |
288 | // cycle spi commands |
289 | // cycle spi commands |
289 | ToFlightCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++]; |
290 | ToFlightCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++]; |
Line 483... | Line 484... | ||
483 | { |
484 | { |
484 | u32 timeout; |
485 | u32 timeout; |
485 | u8 repeat; |
486 | u8 repeat; |
486 | u8 msg[64]; |
487 | u8 msg[64]; |
Line 487... | Line 488... | ||
487 | 488 | ||
488 | UART1_PutString("\r\n Getting Version from FC"); |
489 | UART1_PutString("\r\n Looking for FlightContol"); |
489 | FC_Version.Major = 0xFF; |
490 | FC_Version.Major = 0xFF; |
490 | FC_Version.Minor = 0xFF; |
491 | FC_Version.Minor = 0xFF; |
491 | FC_Version.Patch = 0xFF; |
492 | FC_Version.Patch = 0xFF; |
Line 505... | Line 506... | ||
505 | repeat++; |
506 | repeat++; |
506 | }while((FC_Version.Major == 0xFF) && (repeat < 40)); // 40*250ms = 10s |
507 | }while((FC_Version.Major == 0xFF) && (repeat < 40)); // 40*250ms = 10s |
507 | // if we got it |
508 | // if we got it |
508 | if (FC_Version.Major != 0xFF) |
509 | if (FC_Version.Major != 0xFF) |
509 | { |
510 | { |
510 | sprintf(msg, "\n\r FlightCtrl V%d.%d%c HW:%d.%d", FC_Version.Major, FC_Version.Minor, 'a'+FC_Version.Patch, FC_Version.Hardware/10,FC_Version.Hardware%10); |
511 | sprintf(msg, " FC V%d.%d%c HW:%d.%d", FC_Version.Major, FC_Version.Minor, 'a'+FC_Version.Patch, FC_Version.Hardware/10,FC_Version.Hardware%10); |
511 | UART1_PutString(msg); |
- | |
512 | sprintf(msg, " Compatible: %d", FC_Version.Compatible); |
- | |
513 | UART1_PutString(msg); |
512 | UART1_PutString(msg); |
514 | } |
513 | } |
515 | else UART1_PutString("\n\r No version information from FlightCtrl."); |
514 | else UART1_PutString("\n\r not found!"); |
516 | } |
515 | } |