From 921ce612cb7e0e43af970d2bea3c543cdecd6acd Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Fri, 16 Mar 2018 16:38:22 +0000 Subject: [PATCH] FG1000 PFD Navigation Status Box --- .../FG1000/MFDPages/SurroundPFD.svg | 1458 +++++++++++++++++ .../Nasal/Interfaces/GenericFMSPublisher.nas | 2 + .../Interfaces/GenericInterfaceController.nas | 2 +- .../PFDInstruments/PFDInstruments.nas | 3 +- .../Nasal/MFDPages/Surround/Surround.nas | 95 +- Aircraft/Instruments-3d/FG1000/Nasal/PFD.nas | 4 +- 6 files changed, 1530 insertions(+), 34 deletions(-) create mode 100644 Aircraft/Instruments-3d/FG1000/MFDPages/SurroundPFD.svg diff --git a/Aircraft/Instruments-3d/FG1000/MFDPages/SurroundPFD.svg b/Aircraft/Instruments-3d/FG1000/MFDPages/SurroundPFD.svg new file mode 100644 index 000000000..889ba216c --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/MFDPages/SurroundPFD.svg @@ -0,0 +1,1458 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + NAV2 + NAV1 + + COM2 + COM1 + + 123.456 + 123.456 + 123.456 + 123.456 + 123.45 + 123.45 + 123.45 + 123.45 + XXX + XXX + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SoftKey2 + + + SoftKey1 + + + SoftKey3 + + + SoftKey4 + + + SoftKey6 + + + SoftKey5 + + + SoftKey7 + + + SoftKey8 + + + SoftKey10 + + + SoftKey9 + + + SoftKey11 + + + SoftKey0 + + + + + + + DIS + BRG + 0 + FROM + TO + + 0 + D + + + + + + + + NEAREST NDB + NEAREST VOR + NEAREST USER WAYPOINTS + NEAREST FREQUENCIES + NEAREST AIRSPACES + NEAREST AIRPORTS + NEAREST INTERSECTIONS + + + + + TRIP PLANNING + UTILITY + GPS STATUS + XM RADIO + SYSTEM STATUS + + + + + CHECKLIST 1 + CHECKLIST 2 + CHECKLIST 3 + CHECKLIST 4 + CHECKLIST 5 + + + + + AIRPORT INFORMATION + INTERSECTION INFORMATION + NDB INFORMATION + VOR INFORMATION + USER WPT INFORMATION + + + + + NAVIGATION MAP + TRAFFIC MAP + STORMSCOPE + WEATHER DATA LINK + TAWS-B + + + + + ACTIVE FLIGHT PLAN + FLIGHT PLAN CATALOG + STORED FLIGHT PLAN + + MAP + WPT + AUX + FPL + LST + NRST + + diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericFMSPublisher.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericFMSPublisher.nas index ee10cbfc5..284bf291b 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericFMSPublisher.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericFMSPublisher.nas @@ -29,7 +29,9 @@ var GenericFMSPublisher = obj.addPropMap("FMSHeadingBug", "/autopilot/settings/heading-bug-deg"); obj.addPropMap("FMSSelectedAlt", "/autopilot/settings/target-alt-ft"); + obj.addPropMap("FMSMode", "/instrumentation/gps/mode"); obj.addPropMap("FMSLegValid", "/instrumentation/gps/wp/wp[1]/valid"); + obj.addPropMap("FMSPreviousLegID", "/instrumentation/gps/wp/wp[0]/ID"); obj.addPropMap("FMSLegID", "/instrumentation/gps/wp/wp[1]/ID"); obj.addPropMap("FMSLegBearingMagDeg", "/instrumentation/gps/wp/wp[1]/bearing-mag-deg"); obj.addPropMap("FMSLegDistanceNM", "/instrumentation/gps/wp/wp[1]/distance-nm"); diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericInterfaceController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericInterfaceController.nas index d19cbb82c..870442dbf 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericInterfaceController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericInterfaceController.nas @@ -17,12 +17,12 @@ # Generic Interface controller. var nasal_dir = getprop("/sim/fg-root") ~ "/Aircraft/Instruments-3d/FG1000/Nasal/"; +io.load_nasal(nasal_dir ~ 'Interfaces/NavDataInterface.nas', "fg1000"); io.load_nasal(nasal_dir ~ 'Interfaces/PropertyPublisher.nas', "fg1000"); io.load_nasal(nasal_dir ~ 'Interfaces/PropertyUpdater.nas', "fg1000"); io.load_nasal(nasal_dir ~ 'Interfaces/GenericEISPublisher.nas', "fg1000"); io.load_nasal(nasal_dir ~ 'Interfaces/GenericNavComPublisher.nas', "fg1000"); io.load_nasal(nasal_dir ~ 'Interfaces/GenericNavComUpdater.nas', "fg1000"); -io.load_nasal(nasal_dir ~ 'Interfaces/NavDataInterface.nas', "fg1000"); io.load_nasal(nasal_dir ~ 'Interfaces/GenericFMSPublisher.nas', "fg1000"); io.load_nasal(nasal_dir ~ 'Interfaces/GenericFMSUpdater.nas', "fg1000"); io.load_nasal(nasal_dir ~ 'Interfaces/GenericADCPublisher.nas', "fg1000"); diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/PFDInstruments/PFDInstruments.nas b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/PFDInstruments/PFDInstruments.nas index 3bc4e988a..6b12fd28d 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/PFDInstruments/PFDInstruments.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/PFDInstruments/PFDInstruments.nas @@ -247,8 +247,7 @@ var PFDInstruments = me.getController().offdisplay(); }, ondisplay : func() { - me._group.setVisible(1); - me.mfd.setPageTitle(me.title); + me._group.setVisible(1); me.getController().ondisplay(); }, diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/Surround/Surround.nas b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/Surround/Surround.nas index db01e4ea4..5119664c3 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/Surround/Surround.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/Surround/Surround.nas @@ -77,27 +77,36 @@ var HEADER_MAPPING = { var Surround = { - new : func (mfd, myCanvas, device, svg) + new : func (mfd, myCanvas, device, svg, pfd=0) { var obj = { parents : [ Surround, MFDPage.new(mfd, myCanvas, device, svg, "Surround", ""), ] }; + obj.pfd = pfd; + var textElements = [ "Comm1StandbyFreq", "Comm1SelectedFreq", "Comm2StandbyFreq", "Comm2SelectedFreq", "Nav1StandbyFreq", "Nav1SelectedFreq", "Nav2StandbyFreq", "Nav2SelectedFreq", "Nav1ID", "Nav2ID", - "Header1Label", "Header1Value", - "Header2Label", "Header2Value", - "Header3Label", "Header3Value", - "Header4Label", "Header4Value", ]; obj.addTextElements(textElements); + if (pfd) { + obj.addTextElements(["HeaderFrom", "HeaderTo", "LegDistance", "LegBRG"]); + obj._dto = PFD.HighlightElement.new(obj.pageName, svg, "HeaderDTO", "DTO"); + obj._leg = PFD.HighlightElement.new(obj.pageName, svg, "HeaderActiveLeg", "Leg"); + } else { + obj.addTextElements(["Header1Label", "Header1Value", + "Header2Label", "Header2Value", + "Header3Label", "Header3Value", + "Header4Label", "Header4Value"]); + } + obj._comm1selected = PFD.HighlightElement.new(obj.pageName, svg, "Comm1Selected", "Comm1"); obj._comm2selected = PFD.HighlightElement.new(obj.pageName, svg, "Comm2Selected", "Comm2"); @@ -222,35 +231,63 @@ var Surround = # Update Header data with FMS or ADC data. updateHeaderData : func(data) { - var headers = ["Header1", "Header2", "Header3", "Header4"]; - foreach (var header; headers) { - # Get the currently configured heading and set the surround to display it. - var label = me.mfd.ConfigStore.get("MFD" ~ header); - assert(label != nil, "No header configured in ConfigStore for " ~ header); - me.setTextElement(header ~ "Label", label); + if (me.pfd) { + # From, To, leg distance and leg bearing headers + if (data["FMSLegID"]) { + if (data["FMSLegID"] == "") { + # No Leg, so hide the headers + me.setTextElement("HeaderTo", ""); + me.setTextElement("HeaderFrom", ""); + me._dto.setVisible(0); + me._leg.setVisible(0); + } else { + me.setTextElement("HeaderTo", data["FMSLegID"]); + me._leg.setVisible(1); - # Determine how it maps to Emesary data notifications - var mapping = HEADER_MAPPING[label]; - assert(mapping != nil, "No header mapping for " ~ label); - - if (data[mapping.message] != nil) { - # Format and display the value - var value = sprintf(mapping.format, data[mapping.message]); - - if (mapping.message == "FMSEstimatedTimeEnroute") { - # Special case to format time strings. - var hrs = int(data[mapping.message]); - var mins = int(60*(data[mapping.message] - hrs)); - var secs = int(3600*(data[mapping.message] - hrs - mins/60)); - - if (hrs == 0) { - value = sprintf("%d:%02d", mins, secs); + if (data["FMSMode"] == "dto") { + me.setTextElement("HeaderFrom", ""); + me._dto.setVisible(1); } else { - value = sprintf("%d:%02d", hrs, mins); + me._dto.setVisible(0); } } - me.setTextElement(header ~ "Value", value); + } + + if (data["FMSLegDesiredTrack"]) me.setTextElement("LegBRG", sprintf("%i°", data["FMSLegDesiredTrack"])); + if (data["FMSLegDistanceNM"]) me.setTextElement("LegDistance", sprintf("%.1fnm", data["FMSLegDistanceNM"])); + } else { + # MFD - 4 configurable Headers + var headers = ["Header1", "Header2", "Header3", "Header4"]; + foreach (var header; headers) { + + # Get the currently configured heading and set the surround to display it. + var label = me.mfd.ConfigStore.get("MFD" ~ header); + assert(label != nil, "No header configured in ConfigStore for " ~ header); + me.setTextElement(header ~ "Label", label); + + # Determine how it maps to Emesary data notifications + var mapping = HEADER_MAPPING[label]; + assert(mapping != nil, "No header mapping for " ~ label); + + if (data[mapping.message] != nil) { + # Format and display the value + var value = sprintf(mapping.format, data[mapping.message]); + + if (mapping.message == "FMSEstimatedTimeEnroute") { + # Special case to format time strings. + var hrs = int(data[mapping.message]); + var mins = int(60*(data[mapping.message] - hrs)); + var secs = int(3600*(data[mapping.message] - hrs - mins/60)); + + if (hrs == 0) { + value = sprintf("%d:%02d", mins, secs); + } else { + value = sprintf("%d:%02d", hrs, mins); + } + } + me.setTextElement(header ~ "Value", value); + } } } }, diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/PFD.nas b/Aircraft/Instruments-3d/FG1000/Nasal/PFD.nas index b121c2c84..5326e1020 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/PFD.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/PFD.nas @@ -58,7 +58,7 @@ var PFDDisplay = {'font-mapper': fontmapper}); canvas.parsesvg(obj._svg, - '/Aircraft/Instruments-3d/FG1000/MFDPages/Surround.svg', + '/Aircraft/Instruments-3d/FG1000/MFDPages/SurroundPFD.svg', {'font-mapper': fontmapper}); obj._MFDDevice = canvas.PFD_Device.new(obj._svg, 12, "SoftKey", myCanvas, "PFD"); @@ -70,7 +70,7 @@ var PFDDisplay = # Controller for the header and display on the bottom left which allows selection # of page groups and individual pages using the FMS controller. - obj.Surround = fg1000.Surround.new(obj, myCanvas, obj._MFDDevice, obj._svg); + obj.Surround = fg1000.Surround.new(obj, myCanvas, obj._MFDDevice, obj._svg, 1); obj.SurroundController = obj.Surround.getController(); # Engine Information System. A special case as it's always displayed on the MFD.