1
0
Fork 0

CDU: command interfacing

This allows external processes to drive the CDU via custom commands.
See https://github.com/zakalawe/simpit/tree/master/simCDUDriver for
an example of sending such commands.
This commit is contained in:
James Turner 2018-12-19 17:22:39 +00:00
parent a91ebe4676
commit ad10f5fbde

View file

@ -605,6 +605,7 @@ var CDU = {
m._oleoSwitchNode = props.globals.getNode('instrumentation/fmc/discretes/oleo-switch-flight', 1);
m._setupCanvas(placement);
m._setupCommands();
m._page = nil;
m._model = nil;
@ -680,6 +681,50 @@ var CDU = {
}
},
_buttonCallbackTable: {
'exec': func() { Boeing.cdu.button_exec(); },
'prog': func() { Boeing.cdu.displayPageByTag('progress'); },
'hold': func() { print("Not implemented yet");},
'cruise': func() { Boeing.cdu.displayPageByTag('cruise'); },
'dep-arr': func() { Boeing.cdu.button_dep_arr(); },
'legs': func() { Boeing.cdu.button_legs(); },
'menu': func() { Boeing.cdu.displayPageByTag('menu'); },
'climb': func() { Boeing.cdu.displayPageByTag('climb'); },
'fix': func() { Boeing.cdu.displayPageByTag('fix'); },
'n1-limit': func() { print("Not implemented yet");},
'route': func() { Boeing.cdu.button_route(); },
'next-page': func() { Boeing.cdu.next_page(); },
'prev-page': func() { Boeing.cdu.prev_page(); },
'descent': func() { Boeing.cdu.displayPageByTag('descent'); },
'init-ref': func() { Boeing.cdu.displayPageByTag('index'); },
'clear': func() { Boeing.cdu.clear(); },
'delete': func() { Boeing.cdu.delete(); },
'plus-minus': func() { Boeing.cdu.plusminus(); }
},
_keyCommandCallback: func(node)
{
var k = node.getChild("key").getValue();
Boeing.cdu.input(chr(k));
},
_lskCommandCallback: func(node)
{
var keyName = node.getChild("lsk").getValue();
Boeing.cdu.lsk(keyName);
},
# register commands used for interfacing external CDU hardware
_setupCommands: func()
{
addcommand('cdu-key', me._keyCommandCallback);
addcommand('cdu-lsk', me._lskCommandCallback);
foreach(var b; keys(me._buttonCallbackTable)) {
addcommand('cdu-button-' ~ b , me._buttonCallbackTable[b]);
}
},
rowForLine: func(line)
{
return (line * 2) + 2;