Rev 471 | Rev 475 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 471 | Rev 473 | ||
---|---|---|---|
Line 68... | Line 68... | ||
68 | #include "main.h" |
68 | #include "main.h" |
69 | #include "compass.h" |
69 | #include "compass.h" |
70 | #include "params.h" |
70 | #include "params.h" |
71 | #include "stdlib.h" |
71 | #include "stdlib.h" |
72 | #include "settings.h" |
72 | #include "settings.h" |
- | 73 | #include "ncmag.h" |
|
Line 73... | Line 74... | ||
73 | 74 | ||
74 | #define SPI_RXSYNCBYTE1 0xAA |
75 | #define SPI_RXSYNCBYTE1 0xAA |
75 | #define SPI_RXSYNCBYTE2 0x83 |
76 | #define SPI_RXSYNCBYTE2 0x83 |
76 | #define SPI_TXSYNCBYTE1 0x81 |
77 | #define SPI_TXSYNCBYTE1 0x81 |
Line 583... | Line 584... | ||
583 | FCCalibActive = 10; |
584 | FCCalibActive = 10; |
584 | FC_is_Calibrated = 0; |
585 | FC_is_Calibrated = 0; |
585 | } |
586 | } |
586 | else |
587 | else |
587 | { |
588 | { |
- | 589 | if(FCCalibActive) |
|
- | 590 | { |
|
- | 591 | if(--FCCalibActive == 0) |
|
- | 592 | { |
|
- | 593 | FC_is_Calibrated = 1; |
|
- | 594 | ExtCompassOrientation = GetExtCompassOrientation(); |
|
588 | if(FCCalibActive) if(--FCCalibActive == 0) FC_is_Calibrated = 1; |
595 | if(ExtCompassOrientation != Calibration.Version / 16) NCMAG_IsCalibrated = 0; |
- | 596 | } |
|
- | 597 | } |
|
589 | } |
598 | } |
590 | if(FC.StatusFlags & FC_STATUS_START) |
599 | if(FC.StatusFlags & FC_STATUS_START) |
591 | { |
600 | { |
592 | if(Compass_Heading != -1) HeadFreeStartAngle = (3600 + Compass_Heading * 10 - GeoMagDec) % 3600; else |
601 | if(Compass_Heading != -1) HeadFreeStartAngle = (3600 + Compass_Heading * 10 - GeoMagDec) % 3600; else |
593 | HeadFreeStartAngle = GyroCompassCorrected; |
602 | HeadFreeStartAngle = GyroCompassCorrected; |
Line 795... | Line 804... | ||
795 | SPI0_UpdateBuffer(); |
804 | SPI0_UpdateBuffer(); |
796 | if (FC_Version.Major != 0xFF) break; |
805 | if (FC_Version.Major != 0xFF) break; |
797 | }while (!CheckDelay(timeout)); |
806 | }while (!CheckDelay(timeout)); |
798 | UART1_PutString("."); |
807 | UART1_PutString("."); |
799 | repeat++; |
808 | repeat++; |
800 | FCCalibActive = 1; |
809 | // FCCalibActive = 1; |
801 | }while((FC_Version.Major == 0xFF) && (repeat < 40)); // 40*250ms = 10s |
810 | }while((FC_Version.Major == 0xFF) && (repeat < 40)); // 40*250ms = 10s |
802 | // if we got it |
811 | // if we got it |
803 | if (FC_Version.Major != 0xFF) |
812 | if (FC_Version.Major != 0xFF) |
804 | { |
813 | { |
805 | 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); |
814 | 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); |