gtn750.nas 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # load the Helionix MFD canvas framework if not already loaded
  2. #
  3. #
  4. if ( !defined("HELIONIXPATH") ) {
  5. var HELIONIXPATH = "Aircraft/ec145/Models/instruments/EUcopter-mfd-c/";
  6. io.include(HELIONIXPATH ~ "Nasal/common.nas");
  7. }
  8. var GenerateGTNRadioMenu = func (n) {
  9. # text colors for the nav/comm frq. numeral when selected
  10. var navcolors = [[0, [0,0,0]], [nil, [1,1,1]], [4, [1,1,1]] ];
  11. var comcolors = [[0, [1,1,1]], [nil, [0,0,0]], [4, [0,0,0]] ];
  12. var gnsRadioMode = props.globals.initNode("instrumentation/GTN750/device["~(n-1)~"]/radio-menu-mode-comm", 0, type="BOOL");
  13. adc["gtn750radioMode"~n] = Sensor.new({prop: "instrumentation/GTN750/device["~(n-1)~"]/radio-menu-mode-comm", type:"BOOL"});
  14. adc["xpndrid"] = Sensor.new({prop: "instrumentation/transponder/transmitted-id"});
  15. setlistener("sim/signals/fdm-initialized", func {
  16. print("Initializing GTN750 comm/nav"~n~" menu...");
  17. #new MFD
  18. var i = mfd_add([1024,1024], [512,512]);
  19. #place canvas on screen object
  20. mfd[i].display.addPlacement({"node": "screencom."~n});
  21. #make canvas background transparent
  22. mfd[i].display.setColorBackground(0,0,0,0);
  23. #add a page (svg) to mfd
  24. var com1page = mfd[i].add_page("com", "Aircraft/ec145/Models/instruments/GTN750/gtn750.svg");
  25. var nav = "nav" ~ (n-1);
  26. var comm = "comm" ~ (n-1);
  27. com1page.add_trans("HeliSymbol", "rotation", {sensor: adc["heading"] });
  28. com1page.add_text("Gs", {sensor: adc["gpsgs"], format: "%03.0f"});
  29. com1page.add_text("Trk", {sensor: adc["gpstrk"], format: "%03.0f°"});
  30. com1page.add_text("VlocAct", {sensor: adc[nav~"frq"], format: "%6.2f"});
  31. com1page.add_text("VlocStb", {sensor: adc[nav~"stb"], format: "%6.2f"});
  32. com1page.add_text("CommStb", {sensor: adc[comm~"stb"], format: "%6.2f"});
  33. com1page.add_text("CommAct", {sensor: adc[comm~"frq"], format: "%6.2f"});
  34. com1page.add_text("Xpndr", {sensor: adc["xpndrid"], format: "%04.0f"});
  35. com1page.add_cond("CommSelect", {sensor: adc["gtn750radioMode"~n] });
  36. com1page.add_cond("VlocSelect", {sensor: adc["gtn750radioMode"~n], notequal:1 });
  37. com1page.add_color_range("VlocStb", adc["gtn750radioMode"~n] , navcolors);
  38. com1page.add_color_range("CommStb", adc["gtn750radioMode"~n] , comcolors);
  39. com1page.show();
  40. });
  41. };