FG1000: Multikey Support
Add Multikey support for the FG1000 (:GF and :GP) to improve useability by allowing direct entry of strings. This is massively easier than fiddling with the control knobs. Also correct interface variable name "frequency" to "period", which is more accurate.
This commit is contained in:
parent
baa33f40b3
commit
34db58c529
15 changed files with 90 additions and 20 deletions
|
@ -151,7 +151,9 @@ var FASCIA = {
|
||||||
# GDU 1045 Autopilot keys
|
# GDU 1045 Autopilot keys
|
||||||
YD : 46,
|
YD : 46,
|
||||||
|
|
||||||
|
# Useability helpers to avoid having to use the FMS knobs to spell airport IDs etc.
|
||||||
|
KEY_INPUT : 47,
|
||||||
|
STRING_INPUT: 48,
|
||||||
};
|
};
|
||||||
|
|
||||||
var SURFACE_TYPES = {
|
var SURFACE_TYPES = {
|
||||||
|
|
|
@ -32,12 +32,12 @@ var GenericADCPublisher =
|
||||||
|
|
||||||
# Update frequency can be controlled by a property.
|
# Update frequency can be controlled by a property.
|
||||||
var frequency = getprop("/instrumentation/FG1000/adc-update-frequency");
|
var frequency = getprop("/instrumentation/FG1000/adc-update-frequency");
|
||||||
if (frequency == nil) frequency = 0.1;
|
if (frequency == nil) frequency = 10;
|
||||||
|
|
||||||
var obj = {
|
var obj = {
|
||||||
parents : [
|
parents : [
|
||||||
GenericADCPublisher,
|
GenericADCPublisher,
|
||||||
PeriodicPropertyPublisher.new(notifications.PFDEventNotification.ADCData, frequency)
|
PeriodicPropertyPublisher.new(notifications.PFDEventNotification.ADCData, 1.0/frequency)
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
var GenericEISPublisher =
|
var GenericEISPublisher =
|
||||||
{
|
{
|
||||||
|
|
||||||
new : func (frequency=0.25) {
|
new : func (period=0.25) {
|
||||||
var obj = {
|
var obj = {
|
||||||
parents : [
|
parents : [
|
||||||
GenericEISPublisher,
|
GenericEISPublisher,
|
||||||
PeriodicPropertyPublisher.new(notifications.PFDEventNotification.EngineData, frequency)
|
PeriodicPropertyPublisher.new(notifications.PFDEventNotification.EngineData, period)
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
var GenericFMSPublisher =
|
var GenericFMSPublisher =
|
||||||
{
|
{
|
||||||
|
|
||||||
new : func (frequency=0.5) {
|
new : func (period=0.5) {
|
||||||
var obj = {
|
var obj = {
|
||||||
parents : [
|
parents : [
|
||||||
GenericFMSPublisher,
|
GenericFMSPublisher,
|
||||||
|
@ -34,7 +34,7 @@ var GenericFMSPublisher =
|
||||||
#
|
#
|
||||||
# 2) a periodic publisher which triggers every 0.5s to update data values.
|
# 2) a periodic publisher which triggers every 0.5s to update data values.
|
||||||
obj._triggeredPublisher = TriggeredPropertyPublisher.new(notifications.PFDEventNotification.FMSData);
|
obj._triggeredPublisher = TriggeredPropertyPublisher.new(notifications.PFDEventNotification.FMSData);
|
||||||
obj._periodicPublisher = PeriodicPropertyPublisher.new(notifications.PFDEventNotification.FMSData, frequency);
|
obj._periodicPublisher = PeriodicPropertyPublisher.new(notifications.PFDEventNotification.FMSData, period);
|
||||||
|
|
||||||
obj._triggeredPublisher.addPropMap("FMSHeadingBug", "/autopilot/settings/heading-bug-deg");
|
obj._triggeredPublisher.addPropMap("FMSHeadingBug", "/autopilot/settings/heading-bug-deg");
|
||||||
obj._triggeredPublisher.addPropMap("FMSSelectedAlt", "/autopilot/settings/target-alt-ft");
|
obj._triggeredPublisher.addPropMap("FMSSelectedAlt", "/autopilot/settings/target-alt-ft");
|
||||||
|
|
|
@ -18,15 +18,15 @@
|
||||||
var GenericFuelPublisher =
|
var GenericFuelPublisher =
|
||||||
{
|
{
|
||||||
|
|
||||||
new : func (frequency=1.0) {
|
new : func (period=1.0) {
|
||||||
var obj = {
|
var obj = {
|
||||||
parents : [
|
parents : [
|
||||||
GenericFuelPublisher,
|
GenericFuelPublisher,
|
||||||
PeriodicPropertyPublisher.new(notifications.PFDEventNotification.FuelData, frequency)
|
PeriodicPropertyPublisher.new(notifications.PFDEventNotification.FuelData, period)
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
obj.deltaT = frequency;
|
obj.deltaT = period;
|
||||||
|
|
||||||
|
|
||||||
# Hack to handle most aircraft not having proper engine hours
|
# Hack to handle most aircraft not having proper engine hours
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#
|
#
|
||||||
var GenericNavComPublisher =
|
var GenericNavComPublisher =
|
||||||
{
|
{
|
||||||
new : func (frequency=0.5) {
|
new : func (period=0.5) {
|
||||||
var obj = {
|
var obj = {
|
||||||
parents : [
|
parents : [
|
||||||
GenericNavComPublisher,
|
GenericNavComPublisher,
|
||||||
|
@ -37,7 +37,7 @@ var GenericNavComPublisher =
|
||||||
# 2) a periodic publisher which triggers every 0.5s to update data values.
|
# 2) a periodic publisher which triggers every 0.5s to update data values.
|
||||||
|
|
||||||
obj._triggeredPublisher = TriggeredPropertyPublisher.new(notifications.PFDEventNotification.NavComData);
|
obj._triggeredPublisher = TriggeredPropertyPublisher.new(notifications.PFDEventNotification.NavComData);
|
||||||
obj._periodicPublisher = PeriodicPropertyPublisher.new(notifications.PFDEventNotification.NavComData, frequency);
|
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
|
||||||
if (getprop("/instrumentation/com-selected") == nil) setprop("/instrumentation/com-selected", 1);
|
if (getprop("/instrumentation/com-selected") == nil) setprop("/instrumentation/com-selected", 1);
|
||||||
|
|
|
@ -45,11 +45,11 @@ var PropMap = {
|
||||||
|
|
||||||
var PeriodicPropertyPublisher =
|
var PeriodicPropertyPublisher =
|
||||||
{
|
{
|
||||||
new : func (notification, frequency=0.25) {
|
new : func (notification, period=0.25) {
|
||||||
var obj = {
|
var obj = {
|
||||||
parents : [ PeriodicPropertyPublisher ],
|
parents : [ PeriodicPropertyPublisher ],
|
||||||
_notification : notification,
|
_notification : notification,
|
||||||
_frequency : frequency,
|
_period : period,
|
||||||
_propmaps : [],
|
_propmaps : [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ var PeriodicPropertyPublisher =
|
||||||
},
|
},
|
||||||
|
|
||||||
start : func() {
|
start : func() {
|
||||||
me._timer = maketimer(me._frequency, me, me.publish);
|
me._timer = maketimer(me._period, me, me.publish);
|
||||||
me._timer.start();
|
me._timer.start();
|
||||||
},
|
},
|
||||||
stop : func() {
|
stop : func() {
|
||||||
|
@ -91,11 +91,11 @@ var PeriodicPropertyPublisher =
|
||||||
|
|
||||||
var TriggeredPropertyPublisher =
|
var TriggeredPropertyPublisher =
|
||||||
{
|
{
|
||||||
new : func (notification, frequency=5) {
|
new : func (notification, period=5) {
|
||||||
var obj = {
|
var obj = {
|
||||||
parents : [ TriggeredPropertyPublisher ],
|
parents : [ TriggeredPropertyPublisher ],
|
||||||
_notification : notification,
|
_notification : notification,
|
||||||
_frequency : frequency,
|
_period : period,
|
||||||
_propmaps : {},
|
_propmaps : {},
|
||||||
_listeners : [],
|
_listeners : [],
|
||||||
_timer: nil,
|
_timer: nil,
|
||||||
|
@ -153,7 +153,7 @@ var TriggeredPropertyPublisher =
|
||||||
append(me._listeners, listener);
|
append(me._listeners, listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
me._timer = maketimer(me._frequency, me, me.publishAll);
|
me._timer = maketimer(me._period, me, me.publishAll);
|
||||||
me._timer.start();
|
me._timer.start();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,9 @@ handleEnter : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcess
|
||||||
handleAltOuter : func (value) { return me.page.mfd.SurroundController.handleAltOuter(value); },
|
handleAltOuter : func (value) { return me.page.mfd.SurroundController.handleAltOuter(value); },
|
||||||
handleAltInner : func (value) { return me.page.mfd.SurroundController.handleAltInner(value); },
|
handleAltInner : func (value) { return me.page.mfd.SurroundController.handleAltInner(value); },
|
||||||
|
|
||||||
|
handleKeyInput : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
|
||||||
|
handleStringInput : func (value) { print("Not handling " ~ value); return emesary.Transmitter.ReceiptStatus_NotProcessed; },
|
||||||
|
|
||||||
RegisterWithEmesary : func()
|
RegisterWithEmesary : func()
|
||||||
{
|
{
|
||||||
if (me._recipient == nil){
|
if (me._recipient == nil){
|
||||||
|
@ -164,6 +167,9 @@ RegisterWithEmesary : func()
|
||||||
if (id == fg1000.FASCIA.ALT_OUTER) return controller.handleAltOuter(value);
|
if (id == fg1000.FASCIA.ALT_OUTER) return controller.handleAltOuter(value);
|
||||||
if (id == fg1000.FASCIA.ALT_INNER) return controller.handleAltInner(value);
|
if (id == fg1000.FASCIA.ALT_INNER) return controller.handleAltInner(value);
|
||||||
|
|
||||||
|
if (id == fg1000.FASCIA.KEY_INPUT) return controller.handleKeyInput(value);
|
||||||
|
if (id == fg1000.FASCIA.STRING_INPUT) return controller.handleStringInput(value);
|
||||||
|
|
||||||
# Autopilot controls - ignore for now as like to be handled elsewhere
|
# Autopilot controls - ignore for now as like to be handled elsewhere
|
||||||
#if (id == fg1000.FASCIA.AP ) return controller.handle(value);
|
#if (id == fg1000.FASCIA.AP ) return controller.handle(value);
|
||||||
#if (id == fg1000.FASCIA.HDG) return controller.handle(value);
|
#if (id == fg1000.FASCIA.HDG) return controller.handle(value);
|
||||||
|
|
|
@ -200,6 +200,15 @@ var AirportInfoController =
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleStringInput : func(value) {
|
||||||
|
me.selectAirport();
|
||||||
|
me.page.airportEntry.clearElement();
|
||||||
|
me.page.airportEntry.setValue(value);
|
||||||
|
me.setAirport(value);
|
||||||
|
me.page.resetCRSR();
|
||||||
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
||||||
|
},
|
||||||
|
|
||||||
# Reset controller if required when the page is displayed or hidden
|
# Reset controller if required when the page is displayed or hidden
|
||||||
ondisplay : func() {
|
ondisplay : func() {
|
||||||
me.RegisterWithEmesary();
|
me.RegisterWithEmesary();
|
||||||
|
|
|
@ -303,6 +303,24 @@ var DirectToController =
|
||||||
return emesary.Transmitter.ReceiptStatus_Finished;
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleStringInput : func(value) {
|
||||||
|
if (! me.dto_displayed) return emesary.Transmitter.ReceiptStatus_NotProcessed;
|
||||||
|
if (me._waypointSubmenuVisible) return emesary.Transmitter.ReceiptStatus_NotProcessed;
|
||||||
|
|
||||||
|
if (me._cursorElements[me._selectedElement].isEditable()) {
|
||||||
|
# Cancel any editing
|
||||||
|
me._cursorElements[me._selectedElement].clearElement();
|
||||||
|
|
||||||
|
# Set the new value
|
||||||
|
me._cursorElements[me._selectedElement].setValue(value);
|
||||||
|
|
||||||
|
# Also cause any enter-handling
|
||||||
|
me.handleEnter(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
||||||
|
},
|
||||||
|
|
||||||
# Reset controller if required when the page is displayed or hidden
|
# Reset controller if required when the page is displayed or hidden
|
||||||
# Note that we explicitly do NOT RegisterWithEmesary/DeRegisterWithEmesary!
|
# Note that we explicitly do NOT RegisterWithEmesary/DeRegisterWithEmesary!
|
||||||
# This page should RegisterWithEmesary at start of day instead.
|
# This page should RegisterWithEmesary at start of day instead.
|
||||||
|
|
|
@ -125,9 +125,18 @@ var IntersectionInfoController =
|
||||||
me._page.update(navdata, vordata);
|
me._page.update(navdata, vordata);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleStringInput : func(value) {
|
||||||
|
me._page.dataEntry.clearElement();
|
||||||
|
me._page.dataEntry.setValue(value);
|
||||||
|
me.getIntersection(value);
|
||||||
|
me._page.dataEntry.unhighlightElement();
|
||||||
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
||||||
|
},
|
||||||
|
|
||||||
# Reset controller if required when the page is displayed or hidden
|
# Reset controller if required when the page is displayed or hidden
|
||||||
ondisplay : func() {
|
ondisplay : func() {
|
||||||
me.RegisterWithEmesary();
|
me.RegisterWithEmesary();
|
||||||
|
if (me._page.dataEntry.getValue() != "") me.getIntersection(me._page.dataEntry.getValue());
|
||||||
},
|
},
|
||||||
offdisplay : func() {
|
offdisplay : func() {
|
||||||
me.DeRegisterWithEmesary();
|
me.DeRegisterWithEmesary();
|
||||||
|
|
|
@ -127,9 +127,18 @@ var NDBInfoController =
|
||||||
me._page.update(navdata, aptdata);
|
me._page.update(navdata, aptdata);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleStringInput : func(value) {
|
||||||
|
me._page.dataEntry.clearElement();
|
||||||
|
me._page.dataEntry.setValue(value);
|
||||||
|
me.getNDB(value);
|
||||||
|
me._page.dataEntry.unhighlightElement();
|
||||||
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
||||||
|
},
|
||||||
|
|
||||||
# Reset controller if required when the page is displayed or hidden
|
# Reset controller if required when the page is displayed or hidden
|
||||||
ondisplay : func() {
|
ondisplay : func() {
|
||||||
me.RegisterWithEmesary();
|
me.RegisterWithEmesary();
|
||||||
|
if (me._page.dataEntry.getValue() != "") me.getNDB(me._page.dataEntry.getValue());
|
||||||
},
|
},
|
||||||
offdisplay : func() {
|
offdisplay : func() {
|
||||||
me.DeRegisterWithEmesary();
|
me.DeRegisterWithEmesary();
|
||||||
|
|
|
@ -124,9 +124,18 @@ var VORInfoController =
|
||||||
me._page.update(navdata, aptdata);
|
me._page.update(navdata, aptdata);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleStringInput : func(value) {
|
||||||
|
me._page.dataEntry.clearElement();
|
||||||
|
me._page.dataEntry.setValue(value);
|
||||||
|
me.getVOR(value);
|
||||||
|
me._page.dataEntry.unhighlightElement();
|
||||||
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
||||||
|
},
|
||||||
|
|
||||||
# Reset controller if required when the page is displayed or hidden
|
# Reset controller if required when the page is displayed or hidden
|
||||||
ondisplay : func() {
|
ondisplay : func() {
|
||||||
me.RegisterWithEmesary();
|
me.RegisterWithEmesary();
|
||||||
|
if (me._page.dataEntry.getValue() != "") me.getVOR(me._page.dataEntry.getValue());
|
||||||
},
|
},
|
||||||
offdisplay : func() {
|
offdisplay : func() {
|
||||||
me.DeRegisterWithEmesary();
|
me.DeRegisterWithEmesary();
|
||||||
|
|
|
@ -226,7 +226,7 @@ var WaypointEntryController =
|
||||||
me.page.WaypointSubmenuGroup.setVisible(0);
|
me.page.WaypointSubmenuGroup.setVisible(0);
|
||||||
me._waypointSubmenuVisible = 0;
|
me._waypointSubmenuVisible = 0;
|
||||||
} else if (me.page.IDEntry.isInEdit()) {
|
} else if (me.page.IDEntry.isInEdit()) {
|
||||||
# If we're editing an element, complete the data entry, the load it.
|
# If we're editing an element, complete the data entry, then load it.
|
||||||
me.page.IDEntry.enterElement();
|
me.page.IDEntry.enterElement();
|
||||||
me.loadDestination(me.page.IDEntry.getValue());
|
me.loadDestination(me.page.IDEntry.getValue());
|
||||||
} else {
|
} else {
|
||||||
|
@ -259,6 +259,14 @@ var WaypointEntryController =
|
||||||
return emesary.Transmitter.ReceiptStatus_Finished;
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleStringInput : func(value) {
|
||||||
|
if (! me._wpentry_displayed) return emesary.Transmitter.ReceiptStatus_NotProcessed;
|
||||||
|
me.page.IDEntry.clearElement();
|
||||||
|
me.page.IDEntry.setValue(value);
|
||||||
|
me.loadDestination(me.page.IDEntry.getValue());
|
||||||
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
||||||
|
},
|
||||||
|
|
||||||
# Reset controller if required when the page is displayed or hidden
|
# Reset controller if required when the page is displayed or hidden
|
||||||
# Note that we explicitly do NOT RegisterWithEmesary/DeRegisterWithEmesary!
|
# Note that we explicitly do NOT RegisterWithEmesary/DeRegisterWithEmesary!
|
||||||
# This page should RegisterWithEmesary at start of day instead.
|
# This page should RegisterWithEmesary at start of day instead.
|
||||||
|
|
Loading…
Reference in a new issue