zkv1000 / Nasal / core.nas /
Newer Older
105 lines | 4.218kb
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
1
var setListeners = func {
listeners stored in data str...
Sébastien MARQUE authored on 2017-05-06
2
    var prop = '/instrumentation/nav/nav-id';
3
    data.listeners[prop] = setlistener(prop,
correction listeners
Sébastien MARQUE authored on 2017-03-12
4
            func (n) {
5
                var val = n.getValue();
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
6
                foreach (var c; keys(flightdeck))
removes unecessary listeners
Sébastien MARQUE authored on 2017-04-08
7
                    flightdeck[c].display.updateNAV({'nav-id': 1, val: val});
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
8
            }, 1, 2);
listeners stored in data str...
Sébastien MARQUE authored on 2017-05-06
9

            
10
    prop = '/instrumentation/nav[1]/nav-id';
11
    data.listeners[prop] = setlistener(prop,
correction listeners
Sébastien MARQUE authored on 2017-03-12
12
            func (n) {
13
                var val = n.getValue();
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
14
                foreach (var c; keys(flightdeck))
removes unecessary listeners
Sébastien MARQUE authored on 2017-04-08
15
                    flightdeck[c].display.updateNAV({'nav-id': 2, val: val});
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
16
            }, 1, 2);
listeners stored in data str...
Sébastien MARQUE authored on 2017-05-06
17

            
18
    # keep this listener as long as the code is to heavy to be modified in multiple places
19
    prop = '/instrumentation/zkv1000/afcs/selected-alt-ft';
20
    data.listeners[prop] = setlistener(prop,
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
21
            func (n) {
22
                var val = n.getValue();
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
23
                if (val != nil)
24
                    foreach (var c; keys(flightdeck))
removes unecessary listeners
Sébastien MARQUE authored on 2017-04-08
25
                        if (flightdeck[c].role == 'PFD') {
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
26
                            if (! flightdeck[c].display.screenElements['SelectedALT'].getVisible()) {
27
                                flightdeck[c].display.screenElements['SelectedALT'].show();
28
                                flightdeck[c].display.screenElements['SelectedALT-text'].show();
29
                                flightdeck[c].display.screenElements['SelectedALT-symbol'].show();
30
                                flightdeck[c].display.screenElements['SelectedALT-bug'].show();
31
                                flightdeck[c].display.screenElements['SelectedALT-bg'].show();
32
                            }
33
                            flightdeck[c].display.updateSelectedALT();
34
                        }
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
35
            }, 0, 2);
listeners stored in data str...
Sébastien MARQUE authored on 2017-05-06
36

            
37
    prop = '/gear/gear/wow';
38
    data.listeners[prop] = setlistener(prop,
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
39
            func foreach (var c; keys(flightdeck))
removes unecessary listeners
Sébastien MARQUE authored on 2017-04-08
40
                if (flightdeck[c].role == 'PFD')
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
41
                    flightdeck[c].display.updateXPDR(),
adds transponder
Sébastien MARQUE authored on 2017-03-17
42
            0, 0);
listeners stored in data str...
Sébastien MARQUE authored on 2017-05-06
43

            
44
    prop = '/instrumentation/altimeter/setting-inhg';
45
    data.listeners[prop] = setlistener(prop,
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
46
            func foreach (var c; keys(flightdeck))
removes unecessary listeners
Sébastien MARQUE authored on 2017-04-08
47
                if (flightdeck[c].role == 'PFD')
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
48
                    flightdeck[c].display.updateBARO(), 0, 2);
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
49
}
50

            
commit initial
Sébastien MARQUE authored on 2017-03-07
51
var deviceClass = {
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
52
    new: func (name) {
commit initial
Sébastien MARQUE authored on 2017-03-07
53
        var m = { parents: [ deviceClass ] };
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
54
        m.name = name;
55
        m.role = substr(name, 0, 3);
56
        m.node = zkv.getNode(name, 1);
add V-speeds bugs
Sébastien MARQUE authored on 2017-04-04
57
        m.data = {};
first attempt to centralize ...
Sébastien MARQUE authored on 2017-04-15
58
        m.timers = {};
put Vspeeds in common data s...
Sébastien MARQUE authored on 2017-04-11
59
        foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide'])
add V-speeds bugs
Sébastien MARQUE authored on 2017-04-04
60
            m.data[v ~ '-visible'] = 1;
configurable display size, v...
Sébastien MARQUE authored on 2017-04-15
61
        foreach (var v; ['screen-object', 'screen-view', 'screen-size'])
62
            m.data[v] = getprop('/instrumentation/zkv1000/' ~ name ~ '/' ~ v);
massive code reorganisation ...
Sébastien MARQUE authored on 2017-05-01
63

            
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
64
        m.display  = displayClass.new(m);
65
        m.softkeys = softkeysClass.new(m);
66
        m.buttons  = buttonsClass.new(m);
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
67
        m.knobs    = knobsClass.new(m);
massive code reorganisation ...
Sébastien MARQUE authored on 2017-05-01
68
        m.map = mapClass.new(m);
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
69
        m.windows  = pageClass.new(m);
massive code reorganisation ...
Sébastien MARQUE authored on 2017-05-01
70

            
71
        if (! contains(data.timers, 'map')) {
72
            data.timers.map = maketimer(1, m, func {
73
                    foreach (var d; keys(flightdeck))
74
                        flightdeck[d].map.update();
75
                    var gspd = getprop('/velocities/groundspeed-kt');
76
                    if (gspd != 0)
77
                        var next = (me.data['range-nm']/(gspd/3600))/(me.display.display.get('view[1]')/2);
78
                    else
79
                        var next = 10;
80
                    if (next > 10)
81
                        next = 10;
82
                    data.timers.map.restart(next);
83
                });
84
            data.timers.map.singleShot = 1;
85
            data.timers.map.start();
86
        }
87
        m.display.showInitProgress();
88

            
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
89
        setprop('/instrumentation/zkv1000/' ~ m.name ~ '/status', 1);
90
        msg(m.name ~ ' switched on!');
commit initial
Sébastien MARQUE authored on 2017-03-07
91
        return m;
92
    },
93
};
94

            
PFD+MFD allumés ensemble
Sébastien MARQUE authored on 2017-03-11
95
var powerOn = func {
global timers started at pow...
Sébastien MARQUE authored on 2017-04-12
96
    foreach (var freq; keys(data.timers))
97
        data.timers[freq].start();
98

            
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
99
    foreach (var name; keys(flightdeck))
100
        if (zkv.getNode(name) != nil)
new var organistaion (and fi...
Sébastien MARQUE authored on 2017-03-26
101
#            thread.newthread(func {
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
102
                flightdeck[name] = deviceClass.new(name);
new var organistaion (and fi...
Sébastien MARQUE authored on 2017-03-26
103
#            });
correction listeners
Sébastien MARQUE authored on 2017-03-12
104
    settimer(setListeners, 5);
commit initial
Sébastien MARQUE authored on 2017-03-07
105
}