cdu.nas 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. var input = func(v) {
  2. setprop("/instrumentation/cdu/input",getprop("/instrumentation/cdu/input")~v);
  3. }
  4. var input = func(v) {
  5. setprop("/instrumentation/cdu/input",getprop("/instrumentation/cdu/input")~v);
  6. }
  7. var key = func(v) {
  8. var cduDisplay = getprop("/instrumentation/cdu/display");
  9. var serviceable = getprop("/instrumentation/cdu/serviceable");
  10. var eicasDisplay = getprop("/instrumentation/eicas/display");
  11. var cduInput = getprop("/instrumentation/cdu/input");
  12. if (serviceable == 1){
  13. if (v == "LSK1L"){
  14. if (cduDisplay == "DEP_ARR_INDEX"){
  15. cduDisplay = "RTE1_DEP";
  16. }
  17. if (cduDisplay == "EICAS_MODES"){
  18. eicasDisplay = "ENG";
  19. }
  20. if (cduDisplay == "EICAS_SYN"){
  21. eicasDisplay = "ELEC";
  22. }
  23. if (cduDisplay == "INIT_REF"){
  24. cduDisplay = "IDENT";
  25. }
  26. if (cduDisplay == "NAV_RAD"){
  27. setprop("/instrumentation/nav[0]/frequencies/selected-mhz",cduInput);
  28. cduInput = "";
  29. }
  30. if (cduDisplay == "RTE1_1"){
  31. setprop("/autopilot/route-manager/departure/airport",cduInput);
  32. cduInput = "";
  33. }
  34. if (cduDisplay == "RTE1_LEGS"){
  35. if (cduInput == "DELETE"){
  36. setprop("/autopilot/route-manager/input","@DELETE1");
  37. cduInput = "";
  38. }else{
  39. setprop("/autopilot/route-manager/input","@INSERT2:"~cduInput);
  40. }
  41. }
  42. if (cduDisplay == "TO_REF"){
  43. setprop("/instrumentation/fmc/to-flap",cduInput);
  44. cduInput = "";
  45. }
  46. }
  47. if (v == "LSK1R"){
  48. if (cduDisplay == "EICAS_MODES"){
  49. eicasDisplay = "FUEL";
  50. }
  51. if (cduDisplay == "EICAS_SYN"){
  52. eicasDisplay = "HYD";
  53. }
  54. if (cduDisplay == "NAV RAD"){
  55. setprop("/instrumentation/nav[1]/frequencies/selected-mhz",cduInput);
  56. cduInput = "";
  57. }
  58. if (cduDisplay == "RTE1_1"){
  59. setprop("/autopilot/route-manager/destination/airport",cduInput);
  60. cduInput = "";
  61. }
  62. if (cduDisplay == "RTE1_LEGS"){
  63. setprop("/autopilot/route-manager/route/wp[1]/altitude-ft",cduInput);
  64. if (substr(cduInput,0,2) == "FL"){
  65. setprop("/autopilot/route-manager/route/wp[1]/altitude-ft",substr(cduInput,2)*100);
  66. }
  67. cduInput = "";
  68. }
  69. }
  70. if (v == "LSK2L"){
  71. if (cduDisplay == "EICAS_MODES"){
  72. eicasDisplay = "STAT";
  73. }
  74. if (cduDisplay == "EICAS_SYN"){
  75. eicasDisplay = "ECS";
  76. }
  77. if (cduDisplay == "POS_INIT"){
  78. setprop("/instrumentation/fmc/ref-airport",cduInput);
  79. cduInput = "";;
  80. }
  81. if (cduDisplay == "INIT_REF"){
  82. cduDisplay = "POS_INIT";
  83. }
  84. if (cduDisplay == "RTE1_1"){
  85. setprop("/autopilot/route-manager/departure/runway",cduInput);
  86. cduInput = "";;
  87. }
  88. if (cduDisplay == "RTE1_LEGS"){
  89. if (cduInput == "DELETE"){
  90. setprop("/autopilot/route-manager/input","@DELETE2");
  91. cduInput = "";
  92. }else{
  93. setprop("/autopilot/route-manager/input","@INSERT3:"~cduInput);
  94. }
  95. }
  96. }
  97. if (v == "LSK2R"){
  98. if (cduDisplay == "DEP_ARR_INDEX"){
  99. cduDisplay = "RTE1_ARR";
  100. }else if (cduDisplay == "EICAS_MODES"){
  101. eicasDisplay = "GEAR";
  102. }else if (cduDisplay == "EICAS_SYN"){
  103. eicasDisplay = "DRS";
  104. }else if (cduDisplay == "MENU"){
  105. eicasDisplay = "EICAS_MODES";
  106. }else if (cduDisplay == "RTE1_LEGS"){
  107. setprop("/autopilot/route-manager/route/wp[2]/altitude-ft",cduInput);
  108. if (substr(cduInput,0,2) == "FL"){
  109. setprop("/autopilot/route-manager/route/wp[2]/altitude-ft",substr(cduInput,2)*100);
  110. }
  111. cduInput = "";
  112. }
  113. }
  114. if (v == "LSK3L"){
  115. if (cduDisplay == "INIT_REF"){
  116. cduDisplay = "PERF_INIT";
  117. }
  118. if (cduDisplay == "RTE1_LEGS"){
  119. if (cduInput == "DELETE"){
  120. setprop("/autopilot/route-manager/input","@DELETE3");
  121. cduInput = "";
  122. }else{
  123. setprop("/autopilot/route-manager/input","@INSERT4:"~cduInput);
  124. }
  125. }
  126. }
  127. if (v == "LSK3R"){
  128. if (cduDisplay == "RTE1_LEGS"){
  129. setprop("/autopilot/route-manager/route/wp[3]/altitude-ft",cduInput);
  130. if (substr(cduInput,0,2) == "FL"){
  131. setprop("/autopilot/route-manager/route/wp[3]/altitude-ft",substr(cduInput,2)*100);
  132. }
  133. cduInput = "";
  134. }
  135. }
  136. if (v == "LSK4L"){
  137. if (cduDisplay == "INIT_REF"){
  138. cduDisplay = "THR_LIM";
  139. }
  140. if (cduDisplay == "RTE1_LEGS"){
  141. if (cduInput == "DELETE"){
  142. setprop("/autopilot/route-manager/input","@DELETE4");
  143. cduInput = "";
  144. }else{
  145. setprop("/autopilot/route-manager/input","@INSERT5:"~cduInput);
  146. }
  147. }
  148. }
  149. if (v == "LSK4R"){
  150. if (cduDisplay == "RTE1_LEGS"){
  151. setprop("/autopilot/route-manager/route/wp[4]/altitude-ft",cduInput);
  152. if (substr(cduInput,0,2) == "FL"){
  153. setprop("/autopilot/route-manager/route/wp[4]/altitude-ft",substr(cduInput,2)*100);
  154. }
  155. cduInput = "";
  156. }
  157. }
  158. if (v == "LSK5L"){
  159. if (cduDisplay == "INIT_REF"){
  160. cduDisplay = "TO_REF";
  161. }
  162. if (cduDisplay == "RTE1_LEGS"){
  163. if (cduInput == "DELETE"){
  164. setprop("/autopilot/route-manager/input","@DELETE5");
  165. cduInput = "";
  166. }else{
  167. setprop("/autopilot/route-manager/input","@INSERT6:"~cduInput);
  168. }
  169. }
  170. }
  171. if (v == "LSK5R"){
  172. if (cduDisplay == "RTE1_LEGS"){
  173. setprop("/autopilot/route-manager/route/wp[5]/altitude-ft",cduInput);
  174. if (substr(cduInput,0,2) == "FL"){
  175. setprop("/autopilot/route-manager/route/wp[5]/altitude-ft",substr(cduInput,2)*100);
  176. }
  177. cduInput = "";
  178. }
  179. }
  180. if (v == "LSK6L"){
  181. if (cduDisplay == "INIT_REF"){
  182. cduDisplay = "APP_REF";
  183. }
  184. if (cduDisplay == "APP_REF"){
  185. cduDisplay = "INIT_REF";
  186. }
  187. 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")){
  188. cduDisplay = "INIT_REF";
  189. }
  190. }
  191. if (v == "LSK6R"){
  192. if (cduDisplay == "THR_LIM"){
  193. cduDisplay = "TO_REF";
  194. }
  195. else if (cduDisplay == "APP_REF"){
  196. cduDisplay = "THR_LIM";
  197. }else if ((cduDisplay == "RTE1_1") or (cduDisplay == "RTE1_LEGS")){
  198. setprop("/autopilot/route-manager/input","@ACTIVATE");
  199. }else if ((cduDisplay == "POS_INIT") or (cduDisplay == "DEP") or (cduDisplay == "RTE1_ARR") or (cduDisplay == "RTE1_DEP")){
  200. cduDisplay = "RTE1_1";
  201. }else if ((cduDisplay == "IDENT") or (cduDisplay == "TO_REF")){
  202. cduDisplay = "POS_INIT";
  203. }else if (cduDisplay == "EICAS_SYN"){
  204. cduDisplay = "EICAS_MODES";
  205. }else if (cduDisplay == "EICAS_MODES"){
  206. cduDisplay = "EICAS_SYN";
  207. }else if (cduDisplay == "INIT_REF"){
  208. cduDisplay = "MAINT";
  209. }
  210. }
  211. setprop("/instrumentation/cdu/display",cduDisplay);
  212. if (eicasDisplay != nil){
  213. setprop("/instrumentation/eicas/display",eicasDisplay);
  214. }
  215. setprop("/instrumentation/cdu/input",cduInput);
  216. }
  217. }
  218. var delete = func {
  219. var length = size(getprop("/instrumentation/cdu/input")) - 1;
  220. setprop("/instrumentation/cdu/input",substr(getprop("/instrumentation/cdu/input"),0,length));
  221. }
  222. var i = 0;
  223. var plusminus = func {
  224. var end = size(getprop("/instrumentation/cdu/input"));
  225. var start = end - 1;
  226. var lastchar = substr(getprop("/instrumentation/cdu/input"),start,end);
  227. if (lastchar == "+"){
  228. me.delete();
  229. me.input('-');
  230. }
  231. if (lastchar == "-"){
  232. me.delete();
  233. me.input('+');
  234. }
  235. if ((lastchar != "-") and (lastchar != "+")){
  236. me.input('+');
  237. }
  238. }
  239. var cdu = func{
  240. var display = getprop("/instrumentation/cdu/display");
  241. var serviceable = getprop("/instrumentation/cdu/serviceable");
  242. title = ""; page = "";
  243. line1l = ""; line2l = ""; line3l = ""; line4l = ""; line5l = ""; line6l = "";
  244. line1lt = ""; line2lt = ""; line3lt = ""; line4lt = ""; line5lt = ""; line6lt = "";
  245. line1c = ""; line2c = ""; line3c = ""; line4c = ""; line5c = ""; line6c = "";
  246. line1ct = ""; line2ct = ""; line3ct = ""; line4ct = ""; line5ct = ""; line6ct = "";
  247. line1r = ""; line2r = ""; line3r = ""; line4r = ""; line5r = ""; line6r = "";
  248. line1rt = ""; line2rt = ""; line3rt = ""; line4rt = ""; line5rt = ""; line6rt = "";
  249. if (display == "MENU") {
  250. title = "MENU";
  251. line1l = "<FMC";
  252. line1rt = "EFIS CP";
  253. line1r = "SELECT>";
  254. line2l = "<ACARS";
  255. line2rt = "EICAS CP";
  256. line2r = "SELECT>";
  257. line6l = "<ACMS";
  258. line6r = "CMC>";
  259. }
  260. if (display == "ALTN_NAV_RAD") {
  261. title = "ALTN NAV RADIO";
  262. }
  263. if (display == "APP_REF") {
  264. title = "APPROACH REF";
  265. line1lt = "GROSS WT";
  266. line1rt = "FLAPS VREF";
  267. if (getprop("/instrumentation/fmc/vspeeds/Vref") != nil){
  268. line1l = getprop("/instrumentation/fmc/vspeeds/Vref");
  269. }
  270. if (getprop("/autopilot/route-manager/destination/airport") != nil){
  271. line4lt = getprop("/autopilot/route-manager/destination/airport");
  272. }
  273. line6l = "<INDEX";
  274. line6r = "THRUST LIM>";
  275. }
  276. if (display == "DEP_ARR_INDEX") {
  277. title = "DEP/ARR INDEX";
  278. line1l = "<DEP";
  279. line1ct = "RTE 1";
  280. if (getprop("/autopilot/route-manager/departure/airport") != nil){
  281. line1c = getprop("/autopilot/route-manager/departure/airport");
  282. }
  283. line1r = "ARR>";
  284. if (getprop("/autopilot/route-manager/destination/airport") != nil){
  285. line2c = getprop("/autopilot/route-manager/destination/airport");
  286. }
  287. line2r = "ARR>";
  288. line3l = "<DEP";
  289. line3r = "ARR>";
  290. line4r = "ARR>";
  291. line6lt ="DEP";
  292. line6l = "<----";
  293. line6c = "OTHER";
  294. line6rt ="ARR";
  295. line6r = "---->";
  296. }
  297. if (display == "EICAS_MODES") {
  298. title = "EICAS MODES";
  299. line1l = "<ENG";
  300. line1r = "FUEL>";
  301. line2l = "<STAT";
  302. line2r = "GEAR>";
  303. line5l = "<CANC";
  304. line5r = "RCL>";
  305. line6r = "SYNOPTICS>";
  306. }
  307. if (display == "EICAS_SYN") {
  308. title = "EICAS SYNOPTICS";
  309. line1l = "<ELEC";
  310. line1r = "HYD>";
  311. line2l = "<ECS";
  312. line2r = "DOORS>";
  313. line5l = "<CANC";
  314. line5r = "RCL>";
  315. line6r = "MODES>";
  316. }
  317. if (display == "FIX_INFO") {
  318. title = "FIX INFO";
  319. line1l = sprintf("%3.2f", getprop("/instrumentation/nav[0]/frequencies/selected-mhz-fmt"));
  320. line1r = sprintf("%3.2f", getprop("/instrumentation/nav[1]/frequencies/selected-mhz-fmt"));
  321. line2l = sprintf("%3.2f", getprop("/instrumentation/nav[0]/radials/selected-deg"));
  322. line2r = sprintf("%3.2f", getprop("/instrumentation/nav[1]/radials/selected-deg"));
  323. line6l = "<ERASE FIX";
  324. }
  325. if (display == "IDENT") {
  326. title = "IDENT";
  327. line1lt = "MODEL";
  328. if (getprop("/instrumentation/cdu/ident/model") != nil){
  329. line1l = getprop("/instrumentation/cdu/ident/model");
  330. }
  331. line1rt = "ENGINES";
  332. line2lt = "NAV DATA";
  333. if (getprop("/instrumentation/cdu/ident/engines") != nil){
  334. line1r = getprop("/instrumentation/cdu/ident/engines");
  335. }
  336. line6l = "<INDEX";
  337. line6r = "POS INIT>";
  338. }
  339. if (display == "INIT_REF") {
  340. title = "INIT/REF INDEX";
  341. line1l = "<IDENT";
  342. line1r = "NAV DATA>";
  343. line2l = "<POS";
  344. line3l = "<PERF";
  345. line4l = "<THRUST LIM";
  346. line5l = "<TAKEOFF";
  347. line6l = "<APPROACH";
  348. line6r = "MAINT>";
  349. }
  350. if (display == "MAINT") {
  351. title = "MAINTENANCE INDEX";
  352. line1l = "<CROS LOAD";
  353. line1r = "BITE>";
  354. line2l = "<PERF FACTORS";
  355. line3l = "<IRS MONITOR";
  356. line6l = "<INDEX";
  357. }
  358. if (display == "NAV_RAD") {
  359. title = "NAV RADIO";
  360. line1lt = "VOR L";
  361. line1l = sprintf("%3.2f", getprop("/instrumentation/nav[0]/frequencies/selected-mhz-fmt"));
  362. line1rt = "VOR R";
  363. line1r = sprintf("%3.2f", getprop("/instrumentation/nav[1]/frequencies/selected-mhz-fmt"));
  364. line2lt = "CRS";
  365. line2ct = "RADIAL";
  366. line2c = sprintf("%3.2f", getprop("/instrumentation/nav[0]/radials/selected-deg"))~" "~sprintf("%3.2f", getprop("/instrumentation/nav[1]/radials/selected-deg"));
  367. line2rt = "CRS";
  368. line3lt = "ADF L";
  369. line3l = sprintf("%3.2f", getprop("/instrumentation/adf[0]/frequencies/selected-khz"));
  370. line3rt = "ADF R";
  371. }
  372. if (display == "PERF_INIT") {
  373. title = "PERF INIT";
  374. line1lt = "GR WT";
  375. line1rt = "CRZ ALT";
  376. line1r = getprop("/autopilot/route-manager/cruise/altitude-ft");
  377. line2lt = "FUEL";
  378. line3lt = "ZFW";
  379. line4lt = "RESERVES";
  380. line4rt = "CRZ CG";
  381. line5lt = "COST INDEX";
  382. line5rt = "STEP SIZE";
  383. line6l = "<INDEX";
  384. line6r = "THRUST LIM>";
  385. if (getprop("/sim/flight-model") == "jsb") {
  386. line1l = sprintf("%3.1f", (getprop("/fdm/jsbsim/inertia/weight-lbs")/1000));
  387. line2l = sprintf("%3.1f", (getprop("/fdm/jsbsim/propulsion/total-fuel-lbs")/1000));
  388. line3l = sprintf("%3.1f", (getprop("/fdm/jsbsim/inertia/empty-weight-lbs")/1000));
  389. }elsif (getprop("/sim/flight-model") == "yasim") {
  390. line1l = sprintf("%3.1f", (getprop("/yasim/gross-weight-lbs")/1000));
  391. line2l = sprintf("%3.1f", (getprop("/consumables/fuel/total-fuel-lbs")/1000));
  392. yasim_emptyweight = getprop("/yasim/gross-weight-lbs");
  393. yasim_emptyweight -= getprop("/consumables/fuel/total-fuel-lbs");
  394. yasim_weights = props.globals.getNode("/sim").getChildren("weight");
  395. for (i = 0; i < size(yasim_weights); i += 1) {
  396. yasim_emptyweight -= yasim_weights[i].getChild("weight-lb").getValue();
  397. }
  398. line3l = sprintf("%3.1f", yasim_emptyweight/1000);
  399. }
  400. }
  401. if (display == "POS_INIT") {
  402. title = "POS INIT";
  403. line6l = "<INDEX";
  404. line6r = "ROUTE>";
  405. }
  406. if (display == "POS_REF") {
  407. title = "POS REF";
  408. line1lt = "FMC POST";
  409. line1l = getprop("/position/latitude-string")~" "~getprop("/position/longitude-string");
  410. line1rt = "GS";
  411. line1r = sprintf("%3.0f", getprop("/velocities/groundspeed-kt"));
  412. line5l = "<PURGE";
  413. line5r = "INHIBIT>";
  414. line6l = "<INDEX";
  415. line6r = "BRG/DIST>";
  416. }
  417. if (display == "RTE1_1") {
  418. title = "RTE 1";
  419. page = "1/2";
  420. line1lt = "ORIGIN";
  421. if (getprop("/autopilot/route-manager/departure/airport") != nil){
  422. line1l = getprop("/autopilot/route-manager/departure/airport");
  423. }
  424. line1rt = "DEST";
  425. if (getprop("/autopilot/route-manager/destination/airport") != nil){
  426. line1r = getprop("/autopilot/route-manager/destination/airport");
  427. }
  428. line2lt = "RUNWAY";
  429. if (getprop("/autopilot/route-manager/departure/runway") != nil){
  430. line2l = getprop("/autopilot/route-manager/departure/runway");
  431. }
  432. line2rt = "FLT NO";
  433. line3rt = "CO ROUTE";
  434. line5l = "<RTE COPY";
  435. line6l = "<RTE 2";
  436. if (getprop("/autopilot/route-manager/active") == 1){
  437. line6r = "PERF INIT>";
  438. }else {
  439. line6r = "ACTIVATE>";
  440. }
  441. }
  442. if (display == "RTE1_2") {
  443. title = "RTE 1";
  444. page = "2/2";
  445. line1lt = "VIA";
  446. line1rt = "TO";
  447. if (getprop("/autopilot/route-manager/route/wp[1]/id") != nil){
  448. line1r = getprop("/autopilot/route-manager/route/wp[1]/id");
  449. }
  450. if (getprop("/autopilot/route-manager/route/wp[2]/id") != nil){
  451. line2r = getprop("/autopilot/route-manager/route/wp[2]/id");
  452. }
  453. if (getprop("/autopilot/route-manager/route/wp[3]/id") != nil){
  454. line3r = getprop("/autopilot/route-manager/route/wp[3]/id");
  455. }
  456. if (getprop("/autopilot/route-manager/route/wp[4]/id") != nil){
  457. line4r = getprop("/autopilot/route-manager/route/wp[4]/id");
  458. }
  459. if (getprop("/autopilot/route-manager/route/wp[5]/id") != nil){
  460. line5r = getprop("/autopilot/route-manager/route/wp[5]/id");
  461. }
  462. line6l = "<RTE 2";
  463. line6r = "ACTIVATE>";
  464. }
  465. if (display == "RTE1_ARR") {
  466. if (getprop("/autopilot/route-manager/destination/airport") != nil){
  467. title = getprop("/autopilot/route-manager/destination/airport")~" ARRIVALS";
  468. }else{
  469. title = "ARRIVALS";
  470. }
  471. line1lt = "STARS";
  472. line1rt = "APPROACHES";
  473. if (getprop("/autopilot/route-manager/destination/runway") != nil){
  474. line1r = getprop("/autopilot/route-manager/destination/runway");
  475. }
  476. line2lt = "TRANS";
  477. line3rt = "RUNWAYS";
  478. line6l = "<INDEX";
  479. line6r = "ROUTE>";
  480. }
  481. if (display == "RTE1_DEP") {
  482. if (getprop("/autopilot/route-manager/departure/airport") != nil){
  483. title = getprop("/autopilot/route-manager/departure/airport")~" DEPARTURES";
  484. }else{
  485. title = "DEPARTURES";
  486. }
  487. line1lt = "SIDS";
  488. line1rt = "RUNWAYS";
  489. if (getprop("/autopilot/route-manager/departure/runway") != nil){
  490. line1r = getprop("/autopilot/route-manager/departure/runway");
  491. }
  492. line2lt = "TRANS";
  493. line6l = "<ERASE";
  494. line6r = "ROUTE>";
  495. }
  496. if (display == "RTE1_LEGS") {
  497. if (getprop("/autopilot/route-manager/active") == 1){
  498. title = "ACT RTE 1 LEGS";
  499. }else {
  500. title = "RTE 1 LEGS";
  501. }
  502. if (getprop("/autopilot/route-manager/route/wp[1]/id") != nil){
  503. line1lt = sprintf("%3.0f", getprop("/autopilot/route-manager/route/wp[1]/leg-bearing-true-deg"));
  504. line1l = getprop("/autopilot/route-manager/route/wp[1]/id");
  505. line2ct = sprintf("%3.0f", getprop("/autopilot/route-manager/route/wp[1]/leg-distance-nm"))~" NM";
  506. line1r = sprintf("%5.0f", getprop("/autopilot/route-manager/route/wp[1]/altitude-ft"));
  507. if (getprop("/autopilot/route-manager/route/wp[1]/speed-kts") != nil){
  508. line4r = getprop("/autopilot/route-manager/route/wp[1]/speed-kts")~"/"~sprintf("%5.0f", getprop("/autopilot/route-manager/route/wp[1]/altitude-ft"));
  509. }
  510. }
  511. if (getprop("/autopilot/route-manager/route/wp[2]/id") != nil){
  512. if (getprop("/autopilot/route-manager/route/wp[2]/leg-bearing-true-deg") != nil){
  513. line2lt = sprintf("%3.0f", getprop("/autopilot/route-manager/route/wp[2]/leg-bearing-true-deg"));
  514. }
  515. line2l = getprop("/autopilot/route-manager/route/wp[2]/id");
  516. if (getprop("/autopilot/route-manager/route/wp[2]/leg-distance-nm") != nil){
  517. line3ct = sprintf("%3.0f", getprop("/autopilot/route-manager/route/wp[2]/leg-distance-nm"))~" NM";
  518. }
  519. line2r = sprintf("%5.0f", getprop("/autopilot/route-manager/route/wp[2]/altitude-ft"));
  520. if (getprop("/autopilot/route-manager/route/wp[2]/speed-kts") != nil){
  521. line4r = getprop("/autopilot/route-manager/route/wp[2]/speed-kts")~"/"~sprintf("%5.0f", getprop("/autopilot/route-manager/route/wp[2]/altitude-ft"));
  522. }
  523. }
  524. if (getprop("/autopilot/route-manager/route/wp[3]/id") != nil){
  525. if (getprop("/autopilot/route-manager/route/wp[3]/leg-bearing-true-deg") != nil){
  526. line3lt = sprintf("%3.0f", getprop("/autopilot/route-manager/route/wp[3]/leg-bearing-true-deg"));
  527. }
  528. line3l = getprop("/autopilot/route-manager/route/wp[3]/id");
  529. if (getprop("/autopilot/route-manager/route/wp[3]/leg-distance-nm") != nil){
  530. line4ct = sprintf("%3.0f", getprop("/autopilot/route-manager/route/wp[3]/leg-distance-nm"))~" NM";
  531. }
  532. line3r = sprintf("%5.0f", getprop("/autopilot/route-manager/route/wp[3]/altitude-ft"));
  533. if (getprop("/autopilot/route-manager/route/wp[3]/speed-kts") != nil){
  534. line3r = getprop("/autopilot/route-manager/route/wp[3]/speed-kts")~"/"~sprintf("%5.0f", getprop("/autopilot/route-manager/route/wp[3]/altitude-ft"));;
  535. }
  536. }
  537. if (getprop("/autopilot/route-manager/route/wp[4]/id") != nil){
  538. if (getprop("/autopilot/route-manager/route/wp[4]/leg-bearing-true-deg") != nil){
  539. line4lt = sprintf("%3.0f", getprop("/autopilot/route-manager/route/wp[4]/leg-bearing-true-deg"));
  540. }
  541. line4l = getprop("/autopilot/route-manager/route/wp[4]/id");
  542. if (getprop("/autopilot/route-manager/route/wp[4]/leg-distance-nm") != nil){
  543. line5ct = sprintf("%3.0f", getprop("/autopilot/route-manager/route/wp[4]/leg-distance-nm"))~" NM";
  544. }
  545. line4r = sprintf("%5.0f", getprop("/autopilot/route-manager/route/wp[4]/altitude-ft"));
  546. if (getprop("/autopilot/route-manager/route/wp[4]/speed-kts") != nil){
  547. line4r = getprop("/autopilot/route-manager/route/wp[4]/speed-kts")~"/"~sprintf("%5.0f", getprop("/autopilot/route-manager/route/wp[4]/altitude-ft"));
  548. }
  549. }
  550. if (getprop("/autopilot/route-manager/route/wp[5]/id") != nil){
  551. if (getprop("/autopilot/route-manager/route/wp[5]/leg-bearing-true-deg") != nil){
  552. line5lt = sprintf("%3.0f", getprop("/autopilot/route-manager/route/wp[5]/leg-bearing-true-deg"));
  553. }
  554. line5l = getprop("/autopilot/route-manager/route/wp[5]/id");
  555. line5r = sprintf("%5.0f", getprop("/autopilot/route-manager/route/wp[5]/altitude-ft"));
  556. if (getprop("/autopilot/route-manager/route/wp[5]/speed-kts") != nil){
  557. line4r = getprop("/autopilot/route-manager/route/wp[5]/speed-kts")~"/"~sprintf("%5.0f", getprop("/autopilot/route-manager/route/wp[5]/altitude-ft"));
  558. }
  559. }
  560. line6l = "<RTE 2 LEGS";
  561. if (getprop("/autopilot/route-manager/active") == 1){
  562. line6r = "RTE DATA>";
  563. }else{
  564. line6r = "ACTIVATE>";
  565. }
  566. }
  567. if (display == "THR_LIM") {
  568. title = "THRUST LIM";
  569. line1lt = "SEL";
  570. line1ct = "OAT";
  571. line1c = sprintf("%2.0f", getprop("/environment/temperature-degc"))~" °C";
  572. line1rt = "TO 1 N1";
  573. line2l = "<TO";
  574. line2r = "CLB>";
  575. line3lt = "TO 1";
  576. line3c = "<SEL> <ARM>";
  577. line3r = "CLB 1>";
  578. line4lt = "TO 2";
  579. line4r = "CLB 2>";
  580. line6l = "<INDEX";
  581. line6r = "TAKEOFF>";
  582. }
  583. if (display == "TO_REF") {
  584. title = "TAKEOFF REF";
  585. line1lt = "FLAP/ACCEL HT";
  586. line1l = getprop("/instrumentation/fmc/to-flap");
  587. line1rt = "REF V1";
  588. if (getprop("/instrumentation/fmc/vspeeds/V1") != nil){
  589. line1r = sprintf("%3.0f", getprop("/instrumentation/fmc/vspeeds/V1"));
  590. }
  591. line2lt = "E/O ACCEL HT";
  592. line2rt = "REF VR";
  593. if (getprop("/instrumentation/fmc/vspeeds/VR") != nil){
  594. line2r = sprintf("%3.0f", getprop("/instrumentation/fmc/vspeeds/VR"));
  595. }
  596. line3lt = "THR REDUCTION";
  597. line3rt = "REF V2";
  598. if (getprop("/instrumentation/fmc/vspeeds/V2") != nil){
  599. line3r = sprintf("%3.0f", getprop("/instrumentation/fmc/vspeeds/V2"));
  600. }
  601. line4lt = "WIND/SLOPE";
  602. line4rt = "TRIM CG";
  603. line5rt = "POS SHIFT";
  604. line6l = "<INDEX";
  605. line6r = "POS INIT>";
  606. }
  607. if (serviceable != 1){
  608. title = ""; page = "";
  609. line1l = ""; line2l = ""; line3l = ""; line4l = ""; line5l = ""; line6l = "";
  610. line1lt = ""; line2lt = ""; line3lt = ""; line4lt = ""; line5lt = ""; line6lt = "";
  611. line1c = ""; line2c = ""; line3c = ""; line4c = ""; line5c = ""; line6c = "";
  612. line1ct = ""; line2ct = ""; line3ct = ""; line4ct = ""; line5ct = ""; line6ct = "";
  613. line1r = ""; line2r = ""; line3r = ""; line4r = ""; line5r = ""; line6r = "";
  614. line1rt = ""; line2rt = ""; line3rt = ""; line4rt = ""; line5rt = ""; line6rt = "";
  615. }
  616. setprop("/instrumentation/cdu/output/title",title);
  617. setprop("/instrumentation/cdu/output/page",page);
  618. setprop("/instrumentation/cdu/output/line1/left",line1l);
  619. setprop("/instrumentation/cdu/output/line2/left",line2l);
  620. setprop("/instrumentation/cdu/output/line3/left",line3l);
  621. setprop("/instrumentation/cdu/output/line4/left",line4l);
  622. setprop("/instrumentation/cdu/output/line5/left",line5l);
  623. setprop("/instrumentation/cdu/output/line6/left",line6l);
  624. setprop("/instrumentation/cdu/output/line1/left-title",line1lt);
  625. setprop("/instrumentation/cdu/output/line2/left-title",line2lt);
  626. setprop("/instrumentation/cdu/output/line3/left-title",line3lt);
  627. setprop("/instrumentation/cdu/output/line4/left-title",line4lt);
  628. setprop("/instrumentation/cdu/output/line5/left-title",line5lt);
  629. setprop("/instrumentation/cdu/output/line6/left-title",line6lt);
  630. setprop("/instrumentation/cdu/output/line1/center",line1c);
  631. setprop("/instrumentation/cdu/output/line2/center",line2c);
  632. setprop("/instrumentation/cdu/output/line3/center",line3c);
  633. setprop("/instrumentation/cdu/output/line4/center",line4c);
  634. setprop("/instrumentation/cdu/output/line5/center",line5c);
  635. setprop("/instrumentation/cdu/output/line6/center",line6c);
  636. setprop("/instrumentation/cdu/output/line1/center-title",line1ct);
  637. setprop("/instrumentation/cdu/output/line2/center-title",line2ct);
  638. setprop("/instrumentation/cdu/output/line3/center-title",line3ct);
  639. setprop("/instrumentation/cdu/output/line4/center-title",line4ct);
  640. setprop("/instrumentation/cdu/output/line5/center-title",line5ct);
  641. setprop("/instrumentation/cdu/output/line6/center-title",line6ct);
  642. setprop("/instrumentation/cdu/output/line1/right",line1r);
  643. setprop("/instrumentation/cdu/output/line2/right",line2r);
  644. setprop("/instrumentation/cdu/output/line3/right",line3r);
  645. setprop("/instrumentation/cdu/output/line4/right",line4r);
  646. setprop("/instrumentation/cdu/output/line5/right",line5r);
  647. setprop("/instrumentation/cdu/output/line6/right",line6r);
  648. setprop("/instrumentation/cdu/output/line1/right-title",line1rt);
  649. setprop("/instrumentation/cdu/output/line2/right-title",line2rt);
  650. setprop("/instrumentation/cdu/output/line3/right-title",line3rt);
  651. setprop("/instrumentation/cdu/output/line4/right-title",line4rt);
  652. setprop("/instrumentation/cdu/output/line5/right-title",line5rt);
  653. setprop("/instrumentation/cdu/output/line6/right-title",line6rt);
  654. settimer(cdu,0.2);
  655. }
  656. setlistener("/sim/signals/fdm-initialized", cdu);