From 715d9300ac65fc5c1ab6b5eee1757bb8ebba3fea Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Sat, 7 Apr 2018 13:22:01 +0100 Subject: [PATCH] FG1000 - Cessna 182T EIS --- .../FG1000/MFDPages/EIS-C182T.svg | 928 ++++++++++++++++++ .../FG1000/Nasal/EIS/EIS-C182T.nas | 135 +++ .../FG1000/Nasal/EIS/EISController.nas | 1 + .../Instruments-3d/FG1000/Nasal/FG1000.nas | 4 +- .../Nasal/Interfaces/GenericEISPublisher.nas | 1 + 5 files changed, 1067 insertions(+), 2 deletions(-) create mode 100644 Aircraft/Instruments-3d/FG1000/MFDPages/EIS-C182T.svg create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/EIS/EIS-C182T.nas diff --git a/Aircraft/Instruments-3d/FG1000/MFDPages/EIS-C182T.svg b/Aircraft/Instruments-3d/FG1000/MFDPages/EIS-C182T.svg new file mode 100644 index 000000000..3967c63fe --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/MFDPages/EIS-C182T.svg @@ -0,0 +1,928 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + 0 + 2700 + 2200 + RPM + + + + + + + + + + + + + + + + + + + FFLOW GPH + 0 + 22 + + + + + + + + OIL PRES + + + + + + + + + + OIL TEMP + + + + + + + + + + + + + + + + + EGT + + 1 + + + + + + + + + + + + FUEL QTY GAL + 0 + F + + + + + R + + 10 + 30 + + + L + + ELECTRICAL + + + M + BUS + E + 32.0 + VOLTS + 32.0 + M + BATT + S + +110 + AMPS + +110 + 20 + + + + + + + + + + + + + + + + + + + + + + + + + + + + MAN IN + 20.7 + 35 + 10 + + + + diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/EIS/EIS-C182T.nas b/Aircraft/Instruments-3d/FG1000/Nasal/EIS/EIS-C182T.nas new file mode 100644 index 000000000..6c4715597 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/EIS/EIS-C182T.nas @@ -0,0 +1,135 @@ +# Copyright 2018 Stuart Buchanan +# This file is part of FlightGear. +# +# Foobar is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# FlightGear is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with FlightGear. If not, see . +# +# EIS +var EIS = +{ + new : func (mfd, myCanvas, device, svg) + { + var obj = { + parents : [ + EIS, + MFDPage.new(mfd, myCanvas, device, svg, "EIS", "") + ], + }; + + obj.setController(fg1000.EISController.new(obj, svg)); + + obj.addTextElements(["ManDisplay", "RPMDisplay", "MBusVolts", "EBusVolts"]); + + obj._fuelFlowPointer = PFD.PointerElement.new(obj.pageName, svg, "FuelFlowPointer", 0.0, 22.0, 135); + obj._oilPressurePointer = PFD.PointerElement.new(obj.pageName, svg, "OilPressurePointer", 0.0, 115.0, 135); + obj._oilTempPointer = PFD.PointerElement.new(obj.pageName, svg, "OilTempPointer", 0.0, 245.0, 135); + obj._EGTPointer = PFD.PointerElement.new(obj.pageName, svg, "EGTPointer", 0.0, 1.0, 135); + obj._EGTCylinder = PFD.PointerElement.new(obj.pageName, svg, "EGTCylinder", 0.0, 1.0, 135); + obj._leftFuelPointer = PFD.PointerElement.new(obj.pageName, svg, "LeftFuelPointer", 0.0, 40.0, 135); + obj._rightFuelPointer = PFD.PointerElement.new(obj.pageName, svg, "RightFuelPointer", 0.0, 40.0, 135); + + obj._RPMPointer = PFD.RotatingElement.new(obj.pageName, svg, "RPMPointer", 0.0, 2700.0, 250.0, [150,100]); + obj._ManPointer = PFD.RotatingElement.new(obj.pageName, svg, "ManPointer", 10.0, 35.0, 250.0, [150,200]); + + return obj; + }, + + updateData : func(engineData) { + me.setTextElement("RPMDisplay", sprintf("%i", engineData.RPM)); + me.setTextElement("ManDisplay", sprintf("%.1f", engineData.Man)); + me.setTextElement("MBusVolts", sprintf("%.01f", engineData.MBusVolts)); + me.setTextElement("EBusVolts", sprintf("%.01f", engineData.MBusVolts)); # TODO: Include Emergency Bus + + me._fuelFlowPointer.setValue(engineData.FuelFlowGPH); + me._oilPressurePointer.setValue(engineData.OilPressurePSI); + me._oilTempPointer.setValue(engineData.OilTemperatureF); + me._EGTPointer.setValue(engineData.EGTNorm); + me._EGTCylinder.setValue(engineData.EGTNorm); + me._leftFuelPointer.setValue(engineData.LeftFuelUSGal); + me._rightFuelPointer.setValue(engineData.RightFuelUSGal); + + me._RPMPointer.setValue(engineData.RPM); + me._ManPointer.setValue(engineData.Man); + }, + + # Menu tree . engineMenu is referenced from most pages as softkey 0: + # pg.addMenuItem(0, "ENGINE", pg, pg.mfd.EISPage.engineMenu); + + engineMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + pg.addMenuItem(0, "ENGINE", pg, pg.mfd.EIS.engineMenu); + pg.addMenuItem(1, "LEAN", pg, pg.mfd.EIS.leanMenu); + pg.addMenuItem(2, "SYSTEM", pg, pg.mfd.EIS.systemMenu); + pg.addMenuItem(8, "BACK", pg, pg.topMenu); + device.updateMenus(); + }, + + leanMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + pg.addMenuItem(0, "ENGINE", pg, pg.mfd.EIS.engineMenu); + pg.addMenuItem(1, "LEAN", pg, pg.mfd.EIS.leanMenu); + pg.addMenuItem(2, "SYSTEM", pg, pg.mfd.EIS.systemMenu); + pg.addMenuItem(3, "CYL SELECT", pg); + pg.addMenuItem(4, "ASSIST", pg); + pg.addMenuItem(9, "BACK", pg, pg.mfd.EIS.engineMenu); + device.updateMenus(); + }, + + systemMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + pg.addMenuItem(0, "ENGINE", pg, pg.mfd.EIS.engineMenu); + pg.addMenuItem(1, "LEAN", pg, pg.mfd.EIS.leanMenu); + pg.addMenuItem(2, "SYSTEM", pg, pg.mfd.EIS.systemMenu); + pg.addMenuItem(3, "RST FUEL", pg); + pg.addMenuItem(4, "GAL REM", pg, pg.mfd.EIS.galRemMenu); + pg.addMenuItem(5, "BACK", pg, pg.mfd.EIS.engineMenu); + device.updateMenus(); + }, + + galRemMenu : func(device, pg, menuitem) { + pg.clearMenu(); + pg.resetMenuColors(); + pg.addMenuItem(0, "ENGINE", pg, pg.mfd.EIS.engineMenu); + pg.addMenuItem(1, "LEAN", pg, pg.mfd.EIS.leanMenu); + pg.addMenuItem(2, "SYSTEM", pg, pg.mfd.EIS.systemMenu); + pg.addMenuItem(3, "-10 GAL", pg); + pg.addMenuItem(4, "-1 GAL", pg); + pg.addMenuItem(5, "+1 GAL", pg); + pg.addMenuItem(6, "+10 GAL", pg); + pg.addMenuItem(7, "44 GAL", pg); + pg.addMenuItem(8, "BACK", pg, pg.mfd.EIS.engineMenu); + device.updateMenus(); + }, + + offdisplay : func() { + me._group.setVisible(0); + + # Reset the menu colours. Shouldn't have to do this here, but + # there's not currently an obvious other location to do so. + for(var i = 0; i < 12; i +=1) { + var name = sprintf("SoftKey%d",i); + me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); + me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); + } + me.getController().offdisplay(); + }, + ondisplay : func() { + me._group.setVisible(1); + me.getController().ondisplay(); + }, + + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/EIS/EISController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/EIS/EISController.nas index f34cb47b4..f867c4d59 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/EIS/EISController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/EIS/EISController.nas @@ -39,6 +39,7 @@ var EISController = # Sanitize data var elements = [ "RPM", + "Man", "MBusVolts", "EngineHours", "FuelFlowGPH", diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/FG1000.nas b/Aircraft/Instruments-3d/FG1000/Nasal/FG1000.nas index 650f82a0c..6b60778be 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/FG1000.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/FG1000.nas @@ -55,7 +55,7 @@ new : func(EIS_Class = nil, EIS_SVG = nil) { if (EIS_Class == nil) { # Load the default EIS class. var nasal_dir = getprop("/sim/fg-root") ~ "/Aircraft/Instruments-3d/FG1000/Nasal/"; - io.load_nasal(nasal_dir ~ '/EIS/EIS.nas', "fg1000"); + io.load_nasal(nasal_dir ~ '/EIS/EIS-C182T.nas', "fg1000"); io.load_nasal(nasal_dir ~ '/EIS/EISController.nas', "fg1000"); io.load_nasal(nasal_dir ~ '/EIS/EISStyles.nas', "fg1000"); io.load_nasal(nasal_dir ~ '/EIS/EISOptions.nas', "fg1000"); @@ -65,7 +65,7 @@ new : func(EIS_Class = nil, EIS_SVG = nil) { } if (EIS_SVG == nil) { - obj.EIS_SVG = "/Aircraft/Instruments-3d/FG1000/MFDPages/EIS.svg"; + obj.EIS_SVG = "/Aircraft/Instruments-3d/FG1000/MFDPages/EIS-C182T.svg"; } else { obj.EIS_SVG = EIS_SVG; } diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericEISPublisher.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericEISPublisher.nas index 0315ed8a9..e3b8e7543 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericEISPublisher.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericEISPublisher.nas @@ -30,6 +30,7 @@ var GenericEISPublisher = if (getprop("/engines/engine[0]/hours") == nil) setprop("/engines/engine[0]/hours", 157.0); obj.addPropMap("RPM", "/engines/engine[0]/rpm"); + obj.addPropMap("Man", "/engines/engine[0]/mp-osi"); obj.addPropMap("MBusVolts", "/systems/electrical/volts"); obj.addPropMap("EngineHours", "/engines/engine[0]/hours"); obj.addPropMap("FuelFlowGPH", "/engines/engine[0]/fuel-flow-gph");