helionix (1).nas 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. var DEBUG = 0;
  9. var DEBUG_TIME = 5;
  10. var ENABLE_PROP_RULES = 0; # 0 to disable or 1/frq. in Hz, DO NOT ENABLE/NOT IMPLEMENTED!
  11. var ENABLE_THREADS = 0;
  12. var FAST= 1/20; # 20 Hz
  13. var SLOW = 1/2; # 2 Hz
  14. # those need to be in the global scope
  15. var fnd_canvas = nil;
  16. var fnd_display = nil;
  17. var vmd_canvas = nil;
  18. var vmd_display = nil;
  19. var adc = nil;
  20. var font_mapper = func(family, weight)
  21. {
  22. return "LiberationFonts/LiberationSansNarrow-Bold.ttf";
  23. #return "isocpeur.ttf";
  24. if( family == "'Liberation Sans'" and weight == "normal" )
  25. return "LiberationFonts/LiberationSans-Regular.ttf";
  26. if( family == "'Liberation Sans'" and weight == "bold" )
  27. return "LiberationFonts/LiberationSans-Regular.ttf";
  28. };
  29. io.include(helionixpath ~ "Nasal/sensor.nas");
  30. io.include(helionixpath ~ "Nasal/filter.nas");
  31. io.include(helionixpath ~ "Nasal/mfd.nas");
  32. io.include(helionixpath ~ "Nasal/masterlist.nas");
  33. io.include(helionixpath ~ "Nasal/vmd_screen_func.nas");
  34. io.include(helionixpath ~ "Nasal/fnd_screen_func.nas");
  35. # init the startup
  36. setlistener("sim/signals/fdm-initialized", func {
  37. io.include(helionixpath ~ "Nasal/airdata.nas");
  38. io.include(helionixpath ~ "Nasal/fnd_screen.nas");
  39. io.include(helionixpath ~ "Nasal/vmd_screen.nas");
  40. # place the displays on the screens
  41. fnd_display.addPlacement({"node": "xmfd0screen"});
  42. fnd_display.addPlacement({"node": "xmfd2screen"});
  43. vmd_display.addPlacement({"node": "xmfd1screen"});
  44. helionix.showPfd = func() {
  45. var dlg = canvas.Window.new([500, 500], "dialog").set("resize", 1);
  46. dlg.setCanvas(fnd_display);
  47. };
  48. });
  49. setlistener("sim/signals/reinit", func {
  50. vmd_canvas.del();
  51. fnd_canvas.del();
  52. adc.del();
  53. });