diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfo.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfo.nas index 090e3c663..e3427a5f9 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfo.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfo.nas @@ -167,6 +167,19 @@ var AirportInfo = } } + # Add any ILS frequencies as well + foreach(var rwy; sort(keys(apt_info.runways), string.icmp)) { + var rwy_info = apt_info.runways[rwy]; + if (rwy_info.ils_frequency_mhz != nil) { + var label = "ILS " ~ rwy_info.id; + var freq = sprintf("%.3f", rwy_info.ils_frequency_mhz); + + me.setTextElement("FreqLabel" ~ fcount, label); + me.setTextElement("Freq" ~ fcount, freq); + fcount += 1; + } + } + while (fcount < 9) { # zero remaining comms channels me.setTextElement("FreqLabel" ~ fcount, ""); diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas index 22eee1a17..3a115cad3 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas @@ -113,7 +113,7 @@ var AirportInfoController = var select = me.page.handleEnter(); if (select.name == "AirportInfoID") me.setAirport(select.value); if (substr(select.name, 0, 15) == "AirportInfoFreq") { - me.page.mfd.SurroundController.setStandbyComFreq(select.value); + me.page.mfd.SurroundController.setStandbyNavComFreq(select.value); } return emesary.Transmitter.ReceiptStatus_Finished; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirports.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirports.nas index 9d338ca05..511e840ca 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirports.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirports.nas @@ -180,12 +180,14 @@ var NearestAirports = } var freqarray = []; + + # Add Comm Frequencies var apt_comms = apt.comms(); if (size(apt_comms) > 0) { # Airport has one or more frequencies assigned to it. var freqs = {}; foreach (var c; apt_comms) { - freqs[c.ident] = sprintf("%.3f", c.frequency);; + freqs[c.ident] = sprintf("%.3f", c.frequency); } foreach (var c; sort(keys(freqs), string.icmp)) { @@ -193,6 +195,16 @@ var NearestAirports = } } + # Add any ILS frequencies as well + foreach(var rwy; sort(keys(apt.runways), string.icmp)) { + var rwy_info = apt.runways[rwy]; + if (rwy_info.ils_frequency_mhz != nil) { + var label = "ILS " ~ rwy_info.id; + var freq = sprintf("%.3f", rwy_info.ils_frequency_mhz); + append(freqarray, {FreqLabel: label, Freq: freq}); + } + } + me.freqSelect.setValues(freqarray); # Approaches diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsController.nas index cc2935703..c4a90f674 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsController.nas @@ -141,7 +141,7 @@ var NearestAirportsController = # TODO Select the current COM frequency. var freq = me.page.getSelectedFreq(); if (freq != nil) { - me.page.mfd.SurroundController.setStandbyComFreq(freq); + me.page.mfd.SurroundController.setStandbyNavComFreq(freq); } return emesary.Transmitter.ReceiptStatus_Finished; } diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Surround/SurroundController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Surround/SurroundController.nas index 998da72bd..af4795935 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Surround/SurroundController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Surround/SurroundController.nas @@ -375,17 +375,34 @@ var SurroundController = me.transmitter = nil; }, - # Used by other pages to set the current standby COM frequency by pressing ENT - setStandbyComFreq : func(value) { + # Used by other pages to set the current standby NAV or COM frequency by pressing ENT + setStandbyNavComFreq : func(value) { var data={}; - if (value > fg1000.MAX_COM_FREQ) return; - if (value < fg1000.MIN_COM_FREQ) return; + # Determine whether this is NAV or COM based on the frequency itself - if (me._comselected == 1) { - data["Comm1StandbyFreq"] = value; + if (value < fg1000.MAX_NAV_FREQ) { + # Nav frequency + if (value > fg1000.MAX_NAV_FREQ) return; + if (value < fg1000.MIN_NAV_FREQ) return; + + # TODO: If we're in approach phase then this should update the Active + # frequency + if (me._navselected == 1) { + data["Nav1StandbyFreq"] = value; + } else { + data["Nav2StandbyFreq"] = value; + } } else { - data["Comm2StandbyFreq"] = value; + # COM frequency + if (value > fg1000.MAX_COM_FREQ) return; + if (value < fg1000.MIN_COM_FREQ) return; + + if (me._comselected == 1) { + data["Comm1StandbyFreq"] = value; + } else { + data["Comm2StandbyFreq"] = value; + } } me.sendNavComDataNotification(data);