gns430-radio.nas 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 GenerateGNSRadioMenu = func (n) {
  9. var gnsRadioVisible = props.globals.initNode("instrumentation/GNS430/device["~(n-1)~"]/radio-menu-visible", 0, type="DOUBLE");
  10. var gnsRadioMode = props.globals.initNode("instrumentation/GNS430/device["~(n-1)~"]/radio-menu-mode-comm", 0, type="BOOL");
  11. adc["gns430radioMode"~n] = Sensor.new({prop: "instrumentation/GNS430/device["~(n-1)~"]/radio-menu-mode-comm", type:"BOOL"});
  12. setlistener(gnsRadioVisible, func {
  13. if (gnsRadioVisible.getValue() == 1) {
  14. interpolate(gnsRadioVisible, 0, 5);
  15. }
  16. }
  17. );
  18. setlistener("sim/signals/fdm-initialized", func {
  19. print("Initializing GNS430 comm/nav"~n~" menu...");
  20. #new MFD
  21. var i = mfd_add([512,512], [512,512]);
  22. #place canvas on screen object
  23. mfd[i].display.addPlacement({"node": "screencom."~n});
  24. mfd[i].display.setColorBackground(0,0,0,0);
  25. #add a page (svg) to mfd
  26. var com1page = mfd[i].add_page("com", "Aircraft/ec145/Models/instruments/GNS430/gns430-radio/gns430-radio.svg");
  27. var nav = "nav" ~ (n-1);
  28. var comm = "comm" ~ (n-1);
  29. com1page.add_text("VlocAct", {sensor: adc[nav~"frq"], format: "%7.3f"});
  30. com1page.add_text("VlocStb", {sensor: adc[nav~"stb"], format: "%7.3f"});
  31. com1page.add_text("CommStb", {sensor: adc[comm~"stb"], format: "%7.3f"});
  32. com1page.add_text("CommAct", {sensor: adc[comm~"frq"], format: "%7.3f"});
  33. com1page.add_cond("CommSelect", {sensor: adc["gns430radioMode"~n] });
  34. com1page.add_cond("VlocSelect", {sensor: adc["gns430radioMode"~n], notequal:1 });
  35. com1page.show();
  36. });
  37. };