1
0
Fork 0

FG1000: Quality of life improvements

- Pre-load nearest airports to remove significant freeze when the
NearestAirports page is accessed for the first time.
- Update multikey support to provide easy access to commonly used MFD
pages and access to softkeys.
This commit is contained in:
Stuart Buchanan 2019-02-22 16:32:55 +00:00
parent f09b49e006
commit c234f22daa
5 changed files with 495 additions and 10 deletions

View file

@ -94,3 +94,37 @@ addcommand("FG1000SoftKeyPushed",
emesary.GlobalTransmitter.NotifyAll(notification);
}
);
# This command is a convenience for multi-key/menu support to make it easier to
# navigate to particular pages without having to use the FMS knobs.
removecommand("FG1000SelectPage");
addcommand("FG1000SelectPage",
func(node) {
var device = node.getNode("device", 1).getValue();
var group = node.getNode("group",1).getValue();
var page = node.getNode("page",1).getValue();
if (group == nil) {
print("FG1000SelectPage: No <group> argument passed to fgcommand");
return;
}
if (page == nil) {
print("FG1000SelectPage: No <page> argument passed to fgcommand");
return;
}
if (device == nil) {
print("FG1000SelectPage: No <device> argument passed to fgcommand for " ~ name);
return;
}
var notification = notifications.PFDEventNotification.new(
"MFD",
int(device),
notifications.PFDEventNotification.SelectPageById,
{ Group: group, Page: page }
);
emesary.GlobalTransmitter.NotifyAll(notification);
}
);

View file

@ -41,6 +41,11 @@ new : func ()
# List of recently use waypoints
obj._recentWaypoints = std.Vector.new();
# Some methods are really slow the first time they are called, typically
# because they are populating some cached database. Call them now to reduce
# freezes in flight.
var apts = obj.getNearestAirports();
var navdata = obj.getNavDataWithinRange({type : "VOR"});
return obj;
},

View file

@ -392,6 +392,40 @@ var Surround =
return me.getMFD().getPage(currentpage);
},
# Go to a define page in the MFD. Only valid for MFDs, and mainly used as
# a useability shortcut to avoid having to use the FMS knobs.
goToPage : func(group, page)
{
# Not valid for the PFD.
if (me.pfd) return;
# Values may be passed as names or indices.
if (int(group) == nil) {
for (var i = 0; i < size(PAGE_GROUPS); i = i + 1) {
if (group == PAGE_GROUPS[i].group) {
me._selectedPageGroup = i;
}
}
} else {
assert(group < size(PAGE_GROUPS), "Page Group index " ~ group ~ " out of bounds");
me._selectedPageGroup = group;
}
if (int(page) == nil) {
for (var j = 0; j < size(PAGE_GROUPS[me._selectedPageGroup].pages); j = j + 1) {
if (page == PAGE_GROUPS[me._selectedPageGroup].pages[j]) {
me._selectedPage = j;
}
}
} else {
assert(page < size(PAGE_GROUPS[me._selectedPageGroup].pages), "Page Group index " ~ group ~ " out of bounds");
me._selectedPage = page;
}
# Now we've updated the selected pages, then load it
me.loadPage();
},
# Function to change a page based on the selection
loadPage : func()
{

View file

@ -110,6 +110,11 @@ var SurroundController =
return emesary.Transmitter.ReceiptStatus_OK;
},
handleSelectPageByID : func(notification) {
me._page.goToPage(notification.Group, notification.Page);
return emesary.Transmitter.ReceiptStatus_Finished;
},
#
# Handle the various COM and NAV controls at the top left and top right of the Fascia
#
@ -481,7 +486,7 @@ var SurroundController =
var controller = me;
me._recipient.Receive = func(notification)
{
# Note that we don't care about the device that the data comes from.
# Note that in general we don't care about the device that the data comes from.
if (notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.NavComData
@ -496,6 +501,12 @@ var SurroundController =
{
return controller.handleFMSADCData(notification.EventParameter);
}
if (notification.Device_Id == pfd_obj.device_id and
notification.Event_Id == notifications.PFDEventNotification.SelectPageById)
{
return controller.handleSelectPageByID(notification.EventParameter);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};

View file

@ -1,11 +1,144 @@
<PropertyList>
<!-- FG1000 commands -->
<key n="71">
<name>G</name>
<desc>FG1000</desc>
<key n="901">
<name>P</name>
<desc>PFD String Input</desc>
<key n="112">
<name>p</name>
<desc>FG1000 PFD</desc>
<key n="49">
<name>1</name>
<desc>Softkey 1</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>1</device>
<offset>1</offset>
</binding>
</key>
<key n="50">
<name>2</name>
<desc>Softkey 2</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>1</device>
<offset>2</offset>
</binding>
</key>
<key n="51">
<name>3</name>
<desc>Softkey 3</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>1</device>
<offset>3</offset>
</binding>
</key>
<key n="52">
<name>4</name>
<desc>Softkey 4</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>1</device>
<offset>4</offset>
</binding>
</key>
<key n="53">
<name>5</name>
<desc>Softkey 5</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>1</device>
<offset>5</offset>
</binding>
</key>
<key n="54">
<name>6</name>
<desc>Softkey 6</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>1</device>
<offset>6</offset>
</binding>
</key>
<key n="55">
<name>7</name>
<desc>Softkey 7</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>1</device>
<offset>7</offset>
</binding>
</key>
<key n="56">
<name>8</name>
<desc>Softkey 8</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>1</device>
<offset>8</offset>
</binding>
</key>
<key n="57">
<name>9</name>
<desc>Softkey 9</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>1</device>
<offset>9</offset>
</binding>
</key>
<key n="58">
<name>10</name>
<desc>Softkey 10</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>1</device>
<offset>10</offset>
</binding>
</key>
<key n="59">
<name>11</name>
<desc>Softkey 11</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>1</device>
<offset>11</offset>
</binding>
</key>
<key n="60">
<name>12</name>
<desc>Softkey 12</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>1</device>
<offset>12</offset>
</binding>
</key>
<key n="115">
<name>s</name>
<desc>PFD String input</desc>
<key n="903">
<name>%s</name>
<desc>PFD String input : %s</desc>
@ -21,9 +154,146 @@
</binding>
</key>
</key>
<key n="902">
<name>M</name>
<desc>MFD String Input</desc>
</key>
<key n="109">
<name>m</name>
<desc>FG1000 MFD</desc>
<key n="49">
<name>1</name>
<desc>Softkey 1</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>2</device>
<offset>1</offset>
</binding>
</key>
<key n="50">
<name>2</name>
<desc>Softkey 2</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>2</device>
<offset>2</offset>
</binding>
</key>
<key n="51">
<name>3</name>
<desc>Softkey 3</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>2</device>
<offset>3</offset>
</binding>
</key>
<key n="52">
<name>4</name>
<desc>Softkey 4</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>2</device>
<offset>4</offset>
</binding>
</key>
<key n="53">
<name>5</name>
<desc>Softkey 5</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>2</device>
<offset>5</offset>
</binding>
</key>
<key n="54">
<name>6</name>
<desc>Softkey 6</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>2</device>
<offset>6</offset>
</binding>
</key>
<key n="55">
<name>7</name>
<desc>Softkey 7</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>2</device>
<offset>7</offset>
</binding>
</key>
<key n="56">
<name>8</name>
<desc>Softkey 8</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>2</device>
<offset>8</offset>
</binding>
</key>
<key n="57">
<name>9</name>
<desc>Softkey 9</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>2</device>
<offset>9</offset>
</binding>
</key>
<key n="58">
<name>10</name>
<desc>Softkey 10</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>2</device>
<offset>10</offset>
</binding>
</key>
<key n="59">
<name>11</name>
<desc>Softkey 11</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>2</device>
<offset>11</offset>
</binding>
</key>
<key n="60">
<name>12</name>
<desc>Softkey 12</desc>
<exit/>
<binding>
<command>FG1000SoftKeyPushed</command>
<device>2</device>
<offset>12</offset>
</binding>
</key>
<key n="115">
<name>s</name>
<desc>MFD String input</desc>
<key n="903">
<name>%s</name>
<desc>MFD String input : %s</desc>
@ -39,6 +309,137 @@
</binding>
</key>
</key>
<key n="97">
<name>a</name>
<desc>Airport Information</desc>
<exit/>
<binding>
<command>nasal</command>
<script>
var args = {'device': 2,
'group': 'WPTPageGroup',
'page' : 'AirportInfo'};
fgcommand("FG1000SelectPage", props.Node.new(args));
</script>
</binding>
</key>
<key n="99">
<name>c</name>
<desc>Checklists</desc>
<exit/>
<binding>
<command>nasal</command>
<script>
var args = {'device': 2,
'group': 'LstPageGroup',
'page' : 'Checklist'};
fgcommand("FG1000SelectPage", props.Node.new(args));
</script>
</binding>
</key>
<key n="102">
<name>f</name>
<desc>Flightplan</desc>
<exit/>
<binding>
<command>nasal</command>
<script>
var args = {'device': 2,
'group': 'FPLPageGroup',
'page' : 'ActiveFlightPlanNarrow'};
fgcommand("FG1000SelectPage", props.Node.new(args));
</script>
</binding>
</key>
<key n="110">
<name>n</name>
<desc>Nearest Airport</desc>
<exit/>
<binding>
<command>nasal</command>
<script>
var args = {'device': 2,
'group': 'NrstPageGroup',
'page' : 'NearestAirports'};
fgcommand("FG1000SelectPage", props.Node.new(args));
</script>
</binding>
</key>
<key n="109">
<name>m</name>
<desc>Map</desc>
<exit/>
<binding>
<command>nasal</command>
<script>
var args = {'device': 2,
'group': 'MapPageGroup',
'page' : 'NavigationMap'};
fgcommand("FG1000SelectPage", props.Node.new(args));
</script>
</binding>
</key>
<key n="110">
<name>n</name>
<desc>Nearest Airport</desc>
<exit/>
<binding>
<command>nasal</command>
<script>
var args = {'device': 2,
'group': 'NrstPageGroup',
'page' : 'NearestAirports'};
fgcommand("FG1000SelectPage", props.Node.new(args));
</script>
</binding>
</key>
<key n="115">
<name>s</name>
<desc>MFD String input</desc>
<key n="903">
<name>%s</name>
<desc>MFD String input : %s</desc>
<binding>
<command>nasal</command>
<script>
var args = {'device': 2,
'notification': fg1000.FASCIA.STRING_INPUT,
'offset' : arg[0]};
fgcommand("FG1000HardKeyPushed", props.Node.new(args));
</script>
</binding>
</key>
</key>
<key n="116">
<name>t</name>
<desc>Traffic Map</desc>
<exit/>
<binding>
<command>nasal</command>
<script>
var args = {'device': 2,
'group': 'MapPageGroup',
'page' : 'TrafficMap'};
fgcommand("FG1000SelectPage", props.Node.new(args));
</script>
</binding>
</key>
</key>
</PropertyList>