1 contributor
var buttonsClass = {
new : func (device) {
var m = { parents: [ buttonsClass ] };
m.device = device;
return m;
},
PAN : func (xdir = 0, ydir = 0) {
},
AsSwitchNAV : func {
var n = getprop('/instrumentation/zkv1000/radios/nav-tune');
var tmp = getprop('/instrumentation/nav[' ~ n ~ ']/frequencies/selected-mhz');
setprop('/instrumentation/nav[' ~ n ~ ']/frequencies/selected-mhz', getprop('/instrumentation/nav[' ~ n ~ ']/frequencies/standby-mhz'));
setprop('/instrumentation/nav[' ~ n ~ ']/frequencies/standby-mhz', tmp);
foreach (var c; keys(flightdeck))
if (contains(flightdeck[c], 'display'))
flightdeck[c].display.updateNAV({refresh: n+1});
},
AsSwitchCOM : func (x) {
if (x) {
me.AsSwitchCOM_pushed = getprop('/sim/time/elapsed-sec');
}
else {
var pressed = getprop('/sim/time/elapsed-sec') - me.AsSwitchCOM_pushed;
if (pressed > 2) {
setprop('/instrumentation/comm/frequencies/selected-mhz', 121.500);
setprop('/instrumentation/zkv1000/radios/comm1-selected', 1);
setprop('/instrumentation/zkv1000/radios/comm2-selected', 0);
foreach (var d; keys(flightdeck))
if (contains(flightdeck[d], 'display')) {
flightdeck[d].display.updateCOMM({refresh: 1});
flightdeck[d].display.updateCOMM({refresh: 2});
}
}
else {
var c = getprop('/instrumentation/zkv1000/radios/comm-tune');
var tmp = getprop('/instrumentation/comm[' ~ c ~ ']/frequencies/selected-mhz');
setprop('/instrumentation/comm[' ~ c ~ ']/frequencies/selected-mhz', getprop('/instrumentation/comm[' ~ c ~ ']/frequencies/standby-mhz'));
setprop('/instrumentation/comm[' ~ c ~ ']/frequencies/standby-mhz', tmp);
foreach (var d; keys(flightdeck))
if (contains(flightdeck[d], 'display'))
flightdeck[d].display.updateCOMM({refresh: c+1});
}
}
},
ALT : func () {
var alt = getprop('instrumentation/altimeter/indicated-altitude-ft');
setprop('/instrumentation/zkv1000/afcs/selected-alt-ft', math.round(alt, 10));
},
ValidateTMRREF : func (a = 0) {
if (a)
return;
var (id, selected) = split('-', me.device.windows.selected);
var state = me.device.windows.state[id];
selected += state.scroll.offset;
if (contains(state.objects[selected], 'callback'))
call(state.objects[selected].callback, [id, selected], me);
},
ClearTMRREF : func (a = 0) {
if (a)
return;
me.device.windows.del();
me.device.data.TMRtimer = nil;
me.device.knobs.FmsInner = func;
me.device.knobs.FmsOuter = func;
me.device.buttons.ENT = func;
me.device.buttons.FMS = func;
me.device.buttons.CLR = func;
},
MFD_page_wrapper : func (id, selected) {
var s = me.device.data[id][me.device.display['page selected']];
var group = s.name;
var subpage = s.objects[selected].text;
if (contains(me.device.display.MFD, group)) {
if (contains(me.device.display.MFD[group], subpage))
me.device.display.MFD[group][subpage]();
else
msg('page ' ~ group ~ '/' ~ subpage ~ ' not yet implemented');
}
else
msg('nothing is implemented yet in group ' ~ group);
foreach (var k; keys(me.device.windows.window))
if (find(id, k) == 0)
me.device.windows.del(k);
me.device.buttons.ENT = func;
me.device.knobs.FmsInner = func;
},
DirectTo : void,
MENU : void,
FPL : void,
PROC : void,
CLR : void,
ENT : void,
FMS : void,
};