zkv1000 / Nasal / buttons.nas /
Newer Older
53 lines | 2.056kb
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);
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
16
        foreach (var c; keys(flightdeck))
17
            if (contains(flightdeck[c], 'display'))
18
                flightdeck[c].display.updateNAV({refresh: n+1});
commit initial
Sébastien MARQUE authored on 2017-03-07
19
    },
20

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

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

            
46
    DirectTo : void,
47
    MENU : void,
48
    FPL : void,
49
    PROC : void,
50
    CLR : void,
51
    ENT : void,
52
    FMS : void,
53
};