helionix.nas 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # ==============================================================================
  2. # Original Boeing 747-400 pfd by Gijs de Rooy
  3. # Modified for 737-800 by Michael Soitanen
  4. # Modified for EC145 by litzi
  5. # ==============================================================================
  6. # This is a generic approach to canvas MFD's
  7. var HELIONIXPATH = "Aircraft/ec145/Models/instruments/EUcopter-mfd-c/";
  8. io.include(HELIONIXPATH ~ "Nasal/common.nas");
  9. io.include(HELIONIXPATH ~ "Nasal/helionix_mfd_control.nas");
  10. io.include(HELIONIXPATH ~ "Nasal/masterlist.nas");
  11. io.include(HELIONIXPATH ~ "Nasal/navsymbols.nas");
  12. # list of allowed of modules (=pages) names
  13. var MODULES = ["init", "fnd", "vmd", "navd", "stbyai", "dmap", "efb"];
  14. # load the page code
  15. foreach (var x; MODULES)
  16. io.include(HELIONIXPATH~"Nasal/"~x~"_page.nas");
  17. # 3D model of screen slightly distorted, therefore not quadratic
  18. mfd_add([1034, 1024], [1034, 1024]); # mfd0 plt FND
  19. mfd_add([1034, 1024], [1034, 1024]); # mfd1 coplt FND
  20. mfd_add([1034, 1024], [1034, 1024]); # mfd2 VMD, NAVD, MAPD
  21. mfd_add([512, 512], [512, 512]); # mfd3 stby horizon
  22. # init the startup
  23. setlistener("sim/signals/fdm-initialized", func {
  24. print("Initializing Helionix MFD ...");
  25. for (var i=0; i<size(mfd); i += 1) {
  26. # setup all pages on each MFD
  27. mfd[i].display.addPlacement({"node": "xmfd"~i~"screen"});
  28. mfd[i].pages = split(",", getprop("/instrumentation/mfd["~i~"]/mode-list"));;
  29. foreach (var pg; mfd[i].pages) {
  30. # put page p on mfd index i
  31. if (isin(pg, MODULES) > -1) {
  32. page_setup[pg](i);
  33. print(i,".",pg);
  34. }
  35. }
  36. # start the button and modes handling
  37. if (mfdctrl[i] != nil) {
  38. mfdctrl[i] = EUcoptermfd.new(i);
  39. mfdctrl[i].run(0.2);
  40. }
  41. }
  42. # force a refresh of all sensors
  43. # to init the screen animations
  44. adc._refresh_();
  45. if (USE_CENTRAL_UPDATE_LOOP)
  46. adc.initUpdates(0);
  47. print(" ... Done.");
  48. });
  49. setlistener("sim/signals/reinit", func {
  50. adc._del_();
  51. });
  52. # in debug update callback statistics every 5 sec
  53. if (DEBUG) {
  54. var dtimer = maketimer(5, func {
  55. adc._benchmark_();
  56. debugloop += 1;
  57. });
  58. dtimer.start();
  59. };