1
0
Fork 0

FG1000 PFD Navigation Status Box

This commit is contained in:
Stuart Buchanan 2018-03-16 16:38:22 +00:00
parent 7b526adb69
commit 921ce612cb
6 changed files with 1530 additions and 34 deletions

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 77 KiB

View file

@ -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");

View file

@ -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");

View file

@ -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();
},

View file

@ -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);
}
}
}
},

View file

@ -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.