Debian Codegraph @

Aircraft/Instruments-3d/ar-3201/AR3201.nas

raw
1 # Becker AR-3201 transciever
2
3 var ar3201 = func {
4
5 setprop("instrumentation/comm/serviceable" ,0);
6
7 var chan = 0;
8 setprop("instrumentation/AR-3201/chan", chan);
9
10 var ch=[ 0,0,0,0,0 ];
11 ch[0] = getprop("instrumentation/comm/frequencies/selected-mhz");
12 ch[1] = 121.5 ;
13 ch[2] = 121.5 ;
14 ch[3] = 121.5 ;
15 ch[4] = 121.5 ;
16
17 setprop("instrumentation/AR-3201/stby", ch[0]);
18 setprop("instrumentation/AR-3201/dummy", ch[0]);
19 setprop("instrumentation/comm/frequencies/selected-mhz", ch[0]);
20
21 setlistener("instrumentation/AR-3201/power", func {
22
23 if ( getprop("instrumentation/AR-3201/power") == 1 and getprop("instrumentation/comm/serviceable") == 0 )
24 {
25 setprop("instrumentation/AR-3201/starting", 1);
26 settimer(func {
27 if (getprop("instrumentation/AR-3201/power") > 0)
28 {
29 setprop("instrumentation/AR-3201/starting", 0);
30 setprop("instrumentation/comm/serviceable" ,1)
31 }
32 }, 2);
33 }
34
35 if (getprop("instrumentation/AR-3201/power") == 0)
36 {
37 setprop("instrumentation/AR-3201/starting", 0);
38 setprop("instrumentation/comm/serviceable" ,0 );
39 }
40
41 });
42
43 setlistener("instrumentation/AR-3201/dummy", func {
44
45 settimer(func {
46 if ( chan == 0 )
47 {
48 ch[0] = getprop("instrumentation/AR-3201/stby") ;
49 setprop("instrumentation/comm/frequencies/selected-mhz" ,ch[0] );
50 }
51 }, 0.02);
52
53 });
54
55 setlistener("instrumentation/AR-3201/chan", func {
56
57 chan = getprop("instrumentation/AR-3201/chan" );
58 setprop("instrumentation/comm/frequencies/selected-mhz", ch[chan] );
59
60 });
61
62
63
64 setlistener("instrumentation/AR-3201/store", func {
65
66 chan = getprop("instrumentation/AR-3201/chan" );
67 ch[chan] = getprop("instrumentation/AR-3201/stby");
68 setprop("instrumentation/comm/frequencies/selected-mhz", ch[chan] );
69
70 });
71
72 }
73
74 # Start the transciever ASAP
75 ar3201();