Subversion Repositories NaviCtrl

Rev

Rev 548 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 548 Rev 564
Line 421... Line 421...
421
 
421
 
422
 
422
 
423
 
423
 
424
u8 Polling(void)
424
u8 Polling(void)
Line 425... Line 425...
425
{
425
{
426
        static u8 running = 0, oldFcFlags = 0, count5sec;
426
        static u8 running = 0, oldFcFlags = 0, count5sec, TimeoutGPS_Process;
Line 433... Line 433...
433
        {
433
        {
434
                old_ms = CountMilliseconds;
434
                old_ms = CountMilliseconds;
435
                Compass_Update();               // update compass communication
435
                Compass_Update();               // update compass communication
436
                Analog_Update();                // get new ADC values
436
                Analog_Update();                // get new ADC values
437
                CalcHeadFree();
437
                CalcHeadFree();
-
 
438
                if(!CheckDelay(SPI0_Timeout)) TimeoutGPS_Process = 0;
-
 
439
                else if(CountMilliseconds - SPI0_Timeout > 30000000L) SPI0_Timeout = CountMilliseconds; // avoid too long overflows
-
 
440
                if(++TimeoutGPS_Process >= 25)
-
 
441
                 {
-
 
442
                  GPS_Navigation(&GPSData, &(ToFlightCtrl.GPSStick)); // process the GPS data even if the FC is not connected
-
 
443
                  TimeoutGPS_Process = 0;
-
 
444
                 }
438
        }
445
        }
Line 439... Line 446...
439
 
446
 
440
        SPI0_UpdateBuffer();    // also calls the GPS-functions
447
        SPI0_UpdateBuffer();    // also calls the GPS-functions
441
        UART0_ProcessRxData();  // GPS process request
448
        UART0_ProcessRxData();  // GPS process request
Line 461... Line 468...
461
                                CountGpsProcessedIn5Sec = 0;
468
                                CountGpsProcessedIn5Sec = 0;
462
                                CountNewGpsDataIn5Sec = 0;
469
                                CountNewGpsDataIn5Sec = 0;
463
                        }
470
                        }
464
                }
471
                }
465
                oldFcFlags = FC.StatusFlags;
472
                oldFcFlags = FC.StatusFlags;
466
                if(CheckDelay(SPI0_Timeout) && (DebugUART == UART1)) GPS_Navigation(&GPSData, &(ToFlightCtrl.GPSStick)); // process the GPS data even if the FC is not connected
473
//              if(CheckDelay(SPI0_Timeout) && (DebugUART == UART1)) GPS_Navigation(&GPSData, &(ToFlightCtrl.GPSStick)); // process the GPS data even if the FC is not connected
Line 467... Line 474...
467
 
474
 
Line 468... Line 475...
468
                if(!CheckDelay(SPI0_Timeout) || (DebugUART == UART1)) CheckErrors();
475
                if(!CheckDelay(SPI0_Timeout) || (DebugUART == UART1)) CheckErrors();
469
 
476