From 8b8dd55653c7c2acd5d792da1f850d24b68e622c Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Mon, 10 Jan 2022 16:48:10 +0000 Subject: [PATCH] final fix --- Nasal/FMGC/FMGC-c.nas | 45 ++++++++++++------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/Nasal/FMGC/FMGC-c.nas b/Nasal/FMGC/FMGC-c.nas index 4c47271b..0e60160d 100644 --- a/Nasal/FMGC/FMGC-c.nas +++ b/Nasal/FMGC/FMGC-c.nas @@ -56,6 +56,7 @@ var Modes = { }; var setFmaText = func(node, value, callback, timerNode) { + if (Modes.PFD.FMA[node] == value) { return; } Modes.PFD.FMA[node] = value; call(callback, [node, timerNode]); }; @@ -138,58 +139,36 @@ var loopFMA = maketimer(0.05, func() { engout = systems.FADEC.engOut.getValue(); if (state1 == "TOGA" or state2 == "TOGA") { - if (fmgc.Modes.PFD.FMA.throttleMode != " ") { - setFmaText("throttleMode", " ", throttleModeCallback, "throttleModeTime"); - } + setFmaText("throttleMode", " ", throttleModeCallback, "throttleModeTime"); } else if ((state1 == "MAN THR" and systems.FADEC.manThrAboveMct[0]) or (state2 == "MAN THR" and systems.FADEC.manThrAboveMct[1])) { - if (fmgc.Modes.PFD.FMA.throttleMode != " ") { - setFmaText("throttleMode", " ", throttleModeCallback, "throttleModeTime"); - } + setFmaText("throttleMode", " ", throttleModeCallback, "throttleModeTime"); } else if ((state1 == "MCT" or state2 == "MCT") and !engout) { - if (fmgc.Modes.PFD.FMA.throttleMode != " ") { - setFmaText("throttleMode", " ", throttleModeCallback, "throttleModeTime"); - } + setFmaText("throttleMode", " ", throttleModeCallback, "throttleModeTime"); } else if (((state1 == "MAN THR" and !systems.FADEC.manThrAboveMct[0]) or (state2 == "MAN THR" and !systems.FADEC.manThrAboveMct[1])) and !engout) { - if (fmgc.Modes.PFD.FMA.throttleMode != " ") { - setFmaText("throttleMode", " ", throttleModeCallback, "throttleModeTime"); - } + setFmaText("throttleMode", " ", throttleModeCallback, "throttleModeTime"); } else { vert = Output.vert.getValue(); if (vert == 4 or vert >= 6 or vert <= 8) { if (Output.ap1.getBoolValue() or Output.ap2.getBoolValue() or Output.fd1.getBoolValue() or Output.fd2.getBoolValue()) { thr = Output.thrMode.getValue(); if (thr == 0) { - if (fmgc.Modes.PFD.FMA.throttleMode != Input.ktsMach.getValue() ? "MACH" : "SPEED") { - setFmaText("throttleMode", Input.ktsMach.getValue() ? "MACH" : "SPEED", throttleModeCallback, "throttleModeTime"); - } + setFmaText("throttleMode", Input.ktsMach.getValue() ? "MACH" : "SPEED", throttleModeCallback, "throttleModeTime"); } else if (thr == 1) { - if (fmgc.Modes.PFD.FMA.throttleMode != "THR IDLE") { - setFmaText("throttleMode", "THR IDLE", throttleModeCallback, "throttleModeTime"); - } + setFmaText("throttleMode", "THR IDLE", throttleModeCallback, "throttleModeTime"); } else if (thr == 2) { if (state1 == "MCT" or state2 == "MCT" and engout) { - if (fmgc.Modes.PFD.FMA.throttleMode != "THR MCT") { - setFmaText("throttleMode", "THR MCT", throttleModeCallback, "throttleModeTime"); - } + setFmaText("throttleMode", "THR MCT", throttleModeCallback, "throttleModeTime"); } else if (state1 == "CL" or state2 == "CL") { - if (fmgc.Modes.PFD.FMA.throttleMode != "THR CLB") { - setFmaText("throttleMode", "THR CLB", throttleModeCallback, "throttleModeTime"); - } + setFmaText("throttleMode", "THR CLB", throttleModeCallback, "throttleModeTime"); } else { - if (fmgc.Modes.PFD.FMA.throttleMode != "THR LVR") { - setFmaText("throttleMode", "THR LVR", throttleModeCallback, "throttleModeTime"); - } + setFmaText("throttleMode", "THR LVR", throttleModeCallback, "throttleModeTime"); } } } else { - if (fmgc.Modes.PFD.FMA.throttleMode != Input.ktsMach.getValue() ? "MACH" : "SPEED") { - setFmaText("throttleMode", Input.ktsMach.getValue() ? "MACH" : "SPEED", throttleModeCallback, "throttleModeTime"); - } - } - } else { - if (fmgc.Modes.PFD.FMA.throttleMode != Input.ktsMach.getValue() ? "MACH" : "SPEED") { setFmaText("throttleMode", Input.ktsMach.getValue() ? "MACH" : "SPEED", throttleModeCallback, "throttleModeTime"); } + } else { + setFmaText("throttleMode", Input.ktsMach.getValue() ? "MACH" : "SPEED", throttleModeCallback, "throttleModeTime"); } }