Rev 2537 | Rev 2541 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2537 | Rev 2538 | ||
---|---|---|---|
Line 291... | Line 291... | ||
291 | //############################################################################ |
291 | //############################################################################ |
292 | // Nullwerte ermitteln |
292 | // Nullwerte ermitteln |
293 | // Parameter: 0 -> after switch on (ignore ACC-Z fault) |
293 | // Parameter: 0 -> after switch on (ignore ACC-Z fault) |
294 | // Parameter: 1 -> before Start |
294 | // Parameter: 1 -> before Start |
295 | // Parameter: 2 -> calibrate and store ACC |
295 | // Parameter: 2 -> calibrate and store ACC |
296 | // Parameter: 3 -> use stored Gyro calibration Data from EEPROM |
296 | // Parameter: 3 -> use stored Gyro calibration Data from EEPROM (Boat-Mode) |
297 | unsigned char SetNeutral(unsigned char AdjustmentMode) // retuns: "sucess" |
297 | unsigned char SetNeutral(unsigned char AdjustmentMode) // retuns: "sucess" |
298 | //############################################################################ |
298 | //############################################################################ |
299 | { |
299 | { |
300 | unsigned char i, sucess = 1; |
300 | unsigned char i, sucess = 1; |
301 | unsigned int gier_neutral = 0, nick_neutral = 0, roll_neutral = 0, acc_z_neutral = 0, barotest; |
301 | unsigned int gier_neutral = 0, nick_neutral = 0, roll_neutral = 0, acc_z_neutral = 0, barotest; |
Line 842... | Line 842... | ||
842 | //############################################################################ |
842 | //############################################################################ |
843 | { |
843 | { |
844 | int pd_ergebnis_nick,pd_ergebnis_roll,tmp_int, tmp_int2; |
844 | int pd_ergebnis_nick,pd_ergebnis_roll,tmp_int, tmp_int2; |
845 | int GierMischanteil,GasMischanteil; |
845 | int GierMischanteil,GasMischanteil; |
846 | static long sollGier = 0,tmp_long,tmp_long2; |
846 | static long sollGier = 0,tmp_long,tmp_long2; |
847 | static unsigned int RcLostTimer; |
847 | static unsigned int RcLostTimer, delay_Acc_neutral; |
848 | static unsigned char delay_neutral = 0; |
848 | static unsigned char delay_neutral = 0; |
849 | static unsigned char delay_einschalten = 0,delay_ausschalten = 0; |
849 | static unsigned char delay_einschalten = 0,delay_ausschalten = 0; |
850 | static signed char move_safety_switch = 0; |
850 | static signed char move_safety_switch = 0; |
851 | int IntegralNickMalFaktor,IntegralRollMalFaktor; |
851 | int IntegralNickMalFaktor,IntegralRollMalFaktor; |
852 | unsigned char i; |
852 | unsigned char i; |
Line 1016... | Line 1016... | ||
1016 | if((ChannelGas > 80) && MotorenEin == 0 && !(NC_To_FC_Flags & NC_TO_FC_SIMULATION_ACTIVE)) |
1016 | if((ChannelGas > 80) && MotorenEin == 0 && !(NC_To_FC_Flags & NC_TO_FC_SIMULATION_ACTIVE)) |
1017 | { |
1017 | { |
1018 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1018 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1019 | // auf Nullwerte kalibrieren |
1019 | // auf Nullwerte kalibrieren |
1020 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1020 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1021 | if(abs(ChannelYaw) > 75) // Neutralwerte |
1021 | if(ChannelYaw > 75) // Neutralwerte |
1022 | { |
1022 | { |
1023 | if(++delay_neutral > 200) // nicht sofort |
1023 | if(++delay_neutral > 200) // nicht sofort |
1024 | { |
1024 | { |
1025 | unsigned char setting = 0; |
1025 | unsigned char setting = 0; |
1026 | delay_neutral = 0; |
1026 | delay_neutral = 0; |
Line 1034... | Line 1034... | ||
1034 | if(ChannelRoll <-70 && ChannelNick < 70 && ChannelNick > -70) setting = 5; |
1034 | if(ChannelRoll <-70 && ChannelNick < 70 && ChannelNick > -70) setting = 5; |
1035 | if(setting) SetActiveParamSet(setting); // aktiven Datensatz merken |
1035 | if(setting) SetActiveParamSet(setting); // aktiven Datensatz merken |
1036 | } |
1036 | } |
1037 | if(abs(ChannelRoll) < 30 && ChannelNick < -70) |
1037 | if(abs(ChannelRoll) < 30 && ChannelNick < -70) |
1038 | { |
1038 | { |
1039 | WinkelOut.CalcState = 1; |
1039 | WinkelOut.CalcState = 1; // Compass kalibrieren |
1040 | CalibrationDone = 0; |
1040 | CalibrationDone = 0; |
1041 | beeptime = 1000; |
1041 | beeptime = 1000; |
1042 | } |
1042 | } |
1043 | else |
1043 | else |
1044 | { |
1044 | { |
Line 1047... | Line 1047... | ||
1047 | LIBFC_ReceiverInit(EE_Parameter.Receiver); |
1047 | LIBFC_ReceiverInit(EE_Parameter.Receiver); |
1048 | if((Parameter_GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung aktiviert? |
1048 | if((Parameter_GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung aktiviert? |
1049 | { |
1049 | { |
1050 | if((MessLuftdruck > 950) || (MessLuftdruck < 750)) SucheLuftruckOffset(); |
1050 | if((MessLuftdruck > 950) || (MessLuftdruck < 750)) SucheLuftruckOffset(); |
1051 | } |
1051 | } |
1052 | if(!setting && ChannelRoll < -70 && ChannelNick < 70) CalibrationDone = SetNeutral(3); |
1052 | if(!setting && ChannelRoll < -70 && ChannelNick < 70) CalibrationDone = SetNeutral(3); // Boat-Mode |
1053 | else |
1053 | // else |
1054 | if(!setting && ChannelYaw < -75 && abs(ChannelNick) < 70) CalibrationDone = SetNeutral(2); // store ACC values into EEPROM |
1054 | // if(!setting && ChannelYaw < -75 && abs(ChannelNick) < 70) CalibrationDone = SetNeutral(2); // store ACC values into EEPROM |
1055 | else CalibrationDone = SetNeutral(1); |
1055 | else CalibrationDone = SetNeutral(1); |
1056 | ServoActive = 1; |
1056 | ServoActive = 1; |
1057 | DDRD |=0x80; // enable J7 -> Servo signal |
1057 | DDRD |=0x80; // enable J7 -> Servo signal |
1058 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
1058 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
1059 | if(VersionInfo.HardwareError[0]) SpeakHoTT = SPEAK_ERR_SENSOR; |
1059 | if(VersionInfo.HardwareError[0]) SpeakHoTT = SPEAK_ERR_SENSOR; |
Line 1064... | Line 1064... | ||
1064 | #endif |
1064 | #endif |
1065 | Piep(ActiveParamSet,120); |
1065 | Piep(ActiveParamSet,120); |
1066 | } |
1066 | } |
1067 | } |
1067 | } |
1068 | } |
1068 | } |
- | 1069 | else |
|
- | 1070 | if(ChannelYaw < -75 && abs(ChannelRoll) < 16 && abs(ChannelRoll) < 16) // ACC calibrate |
|
- | 1071 | { |
|
- | 1072 | if(++delay_Acc_neutral > 500 * 5) // 5 sekunden |
|
- | 1073 | { |
|
1069 | else delay_neutral = 0; |
1074 | delay_Acc_neutral = 0; |
- | 1075 | CalibrationDone = SetNeutral(2); // store ACC values into EEPROM |
|
- | 1076 | ServoActive = 1; |
|
- | 1077 | DDRD |=0x80; // enable J7 -> Servo signal |
|
- | 1078 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
|
- | 1079 | if(VersionInfo.HardwareError[0]) SpeakHoTT = SPEAK_ERR_SENSOR; |
|
- | 1080 | else |
|
- | 1081 | if(!CalibrationDone) SpeakHoTT = SPEAK_ERR_CALIBARTION; |
|
- | 1082 | else SpeakHoTT = SPEAK_CALIBRATE; |
|
- | 1083 | ShowSettingNameTime = 10; // for HoTT & Jeti |
|
- | 1084 | #endif |
|
- | 1085 | Piep(ActiveParamSet,120); |
|
- | 1086 | } |
|
- | 1087 | } |
|
- | 1088 | else { delay_neutral = 0; delay_Acc_neutral = 0;}; |
|
1070 | } |
1089 | } |
1071 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1090 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1072 | // Gas ist unten |
1091 | // Gas ist unten |
1073 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1092 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1074 | if(ChannelGas < -100) |
1093 | if(ChannelGas < -100) |