Rev 2345 | Rev 2354 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2345 | Rev 2349 | ||
---|---|---|---|
Line 136... | Line 136... | ||
136 | unsigned char Parameter_UserParam4 = 0; |
136 | unsigned char Parameter_UserParam4 = 0; |
137 | unsigned char Parameter_UserParam5 = 0; |
137 | unsigned char Parameter_UserParam5 = 0; |
138 | unsigned char Parameter_UserParam6 = 0; |
138 | unsigned char Parameter_UserParam6 = 0; |
139 | unsigned char Parameter_UserParam7 = 0; |
139 | unsigned char Parameter_UserParam7 = 0; |
140 | unsigned char Parameter_UserParam8 = 0; |
140 | unsigned char Parameter_UserParam8 = 0; |
- | 141 | unsigned char Parameter_NickControl = 100; |
|
141 | unsigned char Parameter_ServoNickControl = 100; |
142 | unsigned char Parameter_ServoNickControl = 100; |
142 | unsigned char Parameter_ServoRollControl = 100; |
143 | unsigned char Parameter_ServoRollControl = 100; |
143 | unsigned char Parameter_ServoNickComp = 50; |
144 | unsigned char Parameter_ServoNickComp = 50; |
144 | unsigned char Parameter_ServoRollComp = 85; |
145 | unsigned char Parameter_ServoRollComp = 85; |
145 | unsigned char Parameter_LoopGasLimit = 70; |
146 | unsigned char Parameter_LoopGasLimit = 70; |
Line 375... | Line 376... | ||
375 | for(i=0;i<8;i++) |
376 | for(i=0;i<8;i++) |
376 | { |
377 | { |
377 | Poti[i] = PPM_in[EE_Parameter.Kanalbelegung[K_POTI1 + i]] + 127; |
378 | Poti[i] = PPM_in[EE_Parameter.Kanalbelegung[K_POTI1 + i]] + 127; |
378 | } |
379 | } |
379 | SenderOkay = 100; |
380 | SenderOkay = 100; |
380 | if(ServoActive) |
- | |
381 | { |
381 | |
382 | DDRD |=0x80; // enable J7 -> Servo signal |
382 | if(ServoActive) DDRD |=0x80; // enable J7 -> Servo signal |
383 | } |
- | |
384 | else |
383 | else |
385 | { |
384 | { |
386 | // if(EE_Parameter.ServoCompInvert & SERVO_NICK_INV) NickServoValue = ((128 + 60) * 4 * 16); // neutral position = upper 1/4 |
385 | // if(EE_Parameter.ServoCompInvert & SERVO_NICK_INV) NickServoValue = ((128 + 60) * 4 * 16); // neutral position = upper 1/4// else |
387 | // else |
- | |
388 | NickServoValue = ((128 - 60) * 4 * 16); // neutral position = lower 1/4 |
386 | NickServoValue = ((128 - 60) * 4 * 16); // neutral position = lower 1/4 |
- | 387 | CalculateServoSignals = 1; |
|
- | 388 | CalculateServo(); // nick |
|
- | 389 | CalculateServo(); // roll |
|
389 | } |
390 | } |
Line 390... | Line 391... | ||
390 | 391 | ||
391 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
392 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
392 | signed int tilt1, tilt2; |
393 | signed int tilt1, tilt2; |
Line 638... | Line 639... | ||
638 | CHK_POTI_MM(Parameter_J16Timing,EE_Parameter.J16Timing,5,255); |
639 | CHK_POTI_MM(Parameter_J16Timing,EE_Parameter.J16Timing,5,255); |
639 | CHK_POTI_MM(Parameter_J17Timing,EE_Parameter.J17Timing,5,255); |
640 | CHK_POTI_MM(Parameter_J17Timing,EE_Parameter.J17Timing,5,255); |
Line 640... | Line 641... | ||
640 | 641 | ||
641 | if(EE_Parameter.Servo3 == 247) { if(PORTC & (1<<PORTC2)) Parameter_Servo3 = 140; else Parameter_Servo3 = 70;} // Out1 (J16) |
642 | if(EE_Parameter.Servo3 == 247) { if(PORTC & (1<<PORTC2)) Parameter_Servo3 = 140; else Parameter_Servo3 = 70;} // Out1 (J16) |
642 | else if(EE_Parameter.Servo3 == 246) { if(PORTC & (1<<PORTC3)) Parameter_Servo3 = 140; else Parameter_Servo3 = 70;} |
643 | else if(EE_Parameter.Servo3 == 246) { if(PORTC & (1<<PORTC3)) Parameter_Servo3 = 140; else Parameter_Servo3 = 70;} |
Line 643... | Line 644... | ||
643 | else CHK_POTI(Parameter_Servo3,EE_Parameter.Servo3); |
644 | else CHK_POTI_MM(Parameter_Servo3,EE_Parameter.Servo3, 24, 255); |
644 | 645 | ||
645 | if(EE_Parameter.Servo4 == 247) { if(PORTC & (1<<PORTC2)) Parameter_Servo4 = 140; else Parameter_Servo4 = 70;} |
646 | if(EE_Parameter.Servo4 == 247) { if(PORTC & (1<<PORTC2)) Parameter_Servo4 = 140; else Parameter_Servo4 = 70;} |
- | 647 | else if(EE_Parameter.Servo4 == 246) { if(PORTC & (1<<PORTC3)) Parameter_Servo4 = 140; else Parameter_Servo4 = 70;} // Out2 (J17) |
|
646 | else if(EE_Parameter.Servo4 == 246) { if(PORTC & (1<<PORTC3)) Parameter_Servo4 = 140; else Parameter_Servo4 = 70;} // Out2 (J17) |
648 | else CHK_POTI_MM(Parameter_Servo4,EE_Parameter.Servo4, 24, 255); |
647 | else CHK_POTI(Parameter_Servo4,EE_Parameter.Servo4); |
649 | |
648 | CHK_POTI(Parameter_Servo5,EE_Parameter.Servo5); |
650 | CHK_POTI_MM(Parameter_Servo5,EE_Parameter.Servo5, 24, 255); |
649 | Parameter_HoehenSchalter = GetChannelValue(EE_Parameter.HoeheChannel); |
651 | Parameter_HoehenSchalter = GetChannelValue(EE_Parameter.HoeheChannel); |
650 | CHK_POTI(Parameter_Hoehe_ACC_Wirkung,EE_Parameter.Hoehe_ACC_Wirkung); |
652 | CHK_POTI(Parameter_Hoehe_ACC_Wirkung,EE_Parameter.Hoehe_ACC_Wirkung); |
651 | CHK_POTI(Parameter_Hoehe_GPS_Z,EE_Parameter.Hoehe_GPS_Z); |
653 | CHK_POTI(Parameter_Hoehe_GPS_Z,EE_Parameter.Hoehe_GPS_Z); |
Line 937... | Line 939... | ||
937 | LIBFC_ReceiverInit(EE_Parameter.Receiver); |
939 | LIBFC_ReceiverInit(EE_Parameter.Receiver); |
938 | if((Parameter_GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung aktiviert? |
940 | if((Parameter_GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung aktiviert? |
939 | { |
941 | { |
940 | if((MessLuftdruck > 950) || (MessLuftdruck < 750)) SucheLuftruckOffset(); |
942 | if((MessLuftdruck > 950) || (MessLuftdruck < 750)) SucheLuftruckOffset(); |
941 | } |
943 | } |
942 | // ServoActive = 0; |
- | |
943 | CalibrationDone = SetNeutral(1); |
944 | CalibrationDone = SetNeutral(1); |
944 | ServoActive = 1; |
945 | ServoActive = 1; |
945 | DDRD |=0x80; // enable J7 -> Servo signal |
946 | DDRD |=0x80; // enable J7 -> Servo signal |
946 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
947 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
947 | if(VersionInfo.HardwareError[0]) SpeakHoTT = SPEAK_ERR_SENSOR; |
948 | if(VersionInfo.HardwareError[0]) SpeakHoTT = SPEAK_ERR_SENSOR; |
Line 1037... | Line 1038... | ||
1037 | { |
1038 | { |
1038 | // if((PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 75) && (PPM_in[EE_Parameter.MotorSafetySwitch] < -75 || EE_Parameter.MotorSafetySwitch == 0)) |
1039 | // if((PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 75) && (PPM_in[EE_Parameter.MotorSafetySwitch] < -75 || EE_Parameter.MotorSafetySwitch == 0)) |
1039 | if((((PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 100) && ((!(EE_Parameter.GlobalConfig3 & CFG3_MOTOR_SWITCH_MODE) && PPM_in[EE_Parameter.MotorSafetySwitch] < -75) || EE_Parameter.MotorSafetySwitch == 0))) |
1040 | if((((PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 100) && ((!(EE_Parameter.GlobalConfig3 & CFG3_MOTOR_SWITCH_MODE) && PPM_in[EE_Parameter.MotorSafetySwitch] < -75) || EE_Parameter.MotorSafetySwitch == 0))) |
1040 | || (((EE_Parameter.GlobalConfig3 & CFG3_MOTOR_SWITCH_MODE) && PPM_in[EE_Parameter.MotorSafetySwitch] < -50 && move_safety_switch == -100))) |
1041 | || (((EE_Parameter.GlobalConfig3 & CFG3_MOTOR_SWITCH_MODE) && PPM_in[EE_Parameter.MotorSafetySwitch] < -50 && move_safety_switch == -100))) |
1041 | { |
1042 | { |
1042 | if((PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > -100 || abs(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]) < 100) && EE_Parameter.MotorSafetySwitch == 0) |
1043 | if((PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > -100 || abs(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]) < 100) && EE_Parameter.MotorSafetySwitch == 0) |
1043 | { |
1044 | { |
1044 | delay_ausschalten = 0; |
1045 | delay_ausschalten = 0; |
1045 | } |
1046 | } |
1046 | else |
1047 | else |
1047 | { |
1048 | { |
1048 | SummeNick = 0; |
1049 | SummeNick = 0; |
1049 | SummeRoll = 0; |
1050 | SummeRoll = 0; |
1050 | StickNick = 0; |
1051 | StickNick = 0; |
1051 | StickRoll = 0; |
1052 | StickRoll = 0; |
1052 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
- | |
1053 | SpeakHoTT = SPEAK_MK_OFF; |
- | |
1054 | #endif |
1053 | } |
1055 | } |
- | |
1056 | if(++delay_ausschalten > 250) // nicht sofort |
1054 | if(++delay_ausschalten > 250) // nicht sofort |
1057 | { |
1055 | { |
1058 | MotorenEin = 0; |
1056 | MotorenEin = 0; |
1059 | delay_ausschalten = 0; |
1057 | delay_ausschalten = 0; |
1060 | modell_fliegt = 0; |
1058 | modell_fliegt = 0; |
1061 | FC_StatusFlags2 &= ~(FC_STATUS2_WAIT_FOR_TAKEOFF | FC_STATUS2_AUTO_STARTING | FC_STATUS2_AUTO_LANDING); |
1059 | FC_StatusFlags2 &= ~(FC_STATUS2_WAIT_FOR_TAKEOFF | FC_STATUS2_AUTO_STARTING | FC_STATUS2_AUTO_LANDING); |
- | 1060 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
|
- | 1061 | SpeakHoTT = SPEAK_MK_OFF; |
|
- | 1062 | #endif |
|
1062 | } |
1063 | } |
1063 | } |
1064 | } |
1064 | else delay_ausschalten = 0; |
1065 | else delay_ausschalten = 0; |
1065 | } |
1066 | } |
1066 | if(GasIsZeroCnt < 1000) GasIsZeroCnt++; |
1067 | if(GasIsZeroCnt < 1000) GasIsZeroCnt++; |