nav_scripts.nas 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # TACAN
  2. # -------------
  3. var nav1_back = 0;
  4. setlistener( "instrumentation/tacan/switch-position", func {nav1_freq_update();} );
  5. var tc = props.globals.getNode("instrumentation/tacan/");
  6. var tc_sw_pos = tc.getNode("switch-position");
  7. var tc_freq = tc.getNode("frequencies");
  8. var tc_true_hdg = props.globals.getNode("instrumentation/tacan/indicated-bearing-true-deg");
  9. var tc_mag_hdg = props.globals.getNode("sim/model/A-10/instrumentation/tacan/indicated-bearing-mag-deg");
  10. var tcn_btn = props.globals.getNode("instrumentation/tacan/switch-position");
  11. var tcn_ident = props.globals.getNode("instrumentation/tacan/ident");
  12. var tacan_XYtoggle = func {
  13. var xy_sign = tc_freq.getNode("selected-channel[4]");
  14. var s = xy_sign.getValue();
  15. if ( s == "X" ) {
  16. xy_sign.setValue( "Y" );
  17. } else {
  18. xy_sign.setValue( "X" );
  19. }
  20. }
  21. var tacan_tenth_adjust = func {
  22. var tenths = getprop( "instrumentation/tacan/frequencies/selected-channel[2]" );
  23. var hundreds = getprop( "instrumentation/tacan/frequencies/selected-channel[1]" );
  24. var value = (10 * tenths) + (100 * hundreds);
  25. var adjust = arg[0];
  26. var new_value = value + adjust;
  27. var new_hundreds = int(new_value/100);
  28. var new_tenths = (new_value - (new_hundreds*100))/10;
  29. setprop( "instrumentation/tacan/frequencies/selected-channel[1]", new_hundreds );
  30. setprop( "instrumentation/tacan/frequencies/selected-channel[2]", new_tenths );
  31. }