Rev 1266 | Rev 1278 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1266 | Rev 1276 | ||
---|---|---|---|
Line 1266... | Line 1266... | ||
1266 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1266 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1267 | GasMischanteil *= STICK_GAIN; |
1267 | GasMischanteil *= STICK_GAIN; |
1268 | if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung |
1268 | if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung |
1269 | { |
1269 | { |
1270 | int tmp_int; |
1270 | int tmp_int; |
- | 1271 | long tmp_long_h; |
|
1271 | static char delay = 100; |
1272 | static char delay = 100; |
- | 1273 | unsigned char angle_gas = 0; |
|
1272 | if(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER) // Regler wird über Schalter gesteuert |
1274 | if(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER) // Regler wird über Schalter gesteuert |
1273 | { |
1275 | { |
1274 | if(Parameter_MaxHoehe < 50) |
1276 | if(Parameter_MaxHoehe < 50) |
1275 | { |
1277 | { |
1276 | if(!delay--) |
1278 | if(!delay--) |
Line 1312... | Line 1314... | ||
1312 | 1314 | ||
1313 | if(MikroKopterFlags & FLAG_NOTLANDUNG) SollHoehe = 0; |
1315 | if(MikroKopterFlags & FLAG_NOTLANDUNG) SollHoehe = 0; |
1314 | h = HoehenWert; |
1316 | h = HoehenWert; |
1315 | if((h > SollHoehe) && HoehenReglerAktiv) // zu hoch --> drosseln |
1317 | if((h > SollHoehe) && HoehenReglerAktiv) // zu hoch --> drosseln |
- | 1318 | { |
|
- | 1319 | int vario; |
|
- | 1320 | vario = VarioMeter / 8; |
|
- | 1321 | if(vario > 8) vario = 8; |
|
- | 1322 | if(vario > 0) vario = VarioMeter + (vario * vario) / 4; |
|
1316 | { |
1323 | else vario = VarioMeter - (vario * vario) / 4; |
1317 | h = ((h - SollHoehe) * (int) Parameter_Hoehe_P) / 16; // Differenz bestimmen --> P-Anteil |
1324 | h = ((h - SollHoehe) * (int) Parameter_Hoehe_P) / 16; // Differenz bestimmen --> P-Anteil |
1318 | h = GasMischanteil - h; // vom Gas abziehen |
1325 | h = GasMischanteil - h; // vom Gas abziehen |
1319 | h -= (Parameter_Luftdruck_D * VarioMeter)/128; // D-Anteil |
1326 | h -= (Parameter_Luftdruck_D * (long)vario)/128L; // D-Anteil |
1320 | tmp_int = ((Mess_Integral_Hoch / 128) * (signed long) Parameter_Hoehe_ACC_Wirkung) / (128 / STICK_GAIN); |
1327 | tmp_int = ((Mess_Integral_Hoch / 128) * (signed long) Parameter_Hoehe_ACC_Wirkung) / (128 / STICK_GAIN); |
1321 | if(tmp_int > 70*STICK_GAIN) tmp_int = 70*STICK_GAIN; |
1328 | if(tmp_int > 70*STICK_GAIN) tmp_int = 70*STICK_GAIN; |
1322 | else if(tmp_int < -(70*STICK_GAIN)) tmp_int = -(70*STICK_GAIN); |
1329 | else if(tmp_int < -(70*STICK_GAIN)) tmp_int = -(70*STICK_GAIN); |
- | 1330 | h -= tmp_int; |
|
- | 1331 | ||
- | 1332 | const unsigned char GAS_TAB[31] = {128,128,128,129,129,130,131,132,133,135,136,138,140,142,145,148,151,154,158,162,167,172,178,184,191,199,208,218,229,241,255}; |
|
- | 1333 | tmp_long_h = labs(IntegralNick) + labs(IntegralRoll); |
|
- | 1334 | tmp_long_h /= 1500;//1024 * 2; |
|
- | 1335 | if(tmp_long_h > 29) tmp_long_h = 29; |
|
- | 1336 | h = ((long) h * GAS_TAB[tmp_long_h]) / 128L; |
|
- | 1337 | //DebugOut.Analog[21] = (int) tmp_long_h; |
|
- | 1338 | //DebugOut.Analog[22] = (int) GAS_TAB[tmp_long_h]; |
|
1323 | h -= tmp_int; |
1339 | //DebugOut.Analog[23] = vario; |
1324 | hoehenregler = (hoehenregler*7 + h) / 8; |
1340 | hoehenregler = (hoehenregler*7 + h) / 8; |
1325 | if(hoehenregler < EE_Parameter.Hoehe_MinGas * STICK_GAIN) // nicht unter MIN |
1341 | if(hoehenregler < EE_Parameter.Hoehe_MinGas * STICK_GAIN) // nicht unter MIN |
1326 | { |
1342 | { |
1327 | if(GasMischanteil >= EE_Parameter.Hoehe_MinGas * STICK_GAIN) hoehenregler = EE_Parameter.Hoehe_MinGas * STICK_GAIN; |
1343 | if(GasMischanteil >= EE_Parameter.Hoehe_MinGas * STICK_GAIN) hoehenregler = EE_Parameter.Hoehe_MinGas * STICK_GAIN; |