1
0
Fork 0

It was necessary to manually call predicates to update RTE layers

This commit is contained in:
legoboyvdlp R 2020-11-07 19:07:55 +00:00
parent 682adfd7b0
commit 9b45e4d675
3 changed files with 20 additions and 0 deletions

View file

@ -161,6 +161,7 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update
var make_event_handler = func(predicate, layer) func predicate(me, layer);
me.layers={}; # storage container for all ND specific layers
me.predicates={};
# look up all required layers as specified per the NDStyle hash and do the initial setup for event handling
var default_opts = me.options != nil and contains(me.options, "defaults") ? me.options.defaults : nil;
foreach(var layer; me.nd_style.layers) {
@ -215,6 +216,7 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update
# pass the ND instance and the layer handle to the predicate when it is called
# so that it can directly access the ND instance and its own layer (without having to know the layer"s name)
var event_handler = make_event_handler(layer.predicate, the_layer);
me.predicates[layer.name] = event_handler;
foreach(var event; layer.update_on) {
# this handles timers
if (typeof(event)=="hash" and contains(event, "rate_hz")) {

View file

@ -28,6 +28,12 @@ var SwitchingPanel = {
doAttHdg: func(newAttHdg) {
if (newAttHdg < -1 or newAttHdg > 1) { return; }
me.Switches.attHdg.setValue(newAttHdg);
foreach (var predicate; keys(canvas_nd.ND_1.NDCpt.predicates)) {
call(canvas_nd.ND_1.NDCpt.predicates[predicate]);
}
foreach (var predicate; keys(canvas_nd.ND_2.NDFo.predicates)) {
call(canvas_nd.ND_2.NDFo.predicates[predicate]);
}
},
doEisDMC: func(newDMC) {
if (newDMC < -1 or newDMC > 1) { return; }

View file

@ -117,6 +117,12 @@ var ADIRU = {
if (me.alignTimer != nil) {
me.alignTimer.stop();
}
foreach (var predicate; keys(canvas_nd.ND_1.NDCpt.predicates)) {
call(canvas_nd.ND_1.NDCpt.predicates[predicate]);
}
foreach (var predicate; keys(canvas_nd.ND_2.NDFo.predicates)) {
call(canvas_nd.ND_2.NDFo.predicates[predicate]);
}
},
stopAlignAligned: func() {
me.inAlign = 0;
@ -126,6 +132,12 @@ var ADIRU = {
if (me.alignTimer != nil) {
me.alignTimer.stop();
}
foreach (var predicate; keys(canvas_nd.ND_1.NDCpt.predicates)) {
call(canvas_nd.ND_1.NDCpt.predicates[predicate]);
}
foreach (var predicate; keys(canvas_nd.ND_2.NDFo.predicates)) {
call(canvas_nd.ND_2.NDFo.predicates[predicate]);
}
},
alignLoop: func() {
me._roll = pts.Orientation.roll.getValue();