zkv1000 / Nasal / core.nas /
Newer Older
117 lines | 4.362kb
make some data common to all...
Sébastien MARQUE authored on 2017-04-07
1
data = { # set of data common to all devices
2
    roll : 0,
3
    pitch : 0,
4
    vsi : 0,
5
    ias : 0,
6
    alt : 0,
7
    hdg : 0,
8
    wow : 1,
9
    timers : {
10
        '20Hz': maketimer (
11
            0.05,
12
            func {
13
                data.roll = getprop('/orientation/roll-deg');
14
                data.pitch = getprop('orientation/pitch-deg');
15
                data.vsi = getprop('/instrumentation/vertical-speed-indicator/indicated-speed-fpm');
16
                data.ias = getprop('/velocities/airspeed-kt');
17
                data.alt = getprop('/instrumentation/altimeter/indicated-altitude-ft');
18
                data.hdg = getprop('/orientation/heading-deg');
19
            }
20
        ),
21
        '1Hz': maketimer (
22
            1,
23
            func {
24
                data.wow = getprop('/gear/gear/wow');
25
            }
26
        ),
27
    },
28
};
29

            
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
30
var setListeners = func {
31
    setlistener('/instrumentation/nav/nav-id',
correction listeners
Sébastien MARQUE authored on 2017-03-12
32
            func (n) {
33
                var val = n.getValue();
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
34
                foreach (var c; keys(flightdeck))
removes unecessary listeners
Sébastien MARQUE authored on 2017-04-08
35
                    flightdeck[c].display.updateNAV({'nav-id': 1, val: val});
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
36
            }, 1, 2);
37
    setlistener('/instrumentation/nav[1]/nav-id',
correction listeners
Sébastien MARQUE authored on 2017-03-12
38
            func (n) {
39
                var val = n.getValue();
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
40
                foreach (var c; keys(flightdeck))
removes unecessary listeners
Sébastien MARQUE authored on 2017-04-08
41
                    flightdeck[c].display.updateNAV({'nav-id': 2, val: val});
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
42
            }, 1, 2);
removes unecessary listeners
Sébastien MARQUE authored on 2017-04-08
43
   # keep this listener as long as the code is to heavy to be modified in multiple places
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
44
    setlistener('/instrumentation/zkv1000/afcs/selected-alt-ft',
45
            func (n) {
46
                var val = n.getValue();
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
47
                if (val != nil)
48
                    foreach (var c; keys(flightdeck))
removes unecessary listeners
Sébastien MARQUE authored on 2017-04-08
49
                        if (flightdeck[c].role == 'PFD') {
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
50
                            if (! flightdeck[c].display.screenElements['SelectedALT'].getVisible()) {
51
                                flightdeck[c].display.screenElements['SelectedALT'].show();
52
                                flightdeck[c].display.screenElements['SelectedALT-text'].show();
53
                                flightdeck[c].display.screenElements['SelectedALT-symbol'].show();
54
                                flightdeck[c].display.screenElements['SelectedALT-bug'].show();
55
                                flightdeck[c].display.screenElements['SelectedALT-bg'].show();
56
                            }
57
                            flightdeck[c].display.updateSelectedALT();
58
                        }
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
59
            }, 0, 2);
adds transponder
Sébastien MARQUE authored on 2017-03-17
60
    setlistener('/gear/gear/wow',
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
61
            func foreach (var c; keys(flightdeck))
removes unecessary listeners
Sébastien MARQUE authored on 2017-04-08
62
                if (flightdeck[c].role == 'PFD')
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
63
                    flightdeck[c].display.updateXPDR(),
adds transponder
Sébastien MARQUE authored on 2017-03-17
64
            0, 0);
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
65
    setlistener('/instrumentation/altimeter/setting-inhg',
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
66
            func foreach (var c; keys(flightdeck))
removes unecessary listeners
Sébastien MARQUE authored on 2017-04-08
67
                if (flightdeck[c].role == 'PFD')
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
68
                    flightdeck[c].display.updateBARO(), 0, 2);
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
69
}
70

            
commit initial
Sébastien MARQUE authored on 2017-03-07
71
var deviceClass = {
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
72
    new: func (name) {
commit initial
Sébastien MARQUE authored on 2017-03-07
73
        var m = { parents: [ deviceClass ] };
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
74
        m.name = name;
75
        m.role = substr(name, 0, 3);
76
        m.node = zkv.getNode(name, 1);
add V-speeds bugs
Sébastien MARQUE authored on 2017-04-04
77
        m.data = {};
78
        foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide']) {
79
            m.data[v] = alerts.getNode(v).getValue();
80
            m.data[v ~ '-visible'] = 1;
81
        }
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
82
        m.display  = displayClass.new(m);
83
        m.display.showInitProgress(m.name);
84
        m.softkeys = softkeysClass.new(m);
85
        m.buttons  = buttonsClass.new(m);
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
86
        m.knobs    = knobsClass.new(m);
commit initial
Sébastien MARQUE authored on 2017-03-07
87
        m.display.loadsvg();
AI disponible
Sébastien MARQUE authored on 2017-03-10
88
        m.display.loadGroup({
89
            hide : [
commit initial
Sébastien MARQUE authored on 2017-03-07
90
                'Failures',
91
                'SoftKeysTexts',
92
                'PFD-Widgets', 
93
                'COMM',
94
                'XPDR-TIME', 
95
                'NAV',
96
                'FlightInstruments', 
97
                'VDI',
98
                'OMI',
AI disponible
Sébastien MARQUE authored on 2017-03-10
99
            ],
100
            clip : 'PitchScale',
101
        });
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
102
        m.windows  = pageClass.new(m);
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
103
        zkv.getNode(m.name ~ '-init').setIntValue(0);
104
        setprop('/instrumentation/zkv1000/' ~ m.name ~ '/status', 1);
105
        msg(m.name ~ ' switched on!');
commit initial
Sébastien MARQUE authored on 2017-03-07
106
        return m;
107
    },
108
};
109

            
PFD+MFD allumés ensemble
Sébastien MARQUE authored on 2017-03-11
110
var powerOn = func {
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
111
    foreach (var name; keys(flightdeck))
112
        if (zkv.getNode(name) != nil)
new var organistaion (and fi...
Sébastien MARQUE authored on 2017-03-26
113
#            thread.newthread(func {
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
114
                flightdeck[name] = deviceClass.new(name);
new var organistaion (and fi...
Sébastien MARQUE authored on 2017-03-26
115
#            });
correction listeners
Sébastien MARQUE authored on 2017-03-12
116
    settimer(setListeners, 5);
commit initial
Sébastien MARQUE authored on 2017-03-07
117
}