meghas.nas 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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/sensor.nas");
  10. io.include(HELIONIXPATH ~ "Nasal/mfd.nas");
  11. io.include(HELIONIXPATH ~ "Nasal/meghas_mfd_control.nas");
  12. # start the air data computer sensor loops
  13. io.include(HELIONIXPATH ~ "Nasal/airdata.nas");
  14. # list of allowed of modules (=pages) names
  15. var MODULES = ["init2", "pfd", "vemd", "cad"];
  16. # load the page code
  17. foreach (var x; MODULES)
  18. io.include(HELIONIXPATH~"Nasal/"~x~"_page.nas");
  19. # 3D model of screen slightly distorted, therefore not quadratic
  20. var mfd = [Canvas_mfd.new(0, [1024, 1024], [1024, 1024]),
  21. Canvas_mfd.new(1, [1024, 1024], [1024, 1024]),
  22. Canvas_mfd.new(2, [1024, 1024], [1024, 1024]),
  23. Canvas_mfd.new(3, [1024, 1024], [1024, 1024]),
  24. ];
  25. # init the startup
  26. setlistener("sim/signals/fdm-initialized", func {
  27. print("Initializing MEGHAS MFD ...");
  28. for (var i=0; i<size(mfd); i += 1) {
  29. # setup all pages on each MFD
  30. mfd[i].display.addPlacement({"node": "xmfd"~i~"screen"});
  31. pages = split(",", getprop("/instrumentation/mfd["~i~"]/mode-list"));
  32. foreach (var pg; pages) {
  33. # put page p on mfd index i
  34. if (isin(pg, MODULES) > -1) {
  35. page_setup[pg](i);
  36. print(i,".",pg);
  37. }
  38. }
  39. # start the button and modes handling
  40. if (mfdctrl[i] != nil) {
  41. mfdctrl[i] = EUcoptermfd.new(i);
  42. mfdctrl[i].run(0.2);
  43. }
  44. }
  45. # force a refresh of all sensors to init screen animations
  46. adc._refresh_();
  47. if (USE_CENTRAL_UPDATE_LOOP)
  48. adc.initUpdates(0);
  49. print(" ... Done.");
  50. });
  51. setlistener("sim/signals/reinit", func {
  52. adc._del_();
  53. });
  54. # in debug update callback statistics every 5 sec
  55. if (DEBUG) {
  56. var debugloop=1;
  57. var dtimer = maketimer(5, func {
  58. adc._benchmark_(debugloop);
  59. debugloop+=1;
  60. });
  61. dtimer.start();
  62. };