Rev 438 | Rev 454 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 438 | Rev 453 | ||
---|---|---|---|
Line 100... | Line 100... | ||
100 | volatile u32 PollingTimeout = 10000; |
100 | volatile u32 PollingTimeout = 10000; |
101 | Param_t Parameter; |
101 | Param_t Parameter; |
102 | volatile FC_t FC; |
102 | volatile FC_t FC; |
103 | volatile u32 SPIWatchDog = 15000; // stop Navigation if this goes to zero |
103 | volatile u32 SPIWatchDog = 15000; // stop Navigation if this goes to zero |
104 | volatile u32 SD_WatchDog = 15000; // stop Logging if this goes to zero |
104 | volatile u32 SD_WatchDog = 15000; // stop Logging if this goes to zero |
- | 105 | u32 CountGpsProcessedFromStart = 0,CountNewGpsDataFromStart = 0, FreqGpsProcessedFromStart = 0, FreqNewGpsDataFromStart = 0; |
|
Line 105... | Line 106... | ||
105 | 106 | ||
Line 106... | Line 107... | ||
106 | s8 ErrorMSG[25]; |
107 | s8 ErrorMSG[25]; |
107 | 108 | ||
Line 402... | Line 403... | ||
402 | 403 | ||
403 | 404 | ||
404 | 405 | ||
405 | void Polling(void) |
406 | void Polling(void) |
406 | { |
407 | { |
407 | static u8 running = 0, oldFcFlags = 0; |
408 | static u8 running = 0, oldFcFlags = 0, count5sec; |
408 | if(running) return; |
409 | if(running) return; |
409 | running = 1; |
410 | running = 1; |
Line 415... | Line 416... | ||
415 | UART2_TransmitTxData(); // FC send answer |
416 | UART2_TransmitTxData(); // FC send answer |
416 | CalcHeadFree(); |
417 | CalcHeadFree(); |
417 | // ---------------- Error Check Timing ---------------------------- |
418 | // ---------------- Error Check Timing ---------------------------- |
418 | if(CheckDelay(TimerCheckError) || (FC.StatusFlags & FC_STATUS_START && !(oldFcFlags & FC_STATUS_START))) // Timer or FY wants to start |
419 | if(CheckDelay(TimerCheckError) || (FC.StatusFlags & FC_STATUS_START && !(oldFcFlags & FC_STATUS_START))) // Timer or FY wants to start |
419 | { |
420 | { |
- | 421 | if(CheckDelay(TimerCheckError)) |
|
- | 422 | { |
|
420 | TimerCheckError = SetDelay(1000); |
423 | TimerCheckError = SetDelay(1000); |
- | 424 | if(++count5sec == 5) |
|
- | 425 | { |
|
- | 426 | count5sec = 0; |
|
- | 427 | FreqGpsProcessedFromStart = CountGpsProcessedFromStart * 2; |
|
- | 428 | FreqNewGpsDataFromStart = CountNewGpsDataFromStart * 2; |
|
- | 429 | CountGpsProcessedFromStart = 0; |
|
- | 430 | CountNewGpsDataFromStart = 0; |
|
- | 431 | } |
|
- | 432 | } |
|
421 | oldFcFlags = FC.StatusFlags; |
433 | oldFcFlags = FC.StatusFlags; |
422 | if(CheckDelay(SPI0_Timeout) && (DebugUART == UART1)) GPS_Navigation(&GPSData, &(ToFlightCtrl.GPSStick)); // process the GPS data even if the FC is not connected |
434 | if(CheckDelay(SPI0_Timeout) && (DebugUART == UART1)) GPS_Navigation(&GPSData, &(ToFlightCtrl.GPSStick)); // process the GPS data even if the FC is not connected |
Line 423... | Line 435... | ||
423 | 435 |