Subversion Repositories NaviCtrl

Rev

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

Rev 719 Rev 727
Line 82... Line 82...
82
#include "ssc.h"
82
#include "ssc.h"
83
#include "sdc.h"
83
#include "sdc.h"
84
#include "uart1.h"
84
#include "uart1.h"
85
#include "canbus.h"
85
#include "canbus.h"
86
#include "triggerlog.h"
86
#include "triggerlog.h"
-
 
87
#include "CamCtrl.h"
Line 87... Line 88...
87
 
88
 
88
 
89
 
89
#ifdef FOLLOW_ME
90
#ifdef FOLLOW_ME
Line 487... Line 488...
487
        running = 1;
488
        running = 1;
Line 488... Line 489...
488
 
489
 
489
        if(CountMilliseconds != old_ms)  // 1 ms
490
        if(CountMilliseconds != old_ms)  // 1 ms
490
        {
491
        {
-
 
492
                if(CanbusTimeOut >= 2) CanbusTimeOut--;
-
 
493
                if(CamCtrlTimeout)
-
 
494
                 {
-
 
495
                  if(--CamCtrlTimeout == 1) CamCtrlCharacter = '?';
-
 
496
                  else if(CamCtrlTimeout == 10000) CamCtrlTimeout = 0; // this is used during NC startup-Time phase
-
 
497
                 }
-
 
498
                else
-
 
499
                 {
-
 
500
                  if(TrigLogging.CountExternal) CamCtrlCharacter = TrigLogging.CountExternal % 10 + '0';
-
 
501
                  FromCamCtrl.CamStatus = 0;
491
                if(CanbusTimeOut >= 2) CanbusTimeOut--;
502
                 };
492
                old_ms = CountMilliseconds;
503
                old_ms = CountMilliseconds;
493
                Compass_Update();               // update compass communication
504
                Compass_Update();               // update compass communication
494
                Analog_Update();                // get new ADC values
505
                Analog_Update();                // get new ADC values
-
 
506
                CalcHeadFree();
495
                CalcHeadFree();
507
                if(CamCtrlTimeout > 1) CamCtrl_GetData(3);
496
                if(UART_VersionInfo.HWMajor >= 30) ProcessCanBus();
508
                if(UART_VersionInfo.HWMajor >= 30) ProcessCanBus();
497
                if(!CheckDelay(SPI0_Timeout)) TimeoutGPS_Process = 0;
509
                if(!CheckDelay(SPI0_Timeout)) TimeoutGPS_Process = 0;
498
                else if(CountMilliseconds - SPI0_Timeout > 30000000L) SPI0_Timeout = CountMilliseconds; // avoid too long overflows
510
                else if(CountMilliseconds - SPI0_Timeout > 30000000L) SPI0_Timeout = CountMilliseconds; // avoid too long overflows
499
                if(++TimeoutGPS_Process >= 25)
511
                if(++TimeoutGPS_Process >= 25)
Line 537... Line 549...
537
        // ---------------- Error Check Timing ----------------------------
549
        // ---------------- Error Check Timing ----------------------------
538
        if(CheckDelay(TimerCheckError) || (FC.StatusFlags & FC_STATUS_START && !(oldFcFlags & FC_STATUS_START))) // Timer or FY wants to start
550
        if(CheckDelay(TimerCheckError) || (FC.StatusFlags & FC_STATUS_START && !(oldFcFlags & FC_STATUS_START))) // Timer or FY wants to start
539
        {
551
        {
540
                if(CheckDelay(TimerCheckError))
552
                if(CheckDelay(TimerCheckError))
541
                {
553
                {
-
 
554
                        if(!(FC.StatusFlags & FC_STATUS_FLY)) // do not change the Bit during flight
-
 
555
                         {
542
                        if(!BLITZ_CONNECTED) BlitzSchuhConnected = 1; else BlitzSchuhConnected = 0;
556
                          if(!BLITZ_CONNECTED) BlitzSchuhConnected = 1;
-
 
557
                          else BlitzSchuhConnected = 0;
-
 
558
                         }
543
                        TimerCheckError = SetDelay(1000);
559
                        TimerCheckError = SetDelay(1000);
544
                        if(CompassValueErrorCount) CompassValueErrorCount--;
560
                        if(CompassValueErrorCount) CompassValueErrorCount--;
545
                        if(++count5sec == 5)
561
                        if(++count5sec == 5)
546
                        {
562
                        {
547
                                FreqGpsNavProcessed = CountGpsProcessedIn5Sec * 2; //400 = 40Hz
563
                                FreqGpsNavProcessed = CountGpsProcessedIn5Sec * 2; //400 = 40Hz
Line 628... Line 644...
628
        // initialize adc
644
        // initialize adc
629
        Analog_Init();
645
        Analog_Init();
630
        // initialize SPI0 to FC
646
        // initialize SPI0 to FC
631
        SPI0_Init();
647
        SPI0_Init();
632
        // initialize i2c busses (needs Timer 1)
648
        // initialize i2c busses (needs Timer 1)
-
 
649
        InitCamCtrl();
633
        I2CBus_Init(I2C0);
650
        I2CBus_Init(I2C0);
634
        I2CBus_Init(I2C1);
651
        I2CBus_Init(I2C1);
635
        // initialize fat16 partition on sd card (needs Timer 1)
652
        // initialize fat16 partition on sd card (needs Timer 1)
636
        Fat16_Init();
653
        Fat16_Init();
637
        // initialize NC params
654
        // initialize NC params