From 35b2197b3c808d5459eb143e61f43eb486b80b72 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Fri, 26 May 2017 13:50:53 -0400 Subject: [PATCH] MAN FLX, TO PERF on MCDU working more --- A320-main.xml | 2 +- .../MCDU1/PERF/TO/{INITBOX.ac => BOX.ac} | 6 +- Models/Instruments/MCDU1/PERF/TO/BOX.xml | 37 +++ Models/Instruments/MCDU1/PERF/TO/INITBOX.xml | 13 - Models/Instruments/MCDU1/PERF/TO/TO.xml | 250 ++++++++++++++++-- .../MCDU2/PERF/TO/{INITBOX.ac => BOX.ac} | 6 +- Models/Instruments/MCDU2/PERF/TO/BOX.xml | 37 +++ Models/Instruments/MCDU2/PERF/TO/INITBOX.xml | 13 - Models/Instruments/MCDU2/PERF/TO/TO.xml | 250 ++++++++++++++++-- Models/Instruments/PFD/PFD1.xml | 88 ++++++ Models/Instruments/PFD/PFD2.xml | 88 ++++++ Nasal/FMGC.nas | 6 +- Nasal/MCDU1.nas | 168 +++++++++++- Nasal/MCDU2.nas | 168 +++++++++++- Nasal/thrust.nas | 32 ++- 15 files changed, 1058 insertions(+), 106 deletions(-) rename Models/Instruments/MCDU1/PERF/TO/{INITBOX.ac => BOX.ac} (99%) create mode 100644 Models/Instruments/MCDU1/PERF/TO/BOX.xml delete mode 100644 Models/Instruments/MCDU1/PERF/TO/INITBOX.xml rename Models/Instruments/MCDU2/PERF/TO/{INITBOX.ac => BOX.ac} (99%) create mode 100644 Models/Instruments/MCDU2/PERF/TO/BOX.xml delete mode 100644 Models/Instruments/MCDU2/PERF/TO/INITBOX.xml diff --git a/A320-main.xml b/A320-main.xml index 28ff400f..0a45ba63 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -627,7 +627,7 @@ 0 -10 - O + I . diff --git a/Models/Instruments/MCDU1/PERF/TO/INITBOX.ac b/Models/Instruments/MCDU1/PERF/TO/BOX.ac similarity index 99% rename from Models/Instruments/MCDU1/PERF/TO/INITBOX.ac rename to Models/Instruments/MCDU1/PERF/TO/BOX.ac index de982397..969a9215 100644 --- a/Models/Instruments/MCDU1/PERF/TO/INITBOX.ac +++ b/Models/Instruments/MCDU1/PERF/TO/BOX.ac @@ -4,7 +4,7 @@ MATERIAL "ac3dmat1" rgb 1 1 1 amb 1 1 1 emis 0 0 0 spec 1 1 1 shi 0 trans 0 OBJECT world kids 4 OBJECT poly -name "vr" +name "vrbox" loc -0.0660365 -0.00059823 0.0488058 data 10 enginepane @@ -25,7 +25,7 @@ refs 4 2 0.772026 0.340808 kids 0 OBJECT poly -name "v1" +name "v1box" loc -0.0766055 -0.00059823 0.0486379 data 10 enginepane @@ -46,7 +46,7 @@ refs 4 1 0.770887 0.340902 kids 0 OBJECT poly -name "v2" +name "v2box" loc -0.055732 -0.00059823 0.0488504 data 10 enginepane diff --git a/Models/Instruments/MCDU1/PERF/TO/BOX.xml b/Models/Instruments/MCDU1/PERF/TO/BOX.xml new file mode 100644 index 00000000..260e42c3 --- /dev/null +++ b/Models/Instruments/MCDU1/PERF/TO/BOX.xml @@ -0,0 +1,37 @@ + + + + + + + BOX.ac + + + select + v1box + + /FMGC/internal/v1-set + + + + + select + vrbox + + /FMGC/internal/vr-set + + + + + select + v2box + + /FMGC/internal/v2-set + + + + diff --git a/Models/Instruments/MCDU1/PERF/TO/INITBOX.xml b/Models/Instruments/MCDU1/PERF/TO/INITBOX.xml deleted file mode 100644 index 97fc8370..00000000 --- a/Models/Instruments/MCDU1/PERF/TO/INITBOX.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - INITBOX.ac - - diff --git a/Models/Instruments/MCDU1/PERF/TO/TO.xml b/Models/Instruments/MCDU1/PERF/TO/TO.xml index 993de71c..f17f0eb6 100644 --- a/Models/Instruments/MCDU1/PERF/TO/TO.xml +++ b/Models/Instruments/MCDU1/PERF/TO/TO.xml @@ -10,9 +10,9 @@ EMPTY.ac - + page @@ -47,19 +47,6 @@ - - INITBOX - INITBOX.xml - - -0.001 - 0.0 - 0.0 - -180 - -180 - -90 - - - v1 @@ -84,6 +71,38 @@ + + v12 + + -0.001 + -0.045 + 0.0715 + + left-center + yz-plane + text-value + %s + false + BoeingCDU-Large.ttf + /FMGC/internal/v1 + true + false + false + 0.0050 + + 64 + 64 + + + + + select + v12 + + /FMGC/internal/v1-set + + + flprtr @@ -204,6 +223,38 @@ + + vr2 + + -0.001 + -0.045 + 0.061 + + left-center + yz-plane + text-value + %s + false + BoeingCDU-Large.ttf + /FMGC/internal/vr + true + false + false + 0.0050 + + 64 + 64 + + + + + select + vr2 + + /FMGC/internal/vr-set + + + sltrtr @@ -325,7 +376,7 @@ - flapsmcdu2 + flapsmcdu -0.001 0.045 @@ -349,7 +400,7 @@ - flapsmcdu + flapsmcdu2 -0.001 0.045 @@ -358,7 +409,7 @@ right-center yz-plane text-value - [ ]/[ ] + [ ]/[ . ] false helvetica_medium.txf autopilot/serviceable @@ -372,6 +423,70 @@ + + flapsmcdu3 + + -0.001 + 0.0275 + 0.0505 + + right-center + yz-plane + text-value + %s + false + BoeingCDU-Large.ttf + /FMGC/internal/to-flap + true + false + false + 0.0050 + + 64 + 64 + + + + + flapsmcdu3 + + -0.001 + 0.045 + 0.0505 + + right-center + yz-plane + text-value + /UP%s + false + BoeingCDU-Large.ttf + /FMGC/internal/to-ths + true + false + false + 0.0050 + + 64 + 64 + + + + + select + flapsmcdu2 + + /FMGC/internal/flap-ths-set + + + + + select + flapsmcdu3 + + /FMGC/internal/flap-ths-set + + + v2 @@ -396,6 +511,38 @@ + + v22 + + -0.001 + -0.045 + 0.0505 + + left-center + yz-plane + text-value + %s + false + BoeingCDU-Large.ttf + /FMGC/internal/v2 + true + false + false + 0.0050 + + 64 + 64 + + + + + select + v22 + + /FMGC/internal/v2-set + + + clean @@ -478,10 +625,10 @@ left-center yz-plane text-value - 18000 + %s false BoeingCDU-Large.ttf - autopilot/serviceable + /FMGC/internal/trans-alt true false false @@ -677,7 +824,7 @@ - flex2 + flex -0.001 0.042 @@ -701,7 +848,7 @@ - flex + flex2 -0.001 0.045 @@ -710,7 +857,7 @@ right-center yz-plane text-value - [ ] + [ ] false helvetica_medium.txf autopilot/serviceable @@ -724,6 +871,46 @@ + + flex3 + + -0.001 + 0.045 + 0.039 + + right-center + yz-plane + text-value + %sC + false + BoeingCDU-Large.ttf + /FMGC/internal/flex + true + false + false + 0.0050 + + 64 + 64 + + + + + select + flex2 + + /FMGC/internal/flex-set + + + + + select + flex3 + + /FMGC/internal/flex-set + + + uplink @@ -833,9 +1020,9 @@ next phase shift - flex2 + flex thredacc - flapsmcdu2 + flapsmcdu eoaccel2 flprtr sltrtr @@ -926,12 +1113,17 @@ material toshift3 - flapsmcdu + flapsmcdu2 + flapsmcdu3 trans2 eoaccel thred thred2 - flex + flex2 + flex3 + v12 + vr2 + v22 0 0.5 diff --git a/Models/Instruments/MCDU2/PERF/TO/INITBOX.ac b/Models/Instruments/MCDU2/PERF/TO/BOX.ac similarity index 99% rename from Models/Instruments/MCDU2/PERF/TO/INITBOX.ac rename to Models/Instruments/MCDU2/PERF/TO/BOX.ac index de982397..969a9215 100644 --- a/Models/Instruments/MCDU2/PERF/TO/INITBOX.ac +++ b/Models/Instruments/MCDU2/PERF/TO/BOX.ac @@ -4,7 +4,7 @@ MATERIAL "ac3dmat1" rgb 1 1 1 amb 1 1 1 emis 0 0 0 spec 1 1 1 shi 0 trans 0 OBJECT world kids 4 OBJECT poly -name "vr" +name "vrbox" loc -0.0660365 -0.00059823 0.0488058 data 10 enginepane @@ -25,7 +25,7 @@ refs 4 2 0.772026 0.340808 kids 0 OBJECT poly -name "v1" +name "v1box" loc -0.0766055 -0.00059823 0.0486379 data 10 enginepane @@ -46,7 +46,7 @@ refs 4 1 0.770887 0.340902 kids 0 OBJECT poly -name "v2" +name "v2box" loc -0.055732 -0.00059823 0.0488504 data 10 enginepane diff --git a/Models/Instruments/MCDU2/PERF/TO/BOX.xml b/Models/Instruments/MCDU2/PERF/TO/BOX.xml new file mode 100644 index 00000000..260e42c3 --- /dev/null +++ b/Models/Instruments/MCDU2/PERF/TO/BOX.xml @@ -0,0 +1,37 @@ + + + + + + + BOX.ac + + + select + v1box + + /FMGC/internal/v1-set + + + + + select + vrbox + + /FMGC/internal/vr-set + + + + + select + v2box + + /FMGC/internal/v2-set + + + + diff --git a/Models/Instruments/MCDU2/PERF/TO/INITBOX.xml b/Models/Instruments/MCDU2/PERF/TO/INITBOX.xml deleted file mode 100644 index 97fc8370..00000000 --- a/Models/Instruments/MCDU2/PERF/TO/INITBOX.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - INITBOX.ac - - diff --git a/Models/Instruments/MCDU2/PERF/TO/TO.xml b/Models/Instruments/MCDU2/PERF/TO/TO.xml index 993de71c..f17f0eb6 100644 --- a/Models/Instruments/MCDU2/PERF/TO/TO.xml +++ b/Models/Instruments/MCDU2/PERF/TO/TO.xml @@ -10,9 +10,9 @@ EMPTY.ac - + page @@ -47,19 +47,6 @@ - - INITBOX - INITBOX.xml - - -0.001 - 0.0 - 0.0 - -180 - -180 - -90 - - - v1 @@ -84,6 +71,38 @@ + + v12 + + -0.001 + -0.045 + 0.0715 + + left-center + yz-plane + text-value + %s + false + BoeingCDU-Large.ttf + /FMGC/internal/v1 + true + false + false + 0.0050 + + 64 + 64 + + + + + select + v12 + + /FMGC/internal/v1-set + + + flprtr @@ -204,6 +223,38 @@ + + vr2 + + -0.001 + -0.045 + 0.061 + + left-center + yz-plane + text-value + %s + false + BoeingCDU-Large.ttf + /FMGC/internal/vr + true + false + false + 0.0050 + + 64 + 64 + + + + + select + vr2 + + /FMGC/internal/vr-set + + + sltrtr @@ -325,7 +376,7 @@ - flapsmcdu2 + flapsmcdu -0.001 0.045 @@ -349,7 +400,7 @@ - flapsmcdu + flapsmcdu2 -0.001 0.045 @@ -358,7 +409,7 @@ right-center yz-plane text-value - [ ]/[ ] + [ ]/[ . ] false helvetica_medium.txf autopilot/serviceable @@ -372,6 +423,70 @@ + + flapsmcdu3 + + -0.001 + 0.0275 + 0.0505 + + right-center + yz-plane + text-value + %s + false + BoeingCDU-Large.ttf + /FMGC/internal/to-flap + true + false + false + 0.0050 + + 64 + 64 + + + + + flapsmcdu3 + + -0.001 + 0.045 + 0.0505 + + right-center + yz-plane + text-value + /UP%s + false + BoeingCDU-Large.ttf + /FMGC/internal/to-ths + true + false + false + 0.0050 + + 64 + 64 + + + + + select + flapsmcdu2 + + /FMGC/internal/flap-ths-set + + + + + select + flapsmcdu3 + + /FMGC/internal/flap-ths-set + + + v2 @@ -396,6 +511,38 @@ + + v22 + + -0.001 + -0.045 + 0.0505 + + left-center + yz-plane + text-value + %s + false + BoeingCDU-Large.ttf + /FMGC/internal/v2 + true + false + false + 0.0050 + + 64 + 64 + + + + + select + v22 + + /FMGC/internal/v2-set + + + clean @@ -478,10 +625,10 @@ left-center yz-plane text-value - 18000 + %s false BoeingCDU-Large.ttf - autopilot/serviceable + /FMGC/internal/trans-alt true false false @@ -677,7 +824,7 @@ - flex2 + flex -0.001 0.042 @@ -701,7 +848,7 @@ - flex + flex2 -0.001 0.045 @@ -710,7 +857,7 @@ right-center yz-plane text-value - [ ] + [ ] false helvetica_medium.txf autopilot/serviceable @@ -724,6 +871,46 @@ + + flex3 + + -0.001 + 0.045 + 0.039 + + right-center + yz-plane + text-value + %sC + false + BoeingCDU-Large.ttf + /FMGC/internal/flex + true + false + false + 0.0050 + + 64 + 64 + + + + + select + flex2 + + /FMGC/internal/flex-set + + + + + select + flex3 + + /FMGC/internal/flex-set + + + uplink @@ -833,9 +1020,9 @@ next phase shift - flex2 + flex thredacc - flapsmcdu2 + flapsmcdu eoaccel2 flprtr sltrtr @@ -926,12 +1113,17 @@ material toshift3 - flapsmcdu + flapsmcdu2 + flapsmcdu3 trans2 eoaccel thred thred2 - flex + flex2 + flex3 + v12 + vr2 + v22 0 0.5 diff --git a/Models/Instruments/PFD/PFD1.xml b/Models/Instruments/PFD/PFD1.xml index 616c9b5b..4f6644cb 100644 --- a/Models/Instruments/PFD/PFD1.xml +++ b/Models/Instruments/PFD/PFD1.xml @@ -1761,6 +1761,52 @@ + + athr-flex-fma + + 0.00091828 + -0.0576226 + 0.0630781 + + center-center + yz-plane + text-value + FLX + + autopilot/serviceable + helvetica_medium.txf + true + false + false + 0.0055 + + 32 + 32 + + + + + athr-flexb-fma + + 0.00091828 + -0.0466226 + 0.0630781 + + center-center + yz-plane + text-value + %s + /FMGC/internal/flex + helvetica_medium.txf + true + false + false + 0.0055 + + 32 + 32 + + + athr-thr-fma @@ -1880,6 +1926,46 @@ /it-autoflight/output/athr 1 + + /controls/engines/thrust-limit + FLX + + + /systems/thrust/state1 + TOGA + + + /systems/thrust/state2 + TOGA + + + + /systems/thrust/state1 + MCT + + + /systems/thrust/state2 + MCT + + + + + + + + select + athr-flex-fma + athr-flexb-fma + + + + /it-autoflight/output/athr + 1 + + + /controls/engines/thrust-limit + FLX + /systems/thrust/state1 TOGA @@ -2283,6 +2369,7 @@ athr-man-fma athr-toga-fma athr-mct-fma + athr-flex-fma athr-thr-fma athr-box-fma athr-lvrclb-fma @@ -2318,6 +2405,7 @@ roll-mode-armed-fma pitch-mode-armed-fma pitch-mode-armed2-fma + athr-flexb-fma 0 0.886 diff --git a/Models/Instruments/PFD/PFD2.xml b/Models/Instruments/PFD/PFD2.xml index 94bcdac6..a35de1f9 100644 --- a/Models/Instruments/PFD/PFD2.xml +++ b/Models/Instruments/PFD/PFD2.xml @@ -1761,6 +1761,52 @@ + + athr-flex-fma + + 0.00091828 + -0.0576226 + 0.0630781 + + center-center + yz-plane + text-value + FLX + + autopilot/serviceable + helvetica_medium.txf + true + false + false + 0.0055 + + 32 + 32 + + + + + athr-flexb-fma + + 0.00091828 + -0.0466226 + 0.0630781 + + center-center + yz-plane + text-value + %s + /FMGC/internal/flex + helvetica_medium.txf + true + false + false + 0.0055 + + 32 + 32 + + + athr-thr-fma @@ -1880,6 +1926,46 @@ /it-autoflight/output/athr 1 + + /controls/engines/thrust-limit + FLX + + + /systems/thrust/state1 + TOGA + + + /systems/thrust/state2 + TOGA + + + + /systems/thrust/state1 + MCT + + + /systems/thrust/state2 + MCT + + + + + + + + select + athr-flex-fma + athr-flexb-fma + + + + /it-autoflight/output/athr + 1 + + + /controls/engines/thrust-limit + FLX + /systems/thrust/state1 TOGA @@ -2283,6 +2369,7 @@ athr-man-fma athr-toga-fma athr-mct-fma + athr-flex-fma athr-thr-fma athr-box-fma athr-lvrclb-fma @@ -2318,6 +2405,7 @@ roll-mode-armed-fma pitch-mode-armed-fma pitch-mode-armed2-fma + athr-flexb-fma 0 0.886 diff --git a/Nasal/FMGC.nas b/Nasal/FMGC.nas index 538cc18e..e6466d77 100644 --- a/Nasal/FMGC.nas +++ b/Nasal/FMGC.nas @@ -10,10 +10,7 @@ setprop("/position/gear-agl-ft", 0); var FMGCinit = func { setprop("/FMGC/status/to-state", 0); setprop("/FMGC/status/phase", "0"); # 0 is preflight 1 takeoff 2 climb 3 cruise 4 descent 5 approach 6 go around 7 done - setprop("/FMGC/internal/cruise-ft", 10000); - setprop("/FMGC/internal/cruise-fl", 100); setprop("/FMGC/internal/tropo", 36090); - setprop("/FMGC/internal/cost-index", "0"); phasecheck.start(); } @@ -100,6 +97,7 @@ var phasecheck = maketimer(0.2, func { } if ((phase == "5") and (state1 == "TOGA") and (state2 == "TOGA")) { # this is the only fully correct one to FCOM setprop("/FMGC/status/phase", "6"); + setprop("/it-autoflight/input/toga", 1); } # forget transition from APP to climb for now because it would be too complex if ((phase == "6") and ((vertmode == "G/A CLB") or (vertmode == "SPD CLB") or (vertmode == "CLB") or ((vertmode == "V/S") and (targetvs > 0)) or ((vertmode == "FPA") and (targetfpa > 0))) and (alt <= targetalt)) { @@ -112,7 +110,7 @@ var phasecheck = maketimer(0.2, func { FMGCinit(); mcdu1.MCDU_reset(); mcdu2.MCDU_reset(); - }, 30); + }, 20); } }); \ No newline at end of file diff --git a/Nasal/MCDU1.nas b/Nasal/MCDU1.nas index 9e9c9342..d4a17697 100644 --- a/Nasal/MCDU1.nas +++ b/Nasal/MCDU1.nas @@ -8,33 +8,56 @@ var MCDU_init = func { } var MCDU_reset = func { + setprop("/it-autoflight/settings/togaspd", 157); setprop("/MCDU[0]/page", "STATUS"); setprop("/MCDU[0]/scratchpad", ""); setprop("/MCDUC/flight-num", ""); - setprop("/MCDUC/flight-num-set", 0); setprop("/MCDUC/thracc-set", 0); + setprop("/MCDUC/flight-num-set", 0); + setprop("/FMGC/internal/flex", 0); setprop("/FMGC/internal/dep-arpt", ""); setprop("/FMGC/internal/arr-arpt", ""); - setprop("/FMGC/internal/tofrom-set", 0); setprop("/FMGC/internal/cruise-ft", 10000); setprop("/FMGC/internal/cruise-fl", 100); setprop("/FMGC/internal/cost-index", "0"); + setprop("/FMGC/internal/trans-alt", 18000); + setprop("/FMGC/internal/v1", 0); + setprop("/FMGC/internal/vr", 0); + setprop("/FMGC/internal/v2", 0); + setprop("/FMGC/internal/v1-set", 0); + setprop("/FMGC/internal/vr-set", 0); + setprop("/FMGC/internal/v2-set", 0); + setprop("/FMGC/internal/to-flap", 0); + setprop("/FMGC/internal/to-ths", "0.0"); + setprop("/FMGC/internal/tofrom-set", 0); setprop("/FMGC/internal/cost-index-set", 0); setprop("/FMGC/internal/cruise-lvl-set", 0); + setprop("/FMGC/internal/flap-ths-set", 0); + setprop("/FMGC/internal/flex-set", 0); } var lskbutton = func(btn) { - if (btn == "2") { + if (btn == "1") { + if (getprop("/MCDU[0]/page") == "TO") { + PerfTOInput("L1"); + } + } else if (btn == "2") { if (getprop("/MCDU[0]/page") == "INITA") { PerfInput("L2"); + } else if (getprop("/MCDU[0]/page") == "TO") { + PerfTOInput("L2"); } } else if (btn == "3") { if (getprop("/MCDU[0]/page") == "INITA") { initInputA("L3"); + } else if (getprop("/MCDU[0]/page") == "TO") { + PerfTOInput("L3"); } } else if (btn == "4") { if (getprop("/MCDU[0]/page") == "DATA") { setprop("/MCDU[0]/page", "STATUS"); + } else if (getprop("/MCDU[0]/page") == "TO") { + PerfTOInput("L4"); } } else if (btn == "5") { if (getprop("/MCDU[0]/page") == "INITA") { @@ -63,6 +86,12 @@ var rskbutton = func(btn) { } else if (btn == "3") { if (getprop("/MCDU[0]/page") == "INITA") { initInputA("R3"); + } else if (getprop("/MCDU[0]/page") == "TO") { + PerfTOInput("R3"); + } + } else if (btn == "4") { + if (getprop("/MCDU[0]/page") == "TO") { + PerfTOInput("R4"); } } else if (btn == "6") { if (getprop("/MCDU[0]/page") == "TO") { @@ -181,7 +210,91 @@ var initInputA = func(key) { var PerfTOInput = func(key) { var scratchpad = getprop("/MCDU[0]/scratchpad"); - if (key == "L5") { + if (key == "L1") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/v1", 0); + setprop("/FMGC/internal/v1-set", 0); + setprop("/MCDU[0]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs == 3) { + if (scratchpad >= 100 and scratchpad <= 200) { + setprop("/FMGC/internal/v1", scratchpad); + setprop("/FMGC/internal/v1-set", 1); + setprop("/MCDU[0]/scratchpad", ""); + } else { + setprop("/MCDU[0]/scratchpad-msg", "1"); + setprop("/MCDU[0]/scratchpad", "NOT ALLOWED"); + } + } else { + setprop("/MCDU[0]/scratchpad-msg", "1"); + setprop("/MCDU[0]/scratchpad", "NOT ALLOWED"); + } + } + } else if (key == "L2") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/vr", 0); + setprop("/FMGC/internal/vr-set", 0); + setprop("/MCDU[0]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs == 3) { + if (scratchpad >= 100 and scratchpad <= 200) { + setprop("/FMGC/internal/vr", scratchpad); + setprop("/FMGC/internal/vr-set", 1); + setprop("/MCDU[0]/scratchpad", ""); + } else { + setprop("/MCDU[0]/scratchpad-msg", "1"); + setprop("/MCDU[0]/scratchpad", "NOT ALLOWED"); + } + } else { + setprop("/MCDU[0]/scratchpad-msg", "1"); + setprop("/MCDU[0]/scratchpad", "NOT ALLOWED"); + } + } + } else if (key == "L3") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/v2", 0); + setprop("/FMGC/internal/v2-set", 0); + setprop("/it-autoflight/settings/togaspd", 157); + setprop("/MCDU[0]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs == 3) { + if (scratchpad >= 100 and scratchpad <= 200) { + setprop("/FMGC/internal/v2", scratchpad); + setprop("/FMGC/internal/v2-set", 1); + setprop("/it-autoflight/settings/togaspd", scratchpad + 15); + setprop("/MCDU[0]/scratchpad", ""); + } else { + setprop("/MCDU[0]/scratchpad-msg", "1"); + setprop("/MCDU[0]/scratchpad", "NOT ALLOWED"); + } + } else { + setprop("/MCDU[0]/scratchpad-msg", "1"); + setprop("/MCDU[0]/scratchpad", "NOT ALLOWED"); + } + } + } else if (key == "L4") { + if (scratchpad == "CLR") { + setprop("/MCDU[0]/scratchpad-msg", "1"); + setprop("/MCDU[0]/scratchpad", "NOT ALLOWED"); + } else { + var tfs = size(scratchpad); + if (tfs == 4 or tfs == 5) { + if (scratchpad >= 1000 and scratchpad <= 18000) { + setprop("/FMGC/internal/trans-alt", scratchpad); + setprop("/MCDU[0]/scratchpad", ""); + } else { + setprop("/MCDU[0]/scratchpad-msg", "1"); + setprop("/MCDU[0]/scratchpad", "NOT ALLOWED"); + } + } else { + setprop("/MCDU[0]/scratchpad-msg", "1"); + setprop("/MCDU[0]/scratchpad", "NOT ALLOWED"); + } + } + } else if (key == "L5") { if (scratchpad == "CLR") { setprop("/systems/thrust/clbreduc-ft", "1500"); setprop("/it-autoflight/settings/reduc-agl-ft", "3000"); @@ -193,7 +306,7 @@ var PerfTOInput = func(key) { var thracc = split("/", scratchpad); var thrred = size(thracc[0]); var acc = size(thracc[1]); - if ((thrred >= 1 and thrred <= 4) and (acc >= 1 and acc <= 4)) { + if ((thrred >= 3 and thrred <= 5) and (acc >= 3 and acc <= 5)) { setprop("/systems/thrust/clbreduc-ft", thracc[0]); setprop("/it-autoflight/settings/reduc-agl-ft", thracc[1]); setprop("/MCDUC/thracc-set", 1); @@ -209,6 +322,51 @@ var PerfTOInput = func(key) { } } else if (key == "R6") { setprop("/MCDU[0]/page", "CLB"); + } else if (key == "R3") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/to-flap", 0); + setprop("/FMGC/internal/to-ths", "0.0"); + setprop("/FMGC/internal/flap-ths-set", 0); + setprop("/MCDU[0]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs == 7) { + var flapths = split("/UP", scratchpad); + if ((flapths[0] >= 1 and flapths[0] <= 4) and (flapths[1] >= 0.0 and flapths[1] <= 2.5)) { + setprop("/FMGC/internal/to-flap", flapths[0]); + setprop("/FMGC/internal/to-ths", flapths[1]); + setprop("/FMGC/internal/flap-ths-set", 1); + setprop("/MCDU[0]/scratchpad", ""); + } else { + setprop("/MCDU[0]/scratchpad-msg", "1"); + setprop("/MCDU[0]/scratchpad", "NOT ALLOWED"); + } + } else { + setprop("/MCDU[0]/scratchpad-msg", "1"); + setprop("/MCDU[0]/scratchpad", "NOT ALLOWED"); + } + } + } else if (key == "R4") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/flex", 0); + setprop("/FMGC/internal/flex-set", 0); + setprop("/MCDU[0]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs == 1 or tfs == 2) { + if (scratchpad >= 0 and scratchpad <= 70) { + setprop("/FMGC/internal/flex", scratchpad); + setprop("/FMGC/internal/flex-set", 1); + setprop("/MCDU[0]/scratchpad", ""); + } else { + setprop("/MCDU[0]/scratchpad-msg", "1"); + setprop("/MCDU[0]/scratchpad", "NOT ALLOWED"); + } + } else { + setprop("/MCDU[0]/scratchpad-msg", "1"); + setprop("/MCDU[0]/scratchpad", "NOT ALLOWED"); + } + } } } diff --git a/Nasal/MCDU2.nas b/Nasal/MCDU2.nas index fb94d0ab..303952fb 100644 --- a/Nasal/MCDU2.nas +++ b/Nasal/MCDU2.nas @@ -8,33 +8,56 @@ var MCDU_init = func { } var MCDU_reset = func { + setprop("/it-autoflight/settings/togaspd", 157); setprop("/MCDU[1]/page", "STATUS"); setprop("/MCDU[1]/scratchpad", ""); setprop("/MCDUC/flight-num", ""); - setprop("/MCDUC/flight-num-set", 0); setprop("/MCDUC/thracc-set", 0); + setprop("/MCDUC/flight-num-set", 0); + setprop("/FMGC/internal/flex", 0); setprop("/FMGC/internal/dep-arpt", ""); setprop("/FMGC/internal/arr-arpt", ""); - setprop("/FMGC/internal/tofrom-set", 0); setprop("/FMGC/internal/cruise-ft", 10000); setprop("/FMGC/internal/cruise-fl", 100); setprop("/FMGC/internal/cost-index", "0"); + setprop("/FMGC/internal/trans-alt", 18000); + setprop("/FMGC/internal/v1", 0); + setprop("/FMGC/internal/vr", 0); + setprop("/FMGC/internal/v2", 0); + setprop("/FMGC/internal/v1-set", 0); + setprop("/FMGC/internal/vr-set", 0); + setprop("/FMGC/internal/v2-set", 0); + setprop("/FMGC/internal/to-flap", 0); + setprop("/FMGC/internal/to-ths", "0.0"); + setprop("/FMGC/internal/tofrom-set", 0); setprop("/FMGC/internal/cost-index-set", 0); setprop("/FMGC/internal/cruise-lvl-set", 0); + setprop("/FMGC/internal/flap-ths-set", 0); + setprop("/FMGC/internal/flex-set", 0); } var lskbutton = func(btn) { - if (btn == "2") { + if (btn == "1") { + if (getprop("/MCDU[1]/page") == "TO") { + PerfTOInput("L1"); + } + } else if (btn == "2") { if (getprop("/MCDU[1]/page") == "INITA") { PerfInput("L2"); + } else if (getprop("/MCDU[1]/page") == "TO") { + PerfTOInput("L2"); } } else if (btn == "3") { if (getprop("/MCDU[1]/page") == "INITA") { initInputA("L3"); + } else if (getprop("/MCDU[1]/page") == "TO") { + PerfTOInput("L3"); } } else if (btn == "4") { if (getprop("/MCDU[1]/page") == "DATA") { setprop("/MCDU[1]/page", "STATUS"); + } else if (getprop("/MCDU[1]/page") == "TO") { + PerfTOInput("L4"); } } else if (btn == "5") { if (getprop("/MCDU[1]/page") == "INITA") { @@ -63,6 +86,12 @@ var rskbutton = func(btn) { } else if (btn == "3") { if (getprop("/MCDU[1]/page") == "INITA") { initInputA("R3"); + } else if (getprop("/MCDU[1]/page") == "TO") { + PerfTOInput("R3"); + } + } else if (btn == "4") { + if (getprop("/MCDU[1]/page") == "TO") { + PerfTOInput("R4"); } } else if (btn == "6") { if (getprop("/MCDU[1]/page") == "TO") { @@ -181,7 +210,91 @@ var initInputA = func(key) { var PerfTOInput = func(key) { var scratchpad = getprop("/MCDU[1]/scratchpad"); - if (key == "L5") { + if (key == "L1") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/v1", 0); + setprop("/FMGC/internal/v1-set", 0); + setprop("/MCDU[1]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs == 3) { + if (scratchpad >= 100 and scratchpad <= 200) { + setprop("/FMGC/internal/v1", scratchpad); + setprop("/FMGC/internal/v1-set", 1); + setprop("/MCDU[1]/scratchpad", ""); + } else { + setprop("/MCDU[1]/scratchpad-msg", "1"); + setprop("/MCDU[1]/scratchpad", "NOT ALLOWED"); + } + } else { + setprop("/MCDU[1]/scratchpad-msg", "1"); + setprop("/MCDU[1]/scratchpad", "NOT ALLOWED"); + } + } + } else if (key == "L2") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/vr", 0); + setprop("/FMGC/internal/vr-set", 0); + setprop("/MCDU[1]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs == 3) { + if (scratchpad >= 100 and scratchpad <= 200) { + setprop("/FMGC/internal/vr", scratchpad); + setprop("/FMGC/internal/vr-set", 1); + setprop("/MCDU[1]/scratchpad", ""); + } else { + setprop("/MCDU[1]/scratchpad-msg", "1"); + setprop("/MCDU[1]/scratchpad", "NOT ALLOWED"); + } + } else { + setprop("/MCDU[1]/scratchpad-msg", "1"); + setprop("/MCDU[1]/scratchpad", "NOT ALLOWED"); + } + } + } else if (key == "L3") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/v2", 0); + setprop("/FMGC/internal/v2-set", 0); + setprop("/it-autoflight/settings/togaspd", 157); + setprop("/MCDU[1]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs == 3) { + if (scratchpad >= 100 and scratchpad <= 200) { + setprop("/FMGC/internal/v2", scratchpad); + setprop("/FMGC/internal/v2-set", 1); + setprop("/it-autoflight/settings/togaspd", scratchpad + 15); + setprop("/MCDU[1]/scratchpad", ""); + } else { + setprop("/MCDU[1]/scratchpad-msg", "1"); + setprop("/MCDU[1]/scratchpad", "NOT ALLOWED"); + } + } else { + setprop("/MCDU[1]/scratchpad-msg", "1"); + setprop("/MCDU[1]/scratchpad", "NOT ALLOWED"); + } + } + } else if (key == "L4") { + if (scratchpad == "CLR") { + setprop("/MCDU[1]/scratchpad-msg", "1"); + setprop("/MCDU[1]/scratchpad", "NOT ALLOWED"); + } else { + var tfs = size(scratchpad); + if (tfs == 4 or tfs == 5) { + if (scratchpad >= 1000 and scratchpad <= 18000) { + setprop("/FMGC/internal/trans-alt", scratchpad); + setprop("/MCDU[1]/scratchpad", ""); + } else { + setprop("/MCDU[1]/scratchpad-msg", "1"); + setprop("/MCDU[1]/scratchpad", "NOT ALLOWED"); + } + } else { + setprop("/MCDU[1]/scratchpad-msg", "1"); + setprop("/MCDU[1]/scratchpad", "NOT ALLOWED"); + } + } + } else if (key == "L5") { if (scratchpad == "CLR") { setprop("/systems/thrust/clbreduc-ft", "1500"); setprop("/it-autoflight/settings/reduc-agl-ft", "3000"); @@ -193,7 +306,7 @@ var PerfTOInput = func(key) { var thracc = split("/", scratchpad); var thrred = size(thracc[0]); var acc = size(thracc[1]); - if ((thrred >= 1 and thrred <= 4) and (acc >= 1 and acc <= 4)) { + if ((thrred >= 3 and thrred <= 5) and (acc >= 3 and acc <= 5)) { setprop("/systems/thrust/clbreduc-ft", thracc[0]); setprop("/it-autoflight/settings/reduc-agl-ft", thracc[1]); setprop("/MCDUC/thracc-set", 1); @@ -209,6 +322,51 @@ var PerfTOInput = func(key) { } } else if (key == "R6") { setprop("/MCDU[1]/page", "CLB"); + } else if (key == "R3") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/to-flap", 0); + setprop("/FMGC/internal/to-ths", "0.0"); + setprop("/FMGC/internal/flap-ths-set", 0); + setprop("/MCDU[1]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs == 7) { + var flapths = split("/UP", scratchpad); + if ((flapths[0] >= 1 and flapths[0] <= 4) and (flapths[1] >= 0.0 and flapths[1] <= 2.5)) { + setprop("/FMGC/internal/to-flap", flapths[0]); + setprop("/FMGC/internal/to-ths", flapths[1]); + setprop("/FMGC/internal/flap-ths-set", 1); + setprop("/MCDU[1]/scratchpad", ""); + } else { + setprop("/MCDU[1]/scratchpad-msg", "1"); + setprop("/MCDU[1]/scratchpad", "NOT ALLOWED"); + } + } else { + setprop("/MCDU[1]/scratchpad-msg", "1"); + setprop("/MCDU[1]/scratchpad", "NOT ALLOWED"); + } + } + } else if (key == "R4") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/flex", 0); + setprop("/FMGC/internal/flex-set", 0); + setprop("/MCDU[1]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs == 1 or tfs == 2) { + if (scratchpad >= 0 and scratchpad <= 70) { + setprop("/FMGC/internal/flex", scratchpad); + setprop("/FMGC/internal/flex-set", 1); + setprop("/MCDU[1]/scratchpad", ""); + } else { + setprop("/MCDU[1]/scratchpad-msg", "1"); + setprop("/MCDU[1]/scratchpad", "NOT ALLOWED"); + } + } else { + setprop("/MCDU[1]/scratchpad-msg", "1"); + setprop("/MCDU[1]/scratchpad", "NOT ALLOWED"); + } + } } } diff --git a/Nasal/thrust.nas b/Nasal/thrust.nas index fa58d4c0..d18e067c 100644 --- a/Nasal/thrust.nas +++ b/Nasal/thrust.nas @@ -14,6 +14,7 @@ setlistener("/sim/signals/fdm-initialized", func { setprop("/systems/thrust/state2", "IDLE"); setprop("/systems/thrust/lvrclb", "0"); setprop("/systems/thrust/clbreduc-ft", "1500"); + setprop("/systems/thrust/lim-flex", 0); thrustt.start(); }); @@ -22,13 +23,17 @@ setlistener("/controls/engines/engine[0]/throttle-pos", func { if (getprop("/systems/thrust/alpha-floor") == 0 and getprop("/systems/thrust/toga-lk") == 0) { if (thrr < 0.01) { setprop("/systems/thrust/state1", "IDLE"); + unflex(); atoff_request(); } else if (thrr >= 0.01 and thrr < 0.60) { setprop("/systems/thrust/state1", "MAN"); + unflex(); } else if (thrr >= 0.60 and thrr < 0.65) { setprop("/systems/thrust/state1", "CL"); + unflex(); } else if (thrr >= 0.65 and thrr < 0.78) { setprop("/systems/thrust/state1", "MAN THR"); + unflex(); } else if (thrr >= 0.78 and thrr < 0.83) { setprop("/it-autoflight/input/athr", 1); setprop("/controls/engines/engine[0]/throttle-fdm", 0.90); @@ -36,10 +41,12 @@ setlistener("/controls/engines/engine[0]/throttle-pos", func { } else if (thrr >= 0.83 and thrr < 0.95) { setprop("/it-autoflight/input/athr", 1); setprop("/systems/thrust/state1", "MAN THR"); + unflex(); } else if (thrr >= 0.95) { setprop("/it-autoflight/input/athr", 1); setprop("/controls/engines/engine[0]/throttle-fdm", 0.95); setprop("/systems/thrust/state1", "TOGA"); + unflex(); } } else { if (thrr < 0.01) { @@ -66,13 +73,17 @@ setlistener("/controls/engines/engine[1]/throttle-pos", func { if (getprop("/systems/thrust/alpha-floor") == 0 and getprop("/systems/thrust/toga-lk") == 0) { if (thrr < 0.01) { setprop("/systems/thrust/state2", "IDLE"); + unflex(); atoff_request(); } else if (thrr >= 0.01 and thrr < 0.60) { setprop("/systems/thrust/state2", "MAN"); + unflex(); } else if (thrr >= 0.60 and thrr < 0.65) { setprop("/systems/thrust/state2", "CL"); + unflex(); } else if (thrr >= 0.65 and thrr < 0.78) { setprop("/systems/thrust/state2", "MAN THR"); + unflex(); } else if (thrr >= 0.78 and thrr < 0.83) { setprop("/it-autoflight/input/athr", 1); setprop("/controls/engines/engine[1]/throttle-fdm", 0.90); @@ -80,10 +91,12 @@ setlistener("/controls/engines/engine[1]/throttle-pos", func { } else if (thrr >= 0.83 and thrr < 0.95) { setprop("/it-autoflight/input/athr", 1); setprop("/systems/thrust/state2", "MAN THR"); + unflex(); } else if (thrr >= 0.95) { setprop("/it-autoflight/input/athr", 1); setprop("/controls/engines/engine[1]/throttle-fdm", 0.95); setprop("/systems/thrust/state2", "TOGA"); + unflex(); } } else { if (thrr < 0.01) { @@ -141,15 +154,24 @@ var thrust_lim = func { setprop("/controls/engines/thrust-limit", "TOGA"); setprop("/controls/engines/epr-limit", 1.308); setprop("/controls/engines/n1-limit", 101.8); - } else if (state1 == "MCT" or state2 == "MCT" or (state1 == "MAN THR" and thr1 < 0.83) or (state2 == "MAN THR" and thr2 < 0.83)) { + } else if ((state1 == "MCT" or state2 == "MCT" or (state1 == "MAN THR" and thr1 < 0.83) or (state2 == "MAN THR" and thr2 < 0.83)) and getprop("/systems/thrust/lim-flex") == 0) { setprop("/controls/engines/thrust-limit", "MCT"); setprop("/controls/engines/epr-limit", 1.293); setprop("/controls/engines/n1-limit", 97.7); + } else if ((state1 == "MCT" or state2 == "MCT" or (state1 == "MAN THR" and thr1 < 0.83) or (state2 == "MAN THR" and thr2 < 0.83)) and getprop("/systems/thrust/lim-flex") == 1) { + setprop("/controls/engines/thrust-limit", "FLX"); + setprop("/controls/engines/epr-limit", 1.293); + setprop("/controls/engines/n1-limit", 97.7); } else if (state1 == "CL" or state2 == "CL" or state1 == "MAN" or state2 == "MAN" or state1 == "IDLE" or state2 == "IDLE") { setprop("/controls/engines/thrust-limit", "CLB"); setprop("/controls/engines/epr-limit", 1.271); setprop("/controls/engines/n1-limit", 91.9); } + } else if (getprop("/FMGC/internal/flex-set") == 1) { + setprop("/systems/thrust/lim-flex", 1); + setprop("/controls/engines/thrust-limit", "FLX"); + setprop("/controls/engines/epr-limit", 1.293); + setprop("/controls/engines/n1-limit", 97.7); } else { setprop("/controls/engines/thrust-limit", "TOGA"); setprop("/controls/engines/epr-limit", 1.308); @@ -157,6 +179,14 @@ var thrust_lim = func { } } +var unflex = func { + var state1 = getprop("/systems/thrust/state1"); + var state2 = getprop("/systems/thrust/state2"); + if (state1 != "MCT" and state2 != "MCT" and getprop("/gear/gear[1]/wow") == 0 and getprop("/gear/gear[2]/wow") == 0) { + setprop("/systems/thrust/lim-flex", 0); + } +} + var thrust_loop = func { var state1 = getprop("/systems/thrust/state1"); var state2 = getprop("/systems/thrust/state2");