zkv1000 / Nasal / buttons.nas /
Newer Older
50 lines | 1.897kb
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

            
ajout de l'animation des bou...
Sébastien MARQUE authored on 2017-03-08
18
    AsSwitchCOM : func (x) {
commit initial
Sébastien MARQUE authored on 2017-03-07
19
        if (x) {
ajout de l'animation des bou...
Sébastien MARQUE authored on 2017-03-08
20
            me.AsSwitchCOM_pushed = getprop('/sim/time/elapsed-sec');
commit initial
Sébastien MARQUE authored on 2017-03-07
21
        }
ajout de l'animation des bou...
Sébastien MARQUE authored on 2017-03-08
22
        else {
23
            var pressed = getprop('/sim/time/elapsed-sec') - me.AsSwitchCOM_pushed;
24
            if (pressed > 2) {
25
                setprop('/instrumentation/comm/frequencies/selected-mhz', 121.500);
26
                setprop('/instrumentation/zkv1000/radios/comm1-selected', 1);
27
                setprop('/instrumentation/zkv1000/radios/comm2-selected', 0);
28
            }
29
            else {
30
                var c = getprop('/instrumentation/zkv1000/radios/comm-tune');
31
                var tmp = getprop('/instrumentation/comm[' ~ c ~ ']/frequencies/selected-mhz');
32
                setprop('/instrumentation/comm[' ~ c ~ ']/frequencies/selected-mhz', getprop('/instrumentation/comm[' ~ c ~ ']/frequencies/standby-mhz'));
33
                setprop('/instrumentation/comm[' ~ c ~ ']/frequencies/standby-mhz', tmp);
34
            }
commit initial
Sébastien MARQUE authored on 2017-03-07
35
        }
36
    },
37

            
ajout de l'animation des bou...
Sébastien MARQUE authored on 2017-03-08
38
    ALT : func () {
39
        var alt = getprop('instrumentation/altimeter/indicated-altitude-ft');
40
        setprop('/instrumentation/zkv1000/afcs/selected-alt-ft', math.round(alt, 10));
commit initial
Sébastien MARQUE authored on 2017-03-07
41
    },
42

            
43
    DirectTo : void,
44
    MENU : void,
45
    FPL : void,
46
    PROC : void,
47
    CLR : void,
48
    ENT : void,
49
    FMS : void,
50
};