var input = func(v) { setprop("/instrumentation/cdu/input",getprop("/instrumentation/cdu/input")~v); } var input = func(v) { setprop("/instrumentation/cdu/input",getprop("/instrumentation/cdu/input")~v); } var key = func(v) { var cduDisplay = getprop("/instrumentation/cdu/display"); var serviceable = getprop("/instrumentation/cdu/serviceable"); var eicasDisplay = getprop("/instrumentation/eicas/display"); var cduInput = getprop("/instrumentation/cdu/input"); if (serviceable == 1){ if (v == "LSK1L"){ if (cduDisplay == "DEP_ARR_INDEX"){ cduDisplay = "RTE1_DEP"; } if (cduDisplay == "EICAS_MODES"){ eicasDisplay = "ENG"; } if (cduDisplay == "EICAS_SYN"){ eicasDisplay = "ELEC"; } if (cduDisplay == "INIT_REF"){ cduDisplay = "IDENT"; } if (cduDisplay == "NAV_RAD"){ setprop("/instrumentation/nav[0]/frequencies/selected-mhz",cduInput); cduInput = ""; } if (cduDisplay == "RTE1_1"){ setprop("/autopilot/route-manager/departure/airport",cduInput); cduInput = ""; } if (cduDisplay == "RTE1_LEGS"){ if (cduInput == "DELETE"){ setprop("/autopilot/route-manager/input","@DELETE1"); cduInput = ""; }else{ setprop("/autopilot/route-manager/input","@INSERT2:"~cduInput); } } if (cduDisplay == "TO_REF"){ setprop("/instrumentation/fmc/to-flap",cduInput); cduInput = ""; } } if (v == "LSK1R"){ if (cduDisplay == "EICAS_MODES"){ eicasDisplay = "FUEL"; } if (cduDisplay == "EICAS_SYN"){ eicasDisplay = "HYD"; } if (cduDisplay == "NAV RAD"){ setprop("/instrumentation/nav[1]/frequencies/selected-mhz",cduInput); cduInput = ""; } if (cduDisplay == "RTE1_1"){ setprop("/autopilot/route-manager/destination/airport",cduInput); cduInput = ""; } if (cduDisplay == "RTE1_LEGS"){ setprop("/autopilot/route-manager/route/wp[1]/altitude-ft",cduInput); if (substr(cduInput,0,2) == "FL"){ setprop("/autopilot/route-manager/route/wp[1]/altitude-ft",substr(cduInput,2)*100); } cduInput = ""; } } if (v == "LSK2L"){ if (cduDisplay == "EICAS_MODES"){ eicasDisplay = "STAT"; } if (cduDisplay == "EICAS_SYN"){ eicasDisplay = "ECS"; } if (cduDisplay == "POS_INIT"){ setprop("/instrumentation/fmc/ref-airport",cduInput); cduInput = "";; } if (cduDisplay == "INIT_REF"){ cduDisplay = "POS_INIT"; } if (cduDisplay == "RTE1_1"){ setprop("/autopilot/route-manager/departure/runway",cduInput); cduInput = "";; } if (cduDisplay == "RTE1_LEGS"){ if (cduInput == "DELETE"){ setprop("/autopilot/route-manager/input","@DELETE2"); cduInput = ""; }else{ setprop("/autopilot/route-manager/input","@INSERT3:"~cduInput); } } } if (v == "LSK2R"){ if (cduDisplay == "DEP_ARR_INDEX"){ cduDisplay = "RTE1_ARR"; }else if (cduDisplay == "EICAS_MODES"){ eicasDisplay = "GEAR"; }else if (cduDisplay == "EICAS_SYN"){ eicasDisplay = "DRS"; }else if (cduDisplay == "MENU"){ eicasDisplay = "EICAS_MODES"; }else if (cduDisplay == "RTE1_LEGS"){ setprop("/autopilot/route-manager/route/wp[2]/altitude-ft",cduInput); if (substr(cduInput,0,2) == "FL"){ setprop("/autopilot/route-manager/route/wp[2]/altitude-ft",substr(cduInput,2)*100); } cduInput = ""; } } if (v == "LSK3L"){ if (cduDisplay == "INIT_REF"){ cduDisplay = "PERF_INIT"; } if (cduDisplay == "RTE1_LEGS"){ if (cduInput == "DELETE"){ setprop("/autopilot/route-manager/input","@DELETE3"); cduInput = ""; }else{ setprop("/autopilot/route-manager/input","@INSERT4:"~cduInput); } } } if (v == "LSK3R"){ if (cduDisplay == "RTE1_LEGS"){ setprop("/autopilot/route-manager/route/wp[3]/altitude-ft",cduInput); if (substr(cduInput,0,2) == "FL"){ setprop("/autopilot/route-manager/route/wp[3]/altitude-ft",substr(cduInput,2)*100); } cduInput = ""; } } if (v == "LSK4L"){ if (cduDisplay == "INIT_REF"){ cduDisplay = "THR_LIM"; } if (cduDisplay == "RTE1_LEGS"){ if (cduInput == "DELETE"){ setprop("/autopilot/route-manager/input","@DELETE4"); cduInput = ""; }else{ setprop("/autopilot/route-manager/input","@INSERT5:"~cduInput); } } } if (v == "LSK4R"){ if (cduDisplay == "RTE1_LEGS"){ setprop("/autopilot/route-manager/route/wp[4]/altitude-ft",cduInput); if (substr(cduInput,0,2) == "FL"){ setprop("/autopilot/route-manager/route/wp[4]/altitude-ft",substr(cduInput,2)*100); } cduInput = ""; } } if (v == "LSK5L"){ if (cduDisplay == "INIT_REF"){ cduDisplay = "TO_REF"; } if (cduDisplay == "RTE1_LEGS"){ if (cduInput == "DELETE"){ setprop("/autopilot/route-manager/input","@DELETE5"); cduInput = ""; }else{ setprop("/autopilot/route-manager/input","@INSERT6:"~cduInput); } } } if (v == "LSK5R"){ if (cduDisplay == "RTE1_LEGS"){ setprop("/autopilot/route-manager/route/wp[5]/altitude-ft",cduInput); if (substr(cduInput,0,2) == "FL"){ setprop("/autopilot/route-manager/route/wp[5]/altitude-ft",substr(cduInput,2)*100); } cduInput = ""; } } if (v == "LSK6L"){ if (cduDisplay == "INIT_REF"){ cduDisplay = "APP_REF"; } if (cduDisplay == "APP_REF"){ cduDisplay = "INIT_REF"; } if ((cduDisplay == "IDENT") or (cduDisplay = "MAINT") or (cduDisplay = "PERF_INIT") or (cduDisplay = "POS_INIT") or (cduDisplay = "POS_REF") or (cduDisplay = "THR_LIM") or (cduDisplay = "TO_REF")){ cduDisplay = "INIT_REF"; } } if (v == "LSK6R"){ if (cduDisplay == "THR_LIM"){ cduDisplay = "TO_REF"; } else if (cduDisplay == "APP_REF"){ cduDisplay = "THR_LIM"; }else if ((cduDisplay == "RTE1_1") or (cduDisplay == "RTE1_LEGS")){ setprop("/autopilot/route-manager/input","@ACTIVATE"); }else if ((cduDisplay == "POS_INIT") or (cduDisplay == "DEP") or (cduDisplay == "RTE1_ARR") or (cduDisplay == "RTE1_DEP")){ cduDisplay = "RTE1_1"; }else if ((cduDisplay == "IDENT") or (cduDisplay == "TO_REF")){ cduDisplay = "POS_INIT"; }else if (cduDisplay == "EICAS_SYN"){ cduDisplay = "EICAS_MODES"; }else if (cduDisplay == "EICAS_MODES"){ cduDisplay = "EICAS_SYN"; }else if (cduDisplay == "INIT_REF"){ cduDisplay = "MAINT"; } } setprop("/instrumentation/cdu/display",cduDisplay); if (eicasDisplay != nil){ setprop("/instrumentation/eicas/display",eicasDisplay); } setprop("/instrumentation/cdu/input",cduInput); } } var delete = func { var length = size(getprop("/instrumentation/cdu/input")) - 1; setprop("/instrumentation/cdu/input",substr(getprop("/instrumentation/cdu/input"),0,length)); } var i = 0; var plusminus = func { var end = size(getprop("/instrumentation/cdu/input")); var start = end - 1; var lastchar = substr(getprop("/instrumentation/cdu/input"),start,end); if (lastchar == "+"){ me.delete(); me.input('-'); } if (lastchar == "-"){ me.delete(); me.input('+'); } if ((lastchar != "-") and (lastchar != "+")){ me.input('+'); } } var cdu = func{ var display = getprop("/instrumentation/cdu/display"); var serviceable = getprop("/instrumentation/cdu/serviceable"); title = ""; page = ""; line1l = ""; line2l = ""; line3l = ""; line4l = ""; line5l = ""; line6l = ""; line1lt = ""; line2lt = ""; line3lt = ""; line4lt = ""; line5lt = ""; line6lt = ""; line1c = ""; line2c = ""; line3c = ""; line4c = ""; line5c = ""; line6c = ""; line1ct = ""; line2ct = ""; line3ct = ""; line4ct = ""; line5ct = ""; line6ct = ""; line1r = ""; line2r = ""; line3r = ""; line4r = ""; line5r = ""; line6r = ""; line1rt = ""; line2rt = ""; line3rt = ""; line4rt = ""; line5rt = ""; line6rt = ""; if (display == "MENU") { title = "MENU"; line1l = "