Subversion Repositories NaviCtrl

Rev

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

Rev 532 Rev 533
Line 103... Line 103...
103
volatile u32 SD_WatchDog = 15000; // stop Logging if this goes to zero
103
volatile u32 SD_WatchDog = 15000; // stop Logging if this goes to zero
104
u32 CountGpsProcessedIn5Sec = 0,CountNewGpsDataIn5Sec = 0, FreqGpsProcessedIn5Sec = 0, FreqNewGpsDataIn5Sec = 0;
104
u32 CountGpsProcessedIn5Sec = 0,CountNewGpsDataIn5Sec = 0, FreqGpsProcessedIn5Sec = 0, FreqNewGpsDataIn5Sec = 0;
105
u8 NewWPL_Name = 0;
105
u8 NewWPL_Name = 0;
106
u32 MaxWP_Radius_in_m = 0;
106
u32 MaxWP_Radius_in_m = 0;
107
s8 ErrorMSG[25];
107
s8 ErrorMSG[25];
-
 
108
u32 TimeSinceMotorStart = 0;
Line 108... Line 109...
108
 
109
 
109
//----------------------------------------------------------------------------------------------------
110
//----------------------------------------------------------------------------------------------------
110
void SCU_Config(void)
111
void SCU_Config(void)
111
{
112
{
Line 335... Line 336...
335
                sprintf(ErrorMSG,"Magnet error    ");
336
                sprintf(ErrorMSG,"Magnet error    ");
336
                newErrorCode = 22;
337
                newErrorCode = 22;
337
                DebugOut.StatusRed |= AMPEL_COMPASS | AMPEL_NC;
338
                DebugOut.StatusRed |= AMPEL_COMPASS | AMPEL_NC;
338
                UART_VersionInfo.HardwareError[0] |= NC_ERROR0_COMPASS_VALUE;
339
                UART_VersionInfo.HardwareError[0] |= NC_ERROR0_COMPASS_VALUE;
339
        }
340
        }
340
        else if(((ErrorCheck_BL_MinOfMaxPWM == 40  || ErrorCheck_BL_MinOfMaxPWM == 39) && (FC.StatusFlags & FC_STATUS_FLY)) && !ErrorCode)
341
        else if(((ErrorCheck_BL_MinOfMaxPWM == 40 && (TimeSinceMotorStart > 3))  || (ErrorCheck_BL_MinOfMaxPWM == 39)) && !ErrorCode)
341
        {
342
        {
342
                LED_RED_ON;
343
                LED_RED_ON;
343
                sprintf(ErrorMSG,"ERR:Motor restart  ");
344
                sprintf(ErrorMSG,"ERR:Motor restart  ");
344
                newErrorCode = 23;
345
                newErrorCode = 23;
345
                DebugOut.StatusRed |= AMPEL_BL;
346
                DebugOut.StatusRed |= AMPEL_BL;
Line 351... Line 352...
351
                LED_RED_ON;
352
                LED_RED_ON;
352
                sprintf(ErrorMSG,"ERR:BL%2d Test:%2d ",i+1,BL_MinOfMaxPWM);
353
                sprintf(ErrorMSG,"ERR:BL%2d Test:%2d ",i+1,BL_MinOfMaxPWM);
353
                newErrorCode = 32;
354
                newErrorCode = 32;
354
                DebugOut.StatusRed |= AMPEL_BL;
355
                DebugOut.StatusRed |= AMPEL_BL;
355
        }
356
        }
356
        else if(ErrorCheck_BL_MinOfMaxPWM < 248 && (FC.StatusFlags & FC_STATUS_FLY) && !ErrorCode)
357
        else if(ErrorCheck_BL_MinOfMaxPWM < 248 && (TimeSinceMotorStart > 3) && !ErrorCode)
357
        {
358
        {
358
                LED_RED_ON;
359
                LED_RED_ON;
359
                sprintf(ErrorMSG,"ERR:BL Limitation   ");
360
                sprintf(ErrorMSG,"ERR:BL Limitation   ");
360
                newErrorCode = 24;
361
                newErrorCode = 24;
361
                DebugOut.StatusRed |= AMPEL_BL;
362
                DebugOut.StatusRed |= AMPEL_BL;
Line 444... Line 445...
444
        UART0_TransmitTxData(); // GPS send answer
445
        UART0_TransmitTxData(); // GPS send answer
445
        UART1_ProcessRxData();  // PC process request
446
        UART1_ProcessRxData();  // PC process request
446
        UART1_TransmitTxData(); // PC send answer
447
        UART1_TransmitTxData(); // PC send answer
447
        UART2_TransmitTxData(); // FC send answer
448
        UART2_TransmitTxData(); // FC send answer
Line -... Line 449...
-
 
449
 
-
 
450
        if(!(FC.StatusFlags & FC_STATUS_MOTOR_RUN)) TimeSinceMotorStart = 0;
448
 
451
 
449
        // ---------------- Error Check Timing ----------------------------
452
        // ---------------- Error Check Timing ----------------------------
450
        if(CheckDelay(TimerCheckError) || (FC.StatusFlags & FC_STATUS_START && !(oldFcFlags & FC_STATUS_START))) // Timer or FY wants to start
453
        if(CheckDelay(TimerCheckError) || (FC.StatusFlags & FC_STATUS_START && !(oldFcFlags & FC_STATUS_START))) // Timer or FY wants to start
451
        {
454
        {
452
                if(CheckDelay(TimerCheckError))
455
                if(CheckDelay(TimerCheckError))
Line 465... Line 468...
465
                oldFcFlags = FC.StatusFlags;
468
                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
469
                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 470...
467
 
470
 
Line -... Line 471...
-
 
471
                if(!CheckDelay(SPI0_Timeout) || (DebugUART == UART1)) CheckErrors();
-
 
472
 
468
                if(!CheckDelay(SPI0_Timeout) || (DebugUART == UART1)) CheckErrors();
473
                if(FC.StatusFlags & FC_STATUS_FLY)
-
 
474
                 {
-
 
475
                  NaviData.FlyingTime++; // we want to count the battery-time
-
 
476
                  TimeSinceMotorStart++;
469
 
477
                 }
470
                if(FC.StatusFlags & FC_STATUS_FLY) NaviData.FlyingTime++; // we want to count the battery-time
478
               
471
                if(SerialLinkOkay) SerialLinkOkay--;
479
                if(SerialLinkOkay) SerialLinkOkay--;
472
                if(SerialLinkOkay < 250 - 5) NCFlags |= NC_FLAG_NOSERIALLINK; // 5 seconds timeout for serial communication
480
                if(SerialLinkOkay < 250 - 5) NCFlags |= NC_FLAG_NOSERIALLINK; // 5 seconds timeout for serial communication
473
                else NCFlags &= ~NC_FLAG_NOSERIALLINK;
481
                else NCFlags &= ~NC_FLAG_NOSERIALLINK;