From bdbb9a1718af8f67638425f4a63814890555d731 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Tue, 24 Oct 2017 22:38:24 -0400 Subject: [PATCH] A3XX: FMGC: Much less buggy mode boxing --- Models/Tablet/res/screen.png | Bin 0 -> 629 bytes Nasal/PFD_FMA.nas | 107 ++++++++++++++++++++++------------- revision.txt | 2 +- 3 files changed, 68 insertions(+), 41 deletions(-) create mode 100644 Models/Tablet/res/screen.png diff --git a/Models/Tablet/res/screen.png b/Models/Tablet/res/screen.png new file mode 100644 index 0000000000000000000000000000000000000000..159304c1cae72c1e6657dc449b1bae5872e8c3c0 GIT binary patch literal 629 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G!U;i$lZxy-8q?;Kn`1yx4R3& ze-K=-cll(X2xoyuWHAE+w=f7ZGR&GI!N9=8;pyTSQgQ3;t&3cT6hs&<=>Ga2zpb6a zDd+O;%ys7)swdWZ>?PtzcTl&#nON8|JvDF z|I)iyzI^^}fi3z%6FsA5Pe_`h!@_*GWkId@sq&M1YG3Y;yLwV*_p8@)Ki`)$bYuN+ z)pfz~lpZ<$zCQEdq_2I3S`CV#jwRve)&Jg{diY+&e!1ijhUu1{>%3ZKE%DXNRlCq} zM88*YWhld(ihJ_4`y03#guU-vOUcgMAIj=-EbLG;!;3j86PNU;ZQ?eUVcZv?*1zw| z@8c4SnIw!9`&Dw^x~$(Ba{Bg}0!a(!o{bDVw|l*Et831NRfWC1X*cVK?tJ<0zd|Ir s4{S;QvAWOjvtRaecKQV@E}MSD@+YlZq3e0rQ~{*K)78&qol`;+0P!cG`v3p{ literal 0 HcmV?d00001 diff --git a/Nasal/PFD_FMA.nas b/Nasal/PFD_FMA.nas index fe74638c..4fde9c80 100644 --- a/Nasal/PFD_FMA.nas +++ b/Nasal/PFD_FMA.nas @@ -25,6 +25,15 @@ setprop("/modes/pfd/fma/roll-mode-armed-box", 0); setprop("/modes/pfd/fma/ap-mode-box", 0); setprop("/modes/pfd/fma/fd-mode-box", 0); setprop("/modes/pfd/fma/athr-mode-box", 0); +setprop("/modes/pfd/fma/throttle-mode-time", 0); +setprop("/modes/pfd/fma/pitch-mode-time", 0); +setprop("/modes/pfd/fma/pitch-mode-armed-time", 0); +setprop("/modes/pfd/fma/pitch-mode2-armed-time", 0); +setprop("/modes/pfd/fma/roll-mode-time", 0); +setprop("/modes/pfd/fma/roll-mode-armed-time", 0); +setprop("/modes/pfd/fma/ap-mode-time", 0); +setprop("/modes/pfd/fma/fd-mode-time", 0); +setprop("/modes/pfd/fma/athr-mode-time", 0); setlistener("sim/signals/fdm-initialized", func { loopFMA.start(); @@ -115,6 +124,54 @@ var loopFMA = maketimer(0.05, func { setprop("/modes/pfd/fma/roll-mode", "TRACK"); } } + + # Boxes + var boxtime = getprop("/sim/time/elapsed-sec"); + if (getprop("/modes/pfd/fma/ap-mode-time") + 10 >= boxtime) { + setprop("/modes/pfd/fma/ap-mode-box", 1); + } else { + setprop("/modes/pfd/fma/ap-mode-box", 0); + } + if (getprop("/modes/pfd/fma/fd-mode-time") + 10 >= boxtime) { + setprop("/modes/pfd/fma/fd-mode-box", 1); + } else { + setprop("/modes/pfd/fma/fd-mode-box", 0); + } + if (getprop("/modes/pfd/fma/athr-mode-time") + 10 >= boxtime) { + setprop("/modes/pfd/fma/athr-mode-box", 1); + } else { + setprop("/modes/pfd/fma/athr-mode-box", 0); + } + if (getprop("/modes/pfd/fma/throttle-mode-time") + 10 >= boxtime) { + setprop("/modes/pfd/fma/throttle-mode-box", 1); + } else { + setprop("/modes/pfd/fma/throttle-mode-box", 0); + } + if (getprop("/modes/pfd/fma/roll-mode-time") + 10 >= boxtime) { + setprop("/modes/pfd/fma/roll-mode-box", 1); + } else { + setprop("/modes/pfd/fma/roll-mode-box", 0); + } + if (getprop("/modes/pfd/fma/pitch-mode-time") + 10 >= boxtime) { + setprop("/modes/pfd/fma/pitch-mode-box", 1); + } else { + setprop("/modes/pfd/fma/pitch-mode-box", 0); + } + if (getprop("/modes/pfd/fma/roll-mode-armed-time") + 10 >= boxtime) { + setprop("/modes/pfd/fma/roll-mode-armed-box", 1); + } else { + setprop("/modes/pfd/fma/roll-mode-armed-box", 0); + } + if (getprop("/modes/pfd/fma/pitch-mode-armed-time") + 10 >= boxtime) { + setprop("/modes/pfd/fma/pitch-mode-armed-box", 1); + } else { + setprop("/modes/pfd/fma/pitch-mode-armed-box", 0); + } + if (getprop("/modes/pfd/fma/pitch-mode2-armed-time") + 10 >= boxtime) { + setprop("/modes/pfd/fma/pitch-mode2-armed-box", 1); + } else { + setprop("/modes/pfd/fma/pitch-mode2-armed-box", 0); + } }); var loopFMA_b = func { @@ -527,32 +584,20 @@ setlistener("/it-autoflight/output/athr", func { # Boxes setlistener("/modes/pfd/fma/ap-mode", func { if (getprop("/modes/pfd/fma/ap-mode") != " ") { - setprop("/modes/pfd/fma/ap-mode-box", 1); - settimer(func { - setprop("/modes/pfd/fma/ap-mode-box", 0); - }, 10); + setprop("/modes/pfd/fma/ap-mode-time", getprop("/sim/time/elapsed-sec")); } }); setlistener("/modes/pfd/fma/fd-mode", func { if (getprop("/modes/pfd/fma/fd-mode") != " ") { - setprop("/modes/pfd/fma/fd-mode-box", 1); - settimer(func { - setprop("/modes/pfd/fma/fd-mode-box", 0); - }, 10); + setprop("/modes/pfd/fma/fd-mode-time", getprop("/sim/time/elapsed-sec")); } }); setlistener("/modes/pfd/fma/at-mode", func { if (getprop("/modes/pfd/fma/at-mode") != " ") { - setprop("/modes/pfd/fma/throttle-mode-box", 1); - settimer(func { - setprop("/modes/pfd/fma/throttle-mode-box", 0); - }, 5); - setprop("/modes/pfd/fma/athr-mode-box", 1); - settimer(func { - setprop("/modes/pfd/fma/athr-mode-box", 0); - }, 10); + setprop("/modes/pfd/fma/throttle-mode-time", getprop("/sim/time/elapsed-sec")); + setprop("/modes/pfd/fma/athr-mode-time", getprop("/sim/time/elapsed-sec")); } }); @@ -560,59 +605,41 @@ setlistener("/modes/pfd/fma/throttle-mode", func { var state1 = getprop("/systems/thrust/state1"); var state2 = getprop("/systems/thrust/state2"); if (getprop("/it-autoflight/output/athr") == 1 and state1 != "MCT" and state2 != "MCT" and state1 != "MAN THR" and state2 != "MAN THR" and state1 != "TOGA" and state2 != "TOGA" and state1 != "IDLE" and state2 != "IDLE") { - setprop("/modes/pfd/fma/throttle-mode-box", 1); - settimer(func { - setprop("/modes/pfd/fma/throttle-mode-box", 0); - }, 10); + setprop("/modes/pfd/fma/throttle-mode-time", getprop("/sim/time/elapsed-sec")); } }); setlistener("/modes/pfd/fma/roll-mode", func { var newlat = getprop("/modes/pfd/fma/roll-mode"); if (newlat != " ") { - setprop("/modes/pfd/fma/roll-mode-box", 1); - settimer(func { - setprop("/modes/pfd/fma/roll-mode-box", 0); - }, 10); + setprop("/modes/pfd/fma/roll-mode-time", getprop("/sim/time/elapsed-sec")); } }); setlistener("/modes/pfd/fma/pitch-mode", func { var newvert = getprop("/modes/pfd/fma/pitch-mode"); if (newvert != " ") { - setprop("/modes/pfd/fma/pitch-mode-box", 1); - settimer(func { - setprop("/modes/pfd/fma/pitch-mode-box", 0); - }, 10); + setprop("/modes/pfd/fma/pitch-mode-time", getprop("/sim/time/elapsed-sec")); } }); setlistener("/modes/pfd/fma/roll-mode-armed", func { var newarm = getprop("/modes/pfd/fma/roll-mode-armed"); if (newarm != " ") { - setprop("/modes/pfd/fma/roll-mode-armed-box", 1); - settimer(func { - setprop("/modes/pfd/fma/roll-mode-armed-box", 0); - }, 10); + setprop("/modes/pfd/fma/roll-mode-armed-time", getprop("/sim/time/elapsed-sec")); } }); setlistener("/modes/pfd/fma/pitch-mode-armed", func { var newarm = getprop("/modes/pfd/fma/pitch-mode-armed"); if (newarm != " ") { - setprop("/modes/pfd/fma/pitch-mode-armed-box", 1); - settimer(func { - setprop("/modes/pfd/fma/pitch-mode-armed-box", 0); - }, 10); + setprop("/modes/pfd/fma/pitch-mode-armed-time", getprop("/sim/time/elapsed-sec")); } }); setlistener("/modes/pfd/fma/pitch-mode2-armed", func { var newarm = getprop("/modes/pfd/fma/pitch-mode2-armed"); if (newarm != " ") { - setprop("/modes/pfd/fma/pitch-mode2-armed-box", 1); - settimer(func { - setprop("/modes/pfd/fma/pitch-mode2-armed-box", 0); - }, 10); + setprop("/modes/pfd/fma/pitch-mode2-armed-time", getprop("/sim/time/elapsed-sec")); } }); diff --git a/revision.txt b/revision.txt index 8fae38dc..eca76627 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -3008 \ No newline at end of file +3009 \ No newline at end of file