Rev 699 | Rev 715 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 699 | Rev 706 | ||
---|---|---|---|
Line 81... | Line 81... | ||
81 | #include "eeprom.h" |
81 | #include "eeprom.h" |
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" |
|
Line 86... | Line 87... | ||
86 | 87 | ||
87 | 88 | ||
88 | #ifdef FOLLOW_ME |
89 | #ifdef FOLLOW_ME |
Line 159... | Line 160... | ||
159 | else DebugOut.StatusRed &= ~AMPEL_BL; // BL-Ctrl green status |
160 | else DebugOut.StatusRed &= ~AMPEL_BL; // BL-Ctrl green status |
Line 160... | Line 161... | ||
160 | 161 | ||
161 | if(UART_VersionInfo.HardwareError[0] || UART_VersionInfo.HardwareError[1]) DebugOut.StatusRed |= AMPEL_NC; |
162 | if(UART_VersionInfo.HardwareError[0] || UART_VersionInfo.HardwareError[1]) DebugOut.StatusRed |= AMPEL_NC; |
Line 162... | Line -... | ||
162 | else DebugOut.StatusRed &= ~AMPEL_NC; |
- | |
163 | 163 | else DebugOut.StatusRed &= ~AMPEL_NC; |
|
164 | 164 | ||
165 | if(CheckDelay(I2CBus(Compass_I2CPort)->Timeout)) |
165 | if(CheckDelay(I2CBus(Compass_I2CPort)->Timeout)) |
166 | { |
166 | { |
167 | LED_RED_ON; |
167 | LED_RED_ON; |
Line 286... | Line 286... | ||
286 | sprintf(ErrorMSG,"no GPS communication"); |
286 | sprintf(ErrorMSG,"no GPS communication"); |
287 | UART_VersionInfo.HardwareError[0] |= NC_ERROR0_GPS_RX; |
287 | UART_VersionInfo.HardwareError[0] |= NC_ERROR0_GPS_RX; |
288 | UART_VersionInfo.Flags &= ~NC_VERSION_FLAG_GPS_PRESENT; |
288 | UART_VersionInfo.Flags &= ~NC_VERSION_FLAG_GPS_PRESENT; |
289 | newErrorCode = 5; |
289 | newErrorCode = 5; |
290 | StopNavigation = 1; |
290 | StopNavigation = 1; |
291 | //UBX_Setup(); |
- | |
292 | //UBX_Timeout = SetDelay(500); |
- | |
293 | } |
291 | } |
294 | else if(Compass_Heading < 0 && NCMAG_Present && !NCMAG_IsCalibrated) |
292 | else if(Compass_Heading < 0 && NCMAG_Present && !NCMAG_IsCalibrated) |
295 | { |
293 | { |
296 | LED_RED_ON; |
294 | LED_RED_ON; |
297 | sprintf(ErrorMSG,"compass not calibr."); |
295 | sprintf(ErrorMSG,"compass not calibr."); |
Line 318... | Line 316... | ||
318 | { |
316 | { |
319 | LED_RED_ON; |
317 | LED_RED_ON; |
320 | sprintf(ErrorMSG,"FC: Carefree Error"); |
318 | sprintf(ErrorMSG,"FC: Carefree Error"); |
321 | newErrorCode = 20; |
319 | newErrorCode = 20; |
322 | } |
320 | } |
- | 321 | else if(FC.BAT_Voltage < 45) |
|
- | 322 | { |
|
- | 323 | LED_RED_ON; |
|
- | 324 | sprintf(ErrorMSG,"ERR:Power Supply"); |
|
- | 325 | newErrorCode = 41; |
|
- | 326 | } |
|
- | 327 | else |
|
- | 328 | if(FC.Error[1] & FC_ERROR1_RC_VOLTAGE) |
|
- | 329 | { |
|
- | 330 | LED_RED_ON; |
|
- | 331 | sprintf(ErrorMSG,"ERR: 5V RC-Supply"); |
|
- | 332 | newErrorCode = 40; |
|
- | 333 | } |
|
323 | else if(FC.Error[1] & FC_ERROR1_PPM) |
334 | else if(FC.Error[1] & FC_ERROR1_PPM) |
324 | { |
335 | { |
325 | LED_RED_ON; |
336 | LED_RED_ON; |
326 | sprintf(ErrorMSG,"RC Signal lost "); |
337 | sprintf(ErrorMSG,"RC Signal lost "); |
327 | newErrorCode = 7; |
338 | newErrorCode = 7; |
Line 422... | Line 433... | ||
422 | else if(CanbusTimeOut == 1) |
433 | else if(CanbusTimeOut == 1) |
423 | { |
434 | { |
424 | sprintf(ErrorMSG,"ERR: Canbus"); |
435 | sprintf(ErrorMSG,"ERR: Canbus"); |
425 | newErrorCode = 39; |
436 | newErrorCode = 39; |
426 | } |
437 | } |
- | 438 | else |
|
- | 439 | if(FC.Error[1] & FC_ERROR1_ACC_NOT_CAL) |
|
- | 440 | { |
|
- | 441 | LED_RED_ON; |
|
- | 442 | sprintf(ErrorMSG,"ACC not calib."); |
|
- | 443 | newErrorCode = 42; |
|
- | 444 | } |
|
427 | else // no error occured |
445 | else // no error occured |
428 | { |
446 | { |
429 | StopNavigation = 0; |
447 | StopNavigation = 0; |
430 | LED_RED_OFF; |
448 | LED_RED_OFF; |
431 | if(no_error_delay) { no_error_delay--; } |
449 | if(no_error_delay) { no_error_delay--; } |
Line 518... | Line 536... | ||
518 | // ---------------- Error Check Timing ---------------------------- |
536 | // ---------------- Error Check Timing ---------------------------- |
519 | if(CheckDelay(TimerCheckError) || (FC.StatusFlags & FC_STATUS_START && !(oldFcFlags & FC_STATUS_START))) // Timer or FY wants to start |
537 | if(CheckDelay(TimerCheckError) || (FC.StatusFlags & FC_STATUS_START && !(oldFcFlags & FC_STATUS_START))) // Timer or FY wants to start |
520 | { |
538 | { |
521 | if(CheckDelay(TimerCheckError)) |
539 | if(CheckDelay(TimerCheckError)) |
522 | { |
540 | { |
- | 541 | if(!BLITZ_CONNECTED) BlitzSchuhConnected = 1; else BlitzSchuhConnected = 0; |
|
523 | TimerCheckError = SetDelay(1000); |
542 | TimerCheckError = SetDelay(1000); |
524 | if(CompassValueErrorCount) CompassValueErrorCount--; |
543 | if(CompassValueErrorCount) CompassValueErrorCount--; |
525 | if(++count5sec == 5) |
544 | if(++count5sec == 5) |
526 | { |
545 | { |
527 | FreqGpsNavProcessed = CountGpsProcessedIn5Sec * 2; //400 = 40Hz |
546 | FreqGpsNavProcessed = CountGpsProcessedIn5Sec * 2; //400 = 40Hz |
Line 619... | Line 638... | ||
619 | // initialize the settings |
638 | // initialize the settings |
620 | Settings_Init(); |
639 | Settings_Init(); |
621 | // initialize logging (needs settings) |
640 | // initialize logging (needs settings) |
622 | Logging_Init(); |
641 | Logging_Init(); |
Line 623... | Line -... | ||
623 | - | ||
624 | if(UART_VersionInfo.HWMajor < 30) IamMaster = SLAVE; else IamMaster = MASTER; |
- | |
625 | 642 | ||
626 | //UART_VersionInfo.HWMajor = 30; |
643 | //UART_VersionInfo.HWMajor = 30; |
627 | LED_GRN_ON; |
644 | LED_GRN_ON; |
628 | TimerCheckError = SetDelay(3000); |
645 | TimerCheckError = SetDelay(3000); |
629 | UART1_PutString("\r\n++++++++++++++++++++++++++++++++++++++++++"); |
646 | UART1_PutString("\r\n++++++++++++++++++++++++++++++++++++++++++"); |
Line 634... | Line 651... | ||
634 | DebugOut.StatusRed = 0x00; |
651 | DebugOut.StatusRed = 0x00; |
635 | UART1_PutString("\r\n++++++++++++++++++++++++++++++++++++++++++"); |
652 | UART1_PutString("\r\n++++++++++++++++++++++++++++++++++++++++++"); |
Line 636... | Line 653... | ||
636 | 653 | ||
Line 637... | Line -... | ||
637 | Compass_Init(); |
- | |
638 | - | ||
639 | UBX_Setup(); // inits the GPS-Module via ubx |
- | |
640 | GPS_Init(); |
654 | Compass_Init(); |
641 | 655 | ||
642 | #ifdef FOLLOW_ME |
656 | #ifdef FOLLOW_ME |
643 | TransmitAlsoToFC = 1; |
657 | TransmitAlsoToFC = 1; |
644 | UART1_PutString("\r\n++++++++++++++++++++++++++++++++++++++++++"); |
658 | UART1_PutString("\r\n++++++++++++++++++++++++++++++++++++++++++"); |
Line 651... | Line 665... | ||
651 | { |
665 | { |
652 | UART1_PutString("\n\r Flight-Ctrl not compatible\n\r"); |
666 | UART1_PutString("\n\r Flight-Ctrl not compatible\n\r"); |
653 | LED_RED_ON; |
667 | LED_RED_ON; |
654 | } |
668 | } |
655 | #endif |
669 | #endif |
- | 670 | if(IamMaster == SLAVE) UART1_PutString(" SLAVE\r\n"); |
|
- | 671 | if(IamMaster == MASTER) UART1_PutString(" MASTER\r\n"); |
|
Line -... | Line 672... | ||
- | 672 | ||
- | 673 | UBX_Setup(); // inits the GPS-Module via ubx |
|
656 | 674 | GPS_Init(); |
|
657 | // ---------- Prepare the isr driven |
675 | // ---------- Prepare the isr driven |
658 | // set to absolute lowest priority |
676 | // set to absolute lowest priority |
659 | VIC_Config(EXTIT3_ITLine, VIC_IRQ, PRIORITY_SW); |
677 | VIC_Config(EXTIT3_ITLine, VIC_IRQ, PRIORITY_SW); |
660 | // enable interrupts |
678 | // enable interrupts |