Rev 2416 | Rev 2425 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2416 | Rev 2418 | ||
---|---|---|---|
Line 570... | Line 570... | ||
570 | 570 | ||
Line 571... | Line 571... | ||
571 | default: // any Slave Address |
571 | default: // any Slave Address |
572 | 572 | ||
- | 573 | switch(RxdBuffer[2]) |
|
- | 574 | { |
|
- | 575 | static unsigned int clear_I; |
|
- | 576 | case '?':// Serielle Antwort eines BL-Reglers |
|
- | 577 | tempchar1 = RxdBuffer[1] - ('a'+11); |
|
- | 578 | if(tempchar1 >= MAX_MOTORS) break; |
|
- | 579 | memcpy((unsigned char *)&RedundantMotor[tempchar1], (unsigned char *)pRxData, sizeof(RedundantBl_t)); |
|
- | 580 | if(RedundantMotor[tempchar1].BitSate & BL_BIT_STATE_I2C_OK && clear_I) clear_I--; |
|
- | 581 | ||
- | 582 | if(RedundantMotor[tempchar1].BitSate & BL_BIT_STATE_I2C_BAD) |
|
- | 583 | { |
|
- | 584 | if(clear_I == 0) |
|
- | 585 | { |
|
- | 586 | PORTB |= 0x02; |
|
- | 587 | SummeNick = 0; |
|
- | 588 | SummeRoll = 0; |
|
- | 589 | Mess_Integral_Gier = 0; |
|
- | 590 | } |
|
- | 591 | clear_I = 500; |
|
- | 592 | } |
|
- | 593 | else PORTB &=~0x02; |
|
- | 594 | //DebugOut.Analog[16] = RedundantMotor[tempchar1].BitSate; |
|
- | 595 | //DebugOut.Analog[17]++; |
|
573 | switch(RxdBuffer[2]) |
596 | //DebugOut.Analog[18] = tempchar1; |
574 | { |
597 | break; |
575 | // 't' comand placed here only for compatibility to BL |
598 | // 't' comand placed here only for compatibility to BL |
576 | case 't':// Motortest |
599 | case 't':// Motortest |
577 | if(AnzahlEmpfangsBytes >= sizeof(MotorTest)) memcpy(&MotorTest[0], (unsigned char *)pRxData, sizeof(MotorTest)); |
600 | if(AnzahlEmpfangsBytes >= sizeof(MotorTest)) memcpy(&MotorTest[0], (unsigned char *)pRxData, sizeof(MotorTest)); |
Line 697... | Line 720... | ||
697 | } |
720 | } |
Line 698... | Line 721... | ||
698 | 721 | ||
699 | //--------------------------------------------------------------------------------------------- |
722 | //--------------------------------------------------------------------------------------------- |
700 | void DatenUebertragung(void) |
723 | void DatenUebertragung(void) |
- | 724 | { |
|
701 | { |
725 | |
Line 702... | Line 726... | ||
702 | if(!UebertragungAbgeschlossen) return; |
726 | if(!UebertragungAbgeschlossen) return; |
703 | 727 | ||
704 | if(CheckDelay(AboTimeOut)) |
728 | if(CheckDelay(AboTimeOut)) |
Line 775... | Line 799... | ||
775 | if(GetPPMChannelAnforderung && UebertragungAbgeschlossen) |
799 | if(GetPPMChannelAnforderung && UebertragungAbgeschlossen) |
776 | { |
800 | { |
777 | SendOutData('P', FC_ADDRESS, 1, (unsigned char *) &PPM_in, sizeof(PPM_in)); |
801 | SendOutData('P', FC_ADDRESS, 1, (unsigned char *) &PPM_in, sizeof(PPM_in)); |
778 | GetPPMChannelAnforderung = 0; |
802 | GetPPMChannelAnforderung = 0; |
779 | } |
803 | } |
- | 804 | #ifndef REDUNDANT_FC |
|
780 | if((CheckDelay(Kompass_Timer)) && UebertragungAbgeschlossen) |
805 | if((CheckDelay(Kompass_Timer)) && UebertragungAbgeschlossen) |
781 | { |
806 | { |
782 | WinkelOut.Winkel[0] = ToNaviCtrl.IntegralNick;//(int) (IntegralNick / (EE_Parameter.GyroAccFaktor * 4)); // etwa in 0.1 Grad |
807 | WinkelOut.Winkel[0] = ToNaviCtrl.IntegralNick;//(int) (IntegralNick / (EE_Parameter.GyroAccFaktor * 4)); // etwa in 0.1 Grad |
783 | WinkelOut.Winkel[1] = ToNaviCtrl.IntegralRoll;//(int) (IntegralRoll / (EE_Parameter.GyroAccFaktor * 4)); // etwa in 0.1 Grad |
808 | WinkelOut.Winkel[1] = ToNaviCtrl.IntegralRoll;//(int) (IntegralRoll / (EE_Parameter.GyroAccFaktor * 4)); // etwa in 0.1 Grad |
784 | WinkelOut.UserParameter[0] = Parameter_UserParam1; |
809 | WinkelOut.UserParameter[0] = Parameter_UserParam1; |
Line 786... | Line 811... | ||
786 | SendOutData('k', MK3MAG_ADDRESS, 1, (unsigned char *) &WinkelOut,sizeof(WinkelOut)); |
811 | SendOutData('k', MK3MAG_ADDRESS, 1, (unsigned char *) &WinkelOut,sizeof(WinkelOut)); |
787 | if(WinkelOut.CalcState > 4) WinkelOut.CalcState = 6; // wird dann in SPI auf Null gesetzt |
812 | if(WinkelOut.CalcState > 4) WinkelOut.CalcState = 6; // wird dann in SPI auf Null gesetzt |
788 | if(JustMK3MagConnected) Kompass_Timer = SetDelay(99); |
813 | if(JustMK3MagConnected) Kompass_Timer = SetDelay(99); |
789 | else Kompass_Timer = SetDelay(999); |
814 | else Kompass_Timer = SetDelay(999); |
790 | } |
815 | } |
- | 816 | #endif |
|
- | 817 | ||
- | 818 | #ifdef REDUNDANT_FC |
|
- | 819 | if(UebertragungAbgeschlossen || MotorenEin) |
|
- | 820 | { |
|
- | 821 | static unsigned char who; |
|
- | 822 | unsigned char SendRedundantMotor[MAX_MOTORS], i; |
|
- | 823 | who = (who+1) % RequiredMotors; |
|
- | 824 | for(i=0; i<RequiredMotors; i++) |
|
- | 825 | { |
|
- | 826 | SendRedundantMotor[0] = who+1; |
|
- | 827 | if(PC_MotortestActive) SendRedundantMotor[0] |= 0x80; |
|
- | 828 | SendRedundantMotor[i+1] = Motor[i].SetPoint; |
|
- | 829 | } |
|
- | 830 | SendOutData('!', FC_ADDRESS, 1, (unsigned char *) &SendRedundantMotor, RequiredMotors+1); |
|
- | 831 | } |
|
- | 832 | #endif |
|
- | 833 | ||
791 | #ifdef DEBUG // only include functions if DEBUG is defined |
834 | #ifdef DEBUG // only include functions if DEBUG is defined |
792 | if(SendDebugOutput && UebertragungAbgeschlossen) |
835 | if(SendDebugOutput && UebertragungAbgeschlossen) |
793 | { |
836 | { |
794 | SendOutData('0', FC_ADDRESS, 1, (unsigned char *) &tDebug, sizeof(tDebug)); |
837 | SendOutData('0', FC_ADDRESS, 1, (unsigned char *) &tDebug, sizeof(tDebug)); |
795 | SendDebugOutput = 0; |
838 | SendDebugOutput = 0; |