FG1000: Volume controls from Julio SANTA CRUZ
This commit is contained in:
parent
d850f211fb
commit
c23666a99f
6 changed files with 1638 additions and 1495 deletions
File diff suppressed because it is too large
Load diff
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 77 KiB |
File diff suppressed because it is too large
Load diff
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 81 KiB |
|
@ -39,10 +39,12 @@ var GenericNavComPublisher =
|
|||
obj._triggeredPublisher = TriggeredPropertyPublisher.new(notifications.PFDEventNotification.NavComData);
|
||||
obj._periodicPublisher = PeriodicPropertyPublisher.new(notifications.PFDEventNotification.NavComData, period);
|
||||
|
||||
# Hack to handle cases where there is no selected Com or NAV frequency
|
||||
# Hack to handle cases where there is no selected Com or NAV frequency or volume
|
||||
if (getprop("/instrumentation/com-selected") == nil) setprop("/instrumentation/com-selected", 1);
|
||||
if (getprop("/instrumentation/nav-selected") == nil) setprop("/instrumentation/nav-selected", 1);
|
||||
|
||||
if (getprop("/instrumentation/nav/volume") == nil) setprop("/instrumentation/nav/volume", 0.5);
|
||||
if (getprop("/instrumentation/comm/volume") == nil) setprop("/instrumentation/comm/volume", 0.5);
|
||||
|
||||
obj._triggeredPublisher.addPropMap("Comm1SelectedFreq", "/instrumentation/comm/frequencies/selected-mhz");
|
||||
obj._triggeredPublisher.addPropMap("Comm1StandbyFreq", "/instrumentation/comm/frequencies/standby-mhz");
|
||||
obj._triggeredPublisher.addPropMap("Comm1AirportID", "/instrumentation/comm/airport-id");
|
||||
|
@ -56,14 +58,13 @@ var GenericNavComPublisher =
|
|||
obj._triggeredPublisher.addPropMap("Comm2AirportID", "/instrumentation/comm[1]/airport-id");
|
||||
obj._triggeredPublisher.addPropMap("Comm2StationName", "/instrumentation/comm[1]/station-name");
|
||||
obj._triggeredPublisher.addPropMap("Comm2StationType", "/instrumentation/comm[1]/station-type");
|
||||
obj._triggeredPublisher.addPropMap("Comm2Volume", "/instrumentation/comm[1]/volume");
|
||||
obj._triggeredPublisher.addPropMap("Comm2Serviceable", "/instrumentation/comm[1]/serviceable");
|
||||
|
||||
obj._triggeredPublisher.addPropMap("CommSelected", "/instrumentation/com-selected");
|
||||
|
||||
obj._triggeredPublisher.addPropMap("Nav1SelectedFreq", "/instrumentation/nav/frequencies/selected-mhz");
|
||||
obj._triggeredPublisher.addPropMap("Nav1StandbyFreq", "/instrumentation/nav/frequencies/standby-mhz");
|
||||
obj._periodicPublisher.addPropMap("Nav1ID", "/instrumentation/nav/nav-id");
|
||||
obj._triggeredPublisher.addPropMap("Nav1ID", "/instrumentation/nav/nav-id");
|
||||
obj._periodicPublisher.addPropMap("Nav1InRange", "/instrumentation/nav/in-range");
|
||||
obj._periodicPublisher.addPropMap("Nav1HeadingDeg", "/instrumentation/nav/heading-deg");
|
||||
obj._periodicPublisher.addPropMap("Nav1RadialDeg", "/instrumentation/nav/radials/selected-deg");
|
||||
|
@ -76,7 +77,7 @@ var GenericNavComPublisher =
|
|||
obj._periodicPublisher.addPropMap("Nav1GSInRange", "/instrumentation/nav/gs-in-range");
|
||||
obj._periodicPublisher.addPropMap("Nav1From", "/instrumentation/nav/from-flag");
|
||||
|
||||
obj._triggeredPublisher.addPropMap("Nav1Volume", "/instrumentation/nav/nav-volume");
|
||||
obj._triggeredPublisher.addPropMap("Nav1Volume", "/instrumentation/nav/volume");
|
||||
obj._triggeredPublisher.addPropMap("Nav1AudioID", "/instrumentation/nav/audio-btn");
|
||||
obj._triggeredPublisher.addPropMap("Nav1Serviceable", "/instrumentation/nav/operable");
|
||||
|
||||
|
@ -94,8 +95,6 @@ var GenericNavComPublisher =
|
|||
obj._periodicPublisher.addPropMap("Nav2GSDeflection", "/instrumentation/nav[1]/gs-needle-deflection-norm");
|
||||
obj._periodicPublisher.addPropMap("Nav2GSInRange", "/instrumentation/nav[1]/gs-in-range");
|
||||
obj._periodicPublisher.addPropMap("Nav2From", "/instrumentation/nav/from-flag");
|
||||
|
||||
obj._triggeredPublisher.addPropMap("Nav2Volume", "/instrumentation/nav[1]/nav-volume");
|
||||
obj._triggeredPublisher.addPropMap("Nav2AudioID", "/instrumentation/nav[1]/audio-btn");
|
||||
obj._triggeredPublisher.addPropMap("Nav2Serviceable", "/instrumentation/nav[1]/operable");
|
||||
|
||||
|
|
|
@ -33,40 +33,26 @@ var GenericNavComUpdater =
|
|||
# Hack to handle cases where there is no selected COMM or NAV frequency
|
||||
if (getprop("/instrumentation/com-selected") == nil) setprop("/instrumentation/com-selected", 1);
|
||||
if (getprop("/instrumentation/nav-selected") == nil) setprop("/instrumentation/nav-selected", 1);
|
||||
|
||||
|
||||
obj.addPropMap("Comm1SelectedFreq", "/instrumentation/comm/frequencies/selected-mhz");
|
||||
obj.addPropMap("Comm1StandbyFreq", "/instrumentation/comm/frequencies/standby-mhz");
|
||||
obj.addPropMap("Comm1AirportID", "/instrumentation/comm/airport-id");
|
||||
obj.addPropMap("Comm1StationName", "/instrumentation/comm/station-name");
|
||||
obj.addPropMap("Comm1StationType", "/instrumentation/comm/station-type");
|
||||
obj.addPropMap("Comm1Volume", "/instrumentation/comm/volume");
|
||||
obj.addPropMap("Comm1Serviceable", "/instrumentation/comm/serviceable");
|
||||
|
||||
obj.addPropMap("Comm2SelectedFreq", "/instrumentation/comm[1]/frequencies/selected-mhz");
|
||||
obj.addPropMap("Comm2StandbyFreq", "/instrumentation/comm[1]/frequencies/standby-mhz");
|
||||
obj.addPropMap("Comm2AirportID", "/instrumentation/comm[1]/airport-id");
|
||||
obj.addPropMap("Comm2StationName", "/instrumentation/comm[1]/station-name");
|
||||
obj.addPropMap("Comm2StationType", "/instrumentation/comm[1]/station-type");
|
||||
obj.addPropMap("Comm2Volume", "/instrumentation/comm[1]/volume");
|
||||
obj.addPropMap("Comm2Serviceable", "/instrumentation/comm[1]/serviceable");
|
||||
|
||||
obj.addPropMap("CommSelected", "/instrumentation/com-selected");
|
||||
|
||||
obj.addPropMap("Nav1SelectedFreq", "/instrumentation/nav/frequencies/selected-mhz");
|
||||
obj.addPropMap("Nav1StandbyFreq", "/instrumentation/nav/frequencies/standby-mhz");
|
||||
obj.addPropMap("Nav1ID", "/instrumentation/nav/nav-id");
|
||||
obj.addPropMap("Nav1RadialDeg", "/instrumentation/nav/radials/selected-deg");
|
||||
obj.addPropMap("Nav1Volume", "/instrumentation/nav/nav-volume");
|
||||
obj.addPropMap("Nav1AudioID", "/instrumentation/nav/audio-btn");
|
||||
obj.addPropMap("Nav1Serviceable", "/instrumentation/nav/operable");
|
||||
obj.addPropMap("Nav1Volume", "/instrumentation/nav/volume");
|
||||
|
||||
obj.addPropMap("Nav2SelectedFreq", "/instrumentation/nav[1]/frequencies/selected-mhz");
|
||||
obj.addPropMap("Nav2StandbyFreq", "/instrumentation/nav[1]/frequencies/standby-mhz");
|
||||
obj.addPropMap("Nav2ID", "/instrumentation/nav[1]/nav-id");
|
||||
obj.addPropMap("Nav2RadialDeg", "/instrumentation/nav[1]/radials/selected-deg");
|
||||
obj.addPropMap("Nav2Volume", "/instrumentation/nav[1]/nav-volume");
|
||||
obj.addPropMap("Nav2AudioID", "/instrumentation/nav[1]/audio-btn");
|
||||
obj.addPropMap("Nav2Serviceable", "/instrumentation/nav[1]/operable");
|
||||
obj.addPropMap("Nav2Volume", "/instrumentation/nav[1]/volume");
|
||||
|
||||
obj.addPropMap("NavSelected", "/instrumentation/nav-selected");
|
||||
|
||||
|
|
|
@ -109,15 +109,22 @@ var Surround =
|
|||
var textElements = [
|
||||
"Comm1StandbyFreq", "Comm1SelectedFreq",
|
||||
"Comm2StandbyFreq", "Comm2SelectedFreq",
|
||||
"CommVolume",
|
||||
"Nav1StandbyFreq", "Nav1SelectedFreq",
|
||||
"Nav2StandbyFreq", "Nav2SelectedFreq",
|
||||
"Nav1ID", "Nav2ID",
|
||||
"NavVolume",
|
||||
];
|
||||
|
||||
|
||||
var fdTextElements = ["HeaderAPLateralArmed", "HeaderAPLateralActive", "HeaderAPVerticalArmed", "HeaderAPVerticalActive", "HeaderAPVerticalReference"];
|
||||
|
||||
# Labels that show and hide for volume notification
|
||||
var volumeLabelElements = ["Comm2Label","CommVolumeLabel","Nav2Label","NavVolumeLabel"];
|
||||
|
||||
obj.addTextElements(textElements);
|
||||
|
||||
|
||||
obj.addElements(volumeLabelElements);
|
||||
|
||||
if (pfd) {
|
||||
obj.addTextElements(["HeaderFrom", "HeaderTo", "LegDistance", "LegBRG"]);
|
||||
obj.addTextElements(fdTextElements, FD_STATUS_STYLE);
|
||||
|
@ -151,6 +158,8 @@ var Surround =
|
|||
obj._menuVisible = 0;
|
||||
obj._selectedPageGroup = 0;
|
||||
obj._selectedPage = 0;
|
||||
obj._selected_comm = 1;
|
||||
obj._selected_nav = 1;
|
||||
|
||||
obj._elements = {};
|
||||
|
||||
|
@ -174,15 +183,24 @@ var Surround =
|
|||
obj._hideMenuTimer = maketimer(3, obj, obj.hideMenu);
|
||||
obj._hideMenuTimer.singleShot = 1;
|
||||
|
||||
obj._hideCommVolumeTimer = maketimer(2, obj, obj.hideCommVolume);
|
||||
obj._hideCommVolumeTimer.singleShot = 1;
|
||||
|
||||
obj._hideNavVolumeTimer = maketimer(2, obj, obj.hideNavVolume);
|
||||
obj._hideNavVolumeTimer.singleShot = 1;
|
||||
|
||||
obj._loadPageTimer = maketimer(0.5, obj, obj.loadPage);
|
||||
obj._loadPageTimer.singleShot = 1;
|
||||
|
||||
obj.hideMenu();
|
||||
|
||||
|
||||
obj.setController(fg1000.SurroundController.new(obj, svg, pfd));
|
||||
obj.hideCommVolume();
|
||||
obj.hideNavVolume();
|
||||
|
||||
return obj;
|
||||
},
|
||||
|
||||
|
||||
handleNavComData : func(data) {
|
||||
foreach(var name; keys(data)) {
|
||||
var val = data[name];
|
||||
|
@ -209,9 +227,11 @@ var Surround =
|
|||
|
||||
if (name == "CommSelected") {
|
||||
if (val == 1) {
|
||||
me._selected_comm=1;
|
||||
me._comm1selected.setVisible(1);
|
||||
me._comm2selected.setVisible(0);
|
||||
} else {
|
||||
me._selected_comm=2;
|
||||
me._comm1selected.setVisible(0);
|
||||
me._comm2selected.setVisible(1);
|
||||
}
|
||||
|
@ -239,24 +259,95 @@ var Surround =
|
|||
|
||||
if (name == "NavSelected") {
|
||||
if (val == 1) {
|
||||
me._selected_nav=1;
|
||||
me._nav1selected.setVisible(1);
|
||||
me._nav2selected.setVisible(0);
|
||||
} else {
|
||||
me._selected_nav=2;
|
||||
me._nav1selected.setVisible(0);
|
||||
me._nav2selected.setVisible(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (name == "Nav1ID") me.setTextElement("Nav1ID", val);
|
||||
if (name == "Nav2ID") me.setTextElement("Nav2ID", val);
|
||||
|
||||
# TODO - COM Volume - display the current volume for 2 seconds in place of the
|
||||
if (name == "Nav1ID") {
|
||||
if (val==0) {
|
||||
me.setTextElement("Nav1ID", "");
|
||||
} else {
|
||||
me.setTextElement("Nav1ID", val);
|
||||
}
|
||||
}
|
||||
if (name == "Nav2ID") {
|
||||
if (val==0) {
|
||||
me.setTextElement("Nav2ID", "");
|
||||
} else {
|
||||
me.setTextElement("Nav2ID", val);
|
||||
}
|
||||
}
|
||||
|
||||
# NAV/COM Volume - display the current volume for 2 seconds in place of the
|
||||
# standby frequency.
|
||||
|
||||
|
||||
|
||||
if (name == "Nav1Volume" or name == "Nav2Volume") {
|
||||
me.showNavVolume(val);
|
||||
}
|
||||
if (name == "Comm1Volume" or name == "Comm2Volume") {
|
||||
me.showCommVolume(val);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
showCommVolume: func(val) {
|
||||
var commvol = sprintf("%d%%",int(val*100));
|
||||
if (me.getTextValue("CommVolume") == commvol) return;
|
||||
|
||||
# Hide com2 standby and label
|
||||
me.getTextElement("Comm2StandbyFreq").setVisible(0);
|
||||
me.getElement("Comm2Label").setVisible(0);
|
||||
if (me._selected_comm == 2) me._comm2selected.setVisible(0);
|
||||
|
||||
# Set and show COM volume
|
||||
me.setTextElement("CommVolume",commvol);
|
||||
me.getTextElement("CommVolume").setVisible(1);
|
||||
me.getElement("CommVolumeLabel").setVisible(1);
|
||||
|
||||
# Start hide timer (2 secs according to the manual)
|
||||
me._hideCommVolumeTimer.stop();
|
||||
me._hideCommVolumeTimer.restart(2);
|
||||
},
|
||||
|
||||
hideCommVolume: func() {
|
||||
# Hide comm vol and restore standby and label
|
||||
me.getTextElement("CommVolume").setVisible(0);
|
||||
me.getElement("CommVolumeLabel").setVisible(0);
|
||||
me.getTextElement("Comm2StandbyFreq").setVisible(1);
|
||||
me.getElement("Comm2Label").setVisible(1);
|
||||
if (me._selected_comm == 2) me._comm2selected.setVisible(1);
|
||||
},
|
||||
showNavVolume: func(val) {
|
||||
var navvol = sprintf("%d%%",int(val*100));
|
||||
if (me.getTextValue("NavVolume") == navvol) return;
|
||||
|
||||
# Hide NAV2 standdby
|
||||
me.getTextElement("Nav2StandbyFreq").setVisible(0);
|
||||
me.getElement("Nav2Label").setVisible(0);
|
||||
if (me._selected_nav == 2) me._nav2selected.setVisible(0);
|
||||
|
||||
# Set and show NAV volume
|
||||
me.setTextElement("NavVolume",navvol);
|
||||
me.getTextElement("NavVolume").setVisible(1);
|
||||
me.getElement("NavVolumeLabel").setVisible(1);
|
||||
|
||||
# Start hide timer (2 secs according to the manual)
|
||||
me._hideNavVolumeTimer.stop();
|
||||
me._hideNavVolumeTimer.restart(2);
|
||||
},
|
||||
hideNavVolume: func() {
|
||||
# Hide Nav volume and show NAV2 standby again
|
||||
me.getTextElement("NavVolume").setVisible(0);
|
||||
me.getElement("NavVolumeLabel").setVisible(0);
|
||||
me.getTextElement("Nav2StandbyFreq").setVisible(1);
|
||||
me.getElement("Nav2Label").setVisible(1);
|
||||
if (me._selected_nav == 2) me._nav2selected.setVisible(1);
|
||||
},
|
||||
# Update Header data with FMS or ADC data.
|
||||
updateHeaderData : func(data) {
|
||||
|
||||
|
@ -496,5 +587,4 @@ var Surround =
|
|||
return me._menuVisible;
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -30,6 +30,7 @@ var SurroundController =
|
|||
_com1standby : 0.0,
|
||||
_com2active : 0.0,
|
||||
_com2standby : 0.0,
|
||||
_commvolume : 0.0,
|
||||
_nav1active : 0.0,
|
||||
_nav1standby : 0.0,
|
||||
_nav1radial : 0.0,
|
||||
|
@ -38,6 +39,7 @@ var SurroundController =
|
|||
_nav2standby : 0.0,
|
||||
_nav2radial : 0.0,
|
||||
_nav2_heading_deg : 0.0,
|
||||
_navvolume : 0.0,
|
||||
_pressure_settings_inhg : 0.0,
|
||||
_selected_alt_ft : 0.0,
|
||||
_heading_bug_deg : 0.0,
|
||||
|
@ -82,19 +84,24 @@ var SurroundController =
|
|||
|
||||
if (data["Comm1SelectedFreq"] != nil) me._com1active = data["Comm1SelectedFreq"];
|
||||
if (data["Comm1StandbyFreq"] != nil) me._com1standby = data["Comm1StandbyFreq"];
|
||||
if (data["Comm1Volume"] != nil and me._commvolume != data["Comm1Volume"]) me._commvolume = data["Comm1Volume"];
|
||||
if (data["Comm2SelectedFreq"] != nil) me._com2active = data["Comm2SelectedFreq"];
|
||||
if (data["Comm2StandbyFreq"] != nil) me._com2standby = data["Comm2StandbyFreq"];
|
||||
|
||||
if (data["Comm2Volume"] != nil and me._commvolume != data["Comm2Volume"]) me._commvolume = data["Comm2Volume"];
|
||||
|
||||
if (data["Nav1SelectedFreq"] != nil) me._nav1active = data["Nav1SelectedFreq"];
|
||||
if (data["Nav1StandbyFreq"] != nil) me._nav1standby = data["Nav1StandbyFreq"];
|
||||
if (data["Nav1RadialDeg"] != nil) me._nav1radial = data["Nav1RadialDeg"];
|
||||
if (data["Nav1HeadingDeg"] != nil) me._nav1_heading_deg = data["Nav1HeadingDeg"];
|
||||
|
||||
if (data["Nav1Volume"] != nil and me._navvolume != data["Nav1Volume"]) me._navvolume = data["Nav1Volume"];
|
||||
|
||||
if (data["Nav2SelectedFreq"] != nil) me._nav2active = data["Nav2SelectedFreq"];
|
||||
if (data["Nav2StandbyFreq"] != nil) me._nav2standby = data["Nav2StandbyFreq"];
|
||||
if (data["Nav2RadialDeg"] != nil) me._nav2radial = data["Nav2RadialDeg"];
|
||||
if (data["Nav2HeadingDeg"] != nil) me._nav2_heading_deg = data["Nav2HeadingDeg"];
|
||||
|
||||
if (data["Nav2Volume"] != nil and me._navvolume != data["Nav2Volume"]) me._navvolume = data["Nav2Volume"];
|
||||
|
||||
|
||||
# pass through to the page
|
||||
me._page.handleNavComData(data);
|
||||
return emesary.Transmitter.ReceiptStatus_OK;
|
||||
|
@ -120,14 +127,11 @@ var SurroundController =
|
|||
# Handle the various COM and NAV controls at the top left and top right of the Fascia
|
||||
#
|
||||
handleNavVol : func (value) {
|
||||
var data={};
|
||||
|
||||
if (me._navselected == 1) {
|
||||
data["Nav1Volume"] = value;
|
||||
} else {
|
||||
data["Nav2Volume"] = value;
|
||||
}
|
||||
|
||||
var data={};
|
||||
var incr_or_decr = (value > 0) ? 0.01 : -0.01;
|
||||
var vol = math.max(0,math.min(1,me._navvolume + incr_or_decr));
|
||||
data["Nav1Volume"] = vol;
|
||||
data["Nav2Volume"] = vol;
|
||||
me.sendNavComDataNotification(data);
|
||||
return emesary.Transmitter.ReceiptStatus_Finished;
|
||||
},
|
||||
|
@ -367,13 +371,10 @@ var SurroundController =
|
|||
|
||||
handleComVol : func (value) {
|
||||
var data={};
|
||||
|
||||
if (me._comselected == 1) {
|
||||
data["Comm1Volume"] = value;
|
||||
} else {
|
||||
data["Comm2Volume"] = value;
|
||||
}
|
||||
|
||||
var incr_or_decr = (value > 0) ? 0.01 : -0.01;
|
||||
var vol = math.max(0,math.min(1,me._commvolume + incr_or_decr));
|
||||
data["Comm1Volume"] = vol;
|
||||
data["Comm2Volume"] = vol;
|
||||
me.sendNavComDataNotification(data);
|
||||
return emesary.Transmitter.ReceiptStatus_Finished;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue