From 4327f3dcc95f5c04b6a3ee6c0718eaf1a4e918f5 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Mon, 11 Feb 2019 12:21:53 +0000 Subject: [PATCH] Config warnings --- Nasal/ECAM/ECAM-logic.nas | 58 ++++++++++++++++++++++++++++++++++++ Nasal/ECAM/ECAM-messages.nas | 15 ++++++++++ 2 files changed, 73 insertions(+) diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 2d4fb90e..6dba9943 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -11,6 +11,64 @@ var messages_priority_3 = func { flap_not_zero.noRepeat = 0; } + # CONFIG + if ((getprop("/controls/flight/flap-lever") == 0 or getprop("/controls/flight/flap-lever")) == 4 and getprop("/ECAM/warning-phase") >= 3 and getprop("/ECAM/warning-phase") <= 4) { + slats_config.active = 1; + slats_config_1.active = 1; + } else { + slats_config.active = 0; + slats_config.noRepeat = 0; + slats_config_1.active = 0; + slats_config_1.noRepeat = 0; + } + + if ((getprop("/controls/flight/flap-lever") == 0 or getprop("/controls/flight/flap-lever") == 4) and getprop("/ECAM/warning-phase") >= 3 and getprop("/ECAM/warning-phase") <= 4) { + flaps_config.active = 1; + flaps_config_1.active = 1; + } else { + flaps_config.active = 0; + flaps_config.noRepeat = 0; + flaps_config_1.active = 0; + flaps_config_1.noRepeat = 0; + } + + if (getprop("/controls/flight/speedbrake") != 0 and getprop("/ECAM/warning-phase") >= 3 and getprop("/ECAM/warning-phase") <= 4) { + spd_brk_config.active = 1; + spd_brk_config_1.active = 1; + } else { + spd_brk_config.active = 0; + spd_brk_config.noRepeat = 0; + spd_brk_config_1.active = 0; + spd_brk_config_1.noRepeat = 0; + } + + if ((getprop("/fdm/jsbsim/hydraulics/elevator-trim/final-deg") > 1.75 or getprop("/fdm/jsbsim/hydraulics/elevator-trim/final-deg") < -3.65) and getprop("/ECAM/warning-phase") >= 3 and getprop("/ECAM/warning-phase") <= 4) { + pitch_trim_config.active = 1; + pitch_trim_config_1.active = 1; + } else { + pitch_trim_config.active = 0; + pitch_trim_config.noRepeat = 0; + pitch_trim_config_1.active = 0; + pitch_trim_config_1.noRepeat = 0; + } + + if ((getprop("/fdm/jsbsim/hydraulics/rudder/trim-cmd-deg") < -3.55 or getprop("/fdm/jsbsim/hydraulics/rudder/trim-cmd-deg") > 3.55) and getprop("/ECAM/warning-phase") >= 3 and getprop("/ECAM/warning-phase") <= 4) { + rud_trim_config.active = 1; + rud_trim_config_1.active = 1; + } else { + rud_trim_config.active = 0; + rud_trim_config.noRepeat = 0; + rud_trim_config_1.active = 0; + rud_trim_config_1.noRepeat = 0; + } + + if (getprop("/controls/gear/brake-parking") == 1 and getprop("/ECAM/warning-phase") >= 3 and getprop("/ECAM/warning-phase") <= 4) { + park_brk_config.active = 1; + } else { + park_brk_config.active = 0; + park_brk_config.noRepeat = 0; + } + # AUTOFLT if (getprop("/it-autoflight/output/ap-warning") == 2) { ap_offw.active = 1; diff --git a/Nasal/ECAM/ECAM-messages.nas b/Nasal/ECAM/ECAM-messages.nas index b3b4375b..bf2a081f 100644 --- a/Nasal/ECAM/ECAM-messages.nas +++ b/Nasal/ECAM/ECAM-messages.nas @@ -16,6 +16,21 @@ var warningsOld = std.Vector.new([ var warnings = std.Vector.new([ var flap_not_zero = warning.new(msg: "F/CTL FLAP LVR NOT ZERO", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0), + + # Config + var slats_config = warning.new(msg: "CONFIG", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0), + var slats_config_1 = warning.new(msg: "SLATS NOT IN T.O. CONFIG", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0), + var flaps_config = warning.new(msg: "CONFIG", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0), + var flaps_config_1 = warning.new(msg: "FLAPS NOT IN T.O. CONFIG", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0), + var spd_brk_config = warning.new(msg: "CONFIG", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0), + var spd_brk_config_1 = warning.new(msg: "SPD BRK NOT RETRACTED", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0), + var pitch_trim_config = warning.new(msg: "CONFIG PITCH TRIM", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0), + var pitch_trim_config_1 = warning.new(msg: " NOT IN T.O. RANGE", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0), + var rud_trim_config = warning.new(msg: "CONFIG RUD TRIM", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0), + var rud_trim_config_1 = warning.new(msg: " NOT IN T.O. RANGE", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0), + var park_brk_config = warning.new(msg: "CONFIG PARK BRK ON", active: 0, colour: "r", aural: "crc", light: "warning", noRepeat: 0), + + # Autopilot var ap_offw = warning.new(msg: "AUTO FLT AP OFF", active: 0, colour: "r", aural: "calv", light: "warning", noRepeat: 0), var athr_offw = warning.new(msg: "AUTO FLT A/THR OFF", active: 0, colour: "a", aural: "chime", light: "caution", noRepeat: 0), var athr_offw_1 = warning.new(msg: "-THR LEVERS........MOVE", active: 0, colour: "b", aural: "none", light: "none", noRepeat: 0),