Rev 2606 | Rev 2627 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2606 | Rev 2616 | ||
---|---|---|---|
Line 191... | Line 191... | ||
191 | unsigned char ACC_AltitudeControl = 0; |
191 | unsigned char ACC_AltitudeControl = 0; |
192 | unsigned char LowVoltageLandingActive = 0; |
192 | unsigned char LowVoltageLandingActive = 0; |
193 | unsigned char LowVoltageHomeActive = 0; |
193 | unsigned char LowVoltageHomeActive = 0; |
194 | signed int DriftNick = 0, DriftRoll = 0; |
194 | signed int DriftNick = 0, DriftRoll = 0; |
195 | unsigned char ServoFailsafeActive = 0; // moves Servos into the FS-Position |
195 | unsigned char ServoFailsafeActive = 0; // moves Servos into the FS-Position |
- | 196 | unsigned char Partner_StatusFlags = 0, Partner_StatusFlags2 = 0,Partner_StatusFlags3 = 0; |
|
Line 196... | Line 197... | ||
196 | 197 | ||
197 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
198 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
198 | #define OPA_OFFSET_STEP 5 |
199 | #define OPA_OFFSET_STEP 5 |
199 | #else |
200 | #else |
Line 1116... | Line 1117... | ||
1116 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
1117 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
1117 | if(VersionInfo.HardwareError[0]) SpeakHoTT = SPEAK_ERR_SENSOR; |
1118 | if(VersionInfo.HardwareError[0]) SpeakHoTT = SPEAK_ERR_SENSOR; |
1118 | else |
1119 | else |
1119 | if(!CalibrationDone) SpeakHoTT = SPEAK_ERR_CALIBARTION; |
1120 | if(!CalibrationDone) SpeakHoTT = SPEAK_ERR_CALIBARTION; |
1120 | else SpeakHoTT = SPEAK_CALIBRATE; |
1121 | else SpeakHoTT = SPEAK_CALIBRATE; |
1121 | ShowSettingNameTime = 10; // for HoTT & Jeti |
1122 | ShowSettingNameTime = 5; // for HoTT & Jeti |
1122 | #endif |
1123 | #endif |
1123 | Piep(ActiveParamSet,120); |
1124 | Piep(ActiveParamSet,120); |
1124 | } |
1125 | } |
1125 | } |
1126 | } |
1126 | } |
1127 | } |
Line 1136... | Line 1137... | ||
1136 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
1137 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
1137 | if(VersionInfo.HardwareError[0]) SpeakHoTT = SPEAK_ERR_SENSOR; |
1138 | if(VersionInfo.HardwareError[0]) SpeakHoTT = SPEAK_ERR_SENSOR; |
1138 | else |
1139 | else |
1139 | if(!CalibrationDone) SpeakHoTT = SPEAK_ERR_CALIBARTION; |
1140 | if(!CalibrationDone) SpeakHoTT = SPEAK_ERR_CALIBARTION; |
1140 | else SpeakHoTT = SPEAK_CALIBRATE; |
1141 | else SpeakHoTT = SPEAK_CALIBRATE; |
1141 | ShowSettingNameTime = 10; // for HoTT & Jeti |
1142 | ShowSettingNameTime = 5; // for HoTT & Jeti |
1142 | #endif |
1143 | #endif |
1143 | Piep(ActiveParamSet,120); |
1144 | Piep(ActiveParamSet,120); |
1144 | } |
1145 | } |
1145 | } |
1146 | } |
1146 | else { delay_neutral = 0; delay_Acc_neutral = 0;}; |
1147 | else { delay_neutral = 0; delay_Acc_neutral = 0;}; |
Line 1162... | Line 1163... | ||
1162 | { |
1163 | { |
1163 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1164 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1164 | // Einschalten |
1165 | // Einschalten |
1165 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1166 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1166 | if(CalibrationDone) FC_StatusFlags |= FC_STATUS_START; |
1167 | if(CalibrationDone) FC_StatusFlags |= FC_STATUS_START; |
1167 | - | ||
1168 | StartLuftdruck = Luftdruck; |
1168 | StartLuftdruck = Luftdruck; |
1169 | HoehenWert = 0; |
1169 | HoehenWert = 0; |
1170 | HoehenWert_Mess = 0; |
1170 | HoehenWert_Mess = 0; |
1171 | GasIsZeroCnt = 600; |
1171 | GasIsZeroCnt = 600; |
1172 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
1172 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
Line 1179... | Line 1179... | ||
1179 | if(FC_StatusFlags3 & FC_STATUS3_BOAT) { if((abs(MesswertGier) > 32*2 || abs(MesswertNick) > 20*3) || abs(MesswertRoll) > 20*3) CalibrationDone = 0; } // dann ist der Gyro defekt, schlecht kalibriert oder der MK dreht sich |
1179 | if(FC_StatusFlags3 & FC_STATUS3_BOAT) { if((abs(MesswertGier) > 32*2 || abs(MesswertNick) > 20*3) || abs(MesswertRoll) > 20*3) CalibrationDone = 0; } // dann ist der Gyro defekt, schlecht kalibriert oder der MK dreht sich |
1180 | else |
1180 | else |
1181 | if((abs(MesswertGier) > 32 || abs(MesswertNick) > 20) || abs(MesswertRoll) > 20) CalibrationDone = 0; // dann ist der Gyro defekt, schlecht kalibriert oder der MK dreht sich |
1181 | if((abs(MesswertGier) > 32 || abs(MesswertNick) > 20) || abs(MesswertRoll) > 20) CalibrationDone = 0; // dann ist der Gyro defekt, schlecht kalibriert oder der MK dreht sich |
1182 | delay_einschalten = 0; |
1182 | delay_einschalten = 0; |
Line 1183... | Line 1183... | ||
1183 | 1183 | ||
1184 | if(!VersionInfo.HardwareError[0] && CalibrationDone && !NC_ErrorCode) |
1184 | if(!VersionInfo.HardwareError[0] && CalibrationDone && !NC_ErrorCode && !Partner_ErrorCode) |
1185 | { |
1185 | { |
1186 | modell_fliegt = 1; |
1186 | modell_fliegt = 1; |
1187 | MotorenEin = 1; |
- | |
1188 | FC_StatusFlags3 &= ~FC_STATUS3_MOTORS_STOPPED_BY_RC; |
1187 | MotorenEin = 1; |
1189 | sollGier = 0; |
1188 | sollGier = 0; |
1190 | Mess_Integral_Gier = 0; |
1189 | Mess_Integral_Gier = 0; |
1191 | Mess_Integral_Gier2 = 0; |
1190 | Mess_Integral_Gier2 = 0; |
1192 | Mess_IntegralNick = EE_Parameter.GyroAccFaktor * (long)Mittelwert_AccNick; |
1191 | Mess_IntegralNick = EE_Parameter.GyroAccFaktor * (long)Mittelwert_AccNick; |
Line 1230... | Line 1229... | ||
1230 | SummeNick = 0; |
1229 | SummeNick = 0; |
1231 | SummeRoll = 0; |
1230 | SummeRoll = 0; |
1232 | StickNick = 0; |
1231 | StickNick = 0; |
1233 | StickRoll = 0; |
1232 | StickRoll = 0; |
1234 | } |
1233 | } |
1235 | if(++delay_ausschalten > 250) // nicht sofort |
1234 | if(++delay_ausschalten > 250 || Partner_StatusFlags3 & FC_STATUS3_MOTORS_STOPPED_BY_RC) // nicht sofort oder wenn der Partner schon aus ist |
1236 | { |
1235 | { |
1237 | if(MotorenEin) FC_StatusFlags3 |= FC_STATUS3_MOTORS_STOPPED_BY_RC; // that informs the slave to disarm the Motors |
1236 | FC_StatusFlags3 |= FC_STATUS3_MOTORS_STOPPED_BY_RC; // that informs the slave to disarm the Motors |
- | 1237 | Delete_Stoppflag_Timer = 2; // 1-2 seconds |
|
1238 | MotorenEin = 0; |
1238 | MotorenEin = 0; |
1239 | delay_ausschalten = 0; |
1239 | delay_ausschalten = 0; |
1240 | modell_fliegt = 0; |
1240 | modell_fliegt = 0; |
1241 | FC_StatusFlags2 &= ~(FC_STATUS2_WAIT_FOR_TAKEOFF | FC_STATUS2_AUTO_STARTING | FC_STATUS2_AUTO_LANDING); |
1241 | FC_StatusFlags2 &= ~(FC_STATUS2_WAIT_FOR_TAKEOFF | FC_STATUS2_AUTO_STARTING | FC_STATUS2_AUTO_LANDING); |
1242 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
1242 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
Line 2166... | Line 2166... | ||
2166 | if(GasMischanteil > (MAX_GAS - 20) * STICK_GAIN) GasMischanteil = (MAX_GAS - 20) * STICK_GAIN; |
2166 | if(GasMischanteil > (MAX_GAS - 20) * STICK_GAIN) GasMischanteil = (MAX_GAS - 20) * STICK_GAIN; |
Line 2167... | Line 2167... | ||
2167 | 2167 | ||
2168 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2168 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2169 | // all BL-Ctrl connected? |
2169 | // all BL-Ctrl connected? |
- | 2170 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
2170 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2171 | |
2171 | #ifndef REDUNDANT_FC_SLAVE |
2172 | #ifndef REDUNDANT_FC_SLAVE |
2172 | if(MissingMotor || Capacity.MinOfMaxPWM < 254 || NC_ErrorCode) // wait until all BL-Ctrls started and no Errors |
2173 | if(MissingMotor || Capacity.MinOfMaxPWM < 254 || NC_ErrorCode) // wait until all BL-Ctrls started and no Errors |
2173 | if(modell_fliegt > 1 && modell_fliegt < 50 && GasMischanteil > 0) // only during start-phase |
2174 | if(modell_fliegt > 1 && modell_fliegt < 50 && GasMischanteil > 0) // only during start-phase |
2174 | { |
2175 | { |
2175 | modell_fliegt = 1; |
2176 | modell_fliegt = 1; |
2176 | GasMischanteil = (MIN_GAS + 10) * STICK_GAIN; |
2177 | GasMischanteil = (MIN_GAS + 10) * STICK_GAIN; |
2177 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
2178 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
2178 | if(Capacity.MinOfMaxPWM < 40) SpeakHoTT = SPEAK_ERR_MOTOR; |
2179 | if(Capacity.MinOfMaxPWM < 40) SpeakHoTT = SPEAK_ERR_MOTOR; |
2179 | #endif |
2180 | #endif |
- | 2181 | } |
|
- | 2182 | #else // ab hier : Slave |
|
- | 2183 | if(IamMaster == SLAVE) |
|
- | 2184 | { |
|
- | 2185 | if(Partner_StatusFlags3 & FC_STATUS3_MOTORS_STOPPED_BY_RC) |
|
- | 2186 | { |
|
- | 2187 | MotorenEin = 0; |
|
- | 2188 | modell_fliegt = 0; |
|
- | 2189 | FC_StatusFlags &= ~(FC_STATUS_EMERGENCY_LANDING | FC_STATUS_FLY); |
|
- | 2190 | SpeakHoTT = SPEAK_MK_OFF; |
|
- | 2191 | } |
|
2180 | } |
2192 | } |
Line 2181... | Line 2193... | ||
2181 | #endif |
2193 | #endif |
2182 | 2194 | ||
2183 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2195 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |