Rev 688 | Rev 699 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 688 | Rev 693 | ||
---|---|---|---|
Line 54... | Line 54... | ||
54 | // + Note: For information on license extensions (e.g. commercial use), please contact us at info(@)hisystems.de. |
54 | // + Note: For information on license extensions (e.g. commercial use), please contact us at info(@)hisystems.de. |
55 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
55 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
56 | //#define MCLK96MHZ |
56 | //#define MCLK96MHZ |
57 | const unsigned long _Main_Crystal = 25000; |
57 | const unsigned long _Main_Crystal = 25000; |
58 | //#include <stdio.h> |
58 | //#include <stdio.h> |
- | 59 | #include <string.h> |
|
59 | #include "91x_lib.h" |
60 | #include "91x_lib.h" |
60 | #include "led.h" |
61 | #include "led.h" |
61 | #include "uart0.h" |
62 | #include "uart0.h" |
62 | #include "uart1.h" |
63 | #include "uart1.h" |
63 | #include "uart2.h" |
64 | #include "uart2.h" |
Line 439... | Line 440... | ||
439 | FC.Error[4] = 0; |
440 | FC.Error[4] = 0; |
440 | ErrorGpsFixLost = 0; |
441 | ErrorGpsFixLost = 0; |
441 | ErrorCheck_BL_MinOfMaxPWM = BL_MinOfMaxPWM; |
442 | ErrorCheck_BL_MinOfMaxPWM = BL_MinOfMaxPWM; |
442 | } |
443 | } |
Line -... | Line 444... | ||
- | 444 | ||
- | 445 | unsigned char RAM_Checksum(unsigned char* pBuffer, u16 len) |
|
- | 446 | { |
|
- | 447 | u8 crc = 0xAA; |
|
- | 448 | u16 i; |
|
- | 449 | for(i=0; i<len; i++) crc += pBuffer[i]; |
|
- | 450 | return crc; |
|
Line 443... | Line 451... | ||
443 | 451 | } |
|
444 | 452 | ||
445 | 453 | ||
Line 474... | Line 482... | ||
474 | UART1_TransmitTxData(); // PC send answer |
482 | UART1_TransmitTxData(); // PC send answer |
475 | UART2_TransmitTxData(); // FC send answer |
483 | UART2_TransmitTxData(); // FC send answer |
Line 476... | Line 484... | ||
476 | 484 | ||
Line -... | Line 485... | ||
- | 485 | if(!(FC.StatusFlags & FC_STATUS_MOTOR_RUN)) TimeSinceMotorStart = 0; |
|
- | 486 | ||
- | 487 | if(HugeBlockFromFC.WhoAmI == 1) // contains eeprom-Data |
|
- | 488 | { |
|
- | 489 | u8 crc1, crc2; |
|
- | 490 | crc1 = HugeBlockFromFC.Data[sizeof(EE_Parameter)-1]; // contains the EE_Parameter.crc |
|
- | 491 | crc2 = RAM_Checksum((u8 *)(&HugeBlockFromFC.Data), sizeof(EE_Parameter)-1); // calculates the current crc |
|
- | 492 | if(crc1 == crc2) |
|
- | 493 | { |
|
- | 494 | memcpy(&EE_Parameter, (u8 *) HugeBlockFromFC.Data, sizeof(EE_Parameter)); |
|
- | 495 | RequestConfigFromFC = 0; |
|
- | 496 | } |
|
- | 497 | HugeBlockFromFC.WhoAmI = 0; |
|
477 | if(!(FC.StatusFlags & FC_STATUS_MOTOR_RUN)) TimeSinceMotorStart = 0; |
498 | } |
478 | 499 | ||
479 | if(FCCalibActive) |
500 | if(FCCalibActive) |
480 | { |
501 | { |
481 | count5sec = 0; |
502 | count5sec = 0; |