zkv1000 / Nasal / buttons.nas /
Newer Older
68 lines | 2.204kb
commit initial
Sébastien MARQUE authored on 2017-03-07
1
var buttonsClass = {
2
    new : func (node) {
3
        var m = { parents: [ buttonsClass ] };
4
        m.node = node;
5
        return m;
6
    },
7

            
8
    PAN : func (xdir = 0, ydir = 0) {
9
    },
10

            
11
    AsSwitchNAV : func {
12
        var n = getprop('/instrumentation/zkv1000/radios/nav-tune');
13
        var tmp = getprop('/instrumentation/nav[' ~ n ~ ']/frequencies/selected-mhz');
14
        setprop('/instrumentation/nav[' ~ n ~ ']/frequencies/selected-mhz', getprop('/instrumentation/nav[' ~ n ~ ']/frequencies/standby-mhz'));
15
        setprop('/instrumentation/nav[' ~ n ~ ']/frequencies/standby-mhz', tmp);
16
    },
17

            
18
    AsSwitchCOM : func (emergency = 0) {
19
        if (emergency) {
20
            setprop('/instrumentation/comm/frequencies/selected-mhz', 121.500);
21
            setprop('/instrumentation/zkv1000/radios/comm1-selected', 1);
22
            setprop('/instrumentation/zkv1000/radios/comm2-selected', 0);
23
        }
24
        else {
25
            var c = getprop('/instrumentation/zkv1000/radios/comm-tune');
26
            var tmp = getprop('/instrumentation/comm[' ~ c ~ ']/frequencies/selected-mhz');
27
            setprop('/instrumentation/comm[' ~ c ~ ']/frequencies/selected-mhz', getprop('/instrumentation/comm[' ~ c ~ ']/frequencies/standby-mhz'));
28
            setprop('/instrumentation/comm[' ~ c ~ ']/frequencies/standby-mhz', tmp);
29
        }
30
    },
31

            
32
    NAV : func (x) {
33
        if (x) {
34
            fgcommand('property-toggle', props.Node.new({
35
                property: '/instrumentation/zkv1000/radios/nav-tune'
36
            }));
37
        }
38
    },
39

            
40
    COM : func (x) {
41
        if (x) {
42
            fgcommand('property-toggle', props.Node.new({
43
                property: '/instrumentation/zkv1000/radios/comm-tune'
44
            }));
45
        }
46
    },
47

            
48
    HDG : func (x) {
49
        if (x) {
50
            fgcommand('property-assign', props.Node.new({
51
                property: '/instrumentation/zkv1000/afcs/heading-bug-deg',
52
                property: '/orientation/heading-magnetic-deg'
53
            }));
54
        }
55
    },
56

            
57
    VolNAV : void,
58
    VolCOM : void,
59
    ALT : void,
60
    BARO : void,
61
    DirectTo : void,
62
    MENU : void,
63
    FPL : void,
64
    PROC : void,
65
    CLR : void,
66
    ENT : void,
67
    FMS : void,
68
};