zkv1000 / Nasal / core.nas /
Newer Older
157 lines | 6.056kb
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
1
var flightdeck = {
2
    'MFD'         : nil,
3
    'PFD'         : nil,
4
};
commit initial
Sébastien MARQUE authored on 2017-03-07
5

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

            
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
35
# les listeners triggent en permanence sur les fréquences...
36
var setListeners = func {
37
    setlistener('/instrumentation/nav/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))
41
                    if (flightdeck[c] != nil)
42
                        flightdeck[c].display.updateNAV({'nav-id': 1, val: val});
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
43
            }, 1, 2);
44
    setlistener('/instrumentation/nav[1]/nav-id',
correction listeners
Sébastien MARQUE authored on 2017-03-12
45
            func (n) {
46
                var val = n.getValue();
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
47
                foreach (var c; keys(flightdeck))
48
                    if (flightdeck[c] != nil)
49
                        flightdeck[c].display.updateNAV({'nav-id': 2, val: val});
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
50
            }, 1, 2);
Correction swap NAV tuning
Sébastien MARQUE authored on 2017-03-12
51
    setlistener('/instrumentation/zkv1000/radios/nav-tune',
correction listeners
Sébastien MARQUE authored on 2017-03-12
52
            func (n) {
53
                var val = n.getValue();
Correction swap NAV tuning
Sébastien MARQUE authored on 2017-03-12
54
                setNavTune();
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
55
                foreach (var c; keys(flightdeck))
56
                    if (flightdeck[c] != nil)
57
                        flightdeck[c].display.updateNAV({tune: val});
correction listeners
Sébastien MARQUE authored on 2017-03-12
58
            }, 1, 2);
59
    setlistener('/instrumentation/zkv1000/radios/comm-tune',
60
            func (n) {
61
                var val = n.getValue();
62
                setCommTune();
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
63
                foreach (var c; keys(flightdeck))
64
                    if (flightdeck[c] != nil)
65
                        flightdeck[c].display.updateCOMM({tune: val});
Correction swap NAV tuning
Sébastien MARQUE authored on 2017-03-12
66
            }, 1, 2);
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
67
    setlistener('/instrumentation/zkv1000/afcs/heading-bug-deg',
68
            func (n) {
69
                var val = n.getValue();
70
                if (val != nil) {
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
71
                    foreach (var c; keys(flightdeck))
72
                        if (flightdeck[c] != nil and flightdeck[c].role == 'PFD')
73
                            flightdeck[c].display.updateHDG(val);
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
74
                }
75
            }, 0, 2);
new var organistaion (and fi...
Sébastien MARQUE authored on 2017-03-26
76
    setlistener('/instrumentation/zkv1000/PFD/knobs/CRS',
anime CRS
Sébastien MARQUE authored on 2017-03-13
77
            func (n) {
78
                var val = n.getValue();
79
                if (val != nil) {
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
80
                    foreach (var c; keys(flightdeck))
81
                        if (flightdeck[c] != nil and flightdeck[c].role == 'PFD')
82
                            flightdeck[c].display.updateCRS();
anime CRS
Sébastien MARQUE authored on 2017-03-13
83
                }
84
            }, 0, 2);
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
85
    setlistener('/instrumentation/zkv1000/afcs/selected-alt-ft',
86
            func (n) {
87
                var val = n.getValue();
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
88
                if (val != nil)
89
                    foreach (var c; keys(flightdeck))
90
                        if (flightdeck[c] != nil and flightdeck[c].role == 'PFD') {
91
                            if (! flightdeck[c].display.screenElements['SelectedALT'].getVisible()) {
92
                                flightdeck[c].display.screenElements['SelectedALT'].show();
93
                                flightdeck[c].display.screenElements['SelectedALT-text'].show();
94
                                flightdeck[c].display.screenElements['SelectedALT-symbol'].show();
95
                                flightdeck[c].display.screenElements['SelectedALT-bug'].show();
96
                                flightdeck[c].display.screenElements['SelectedALT-bg'].show();
97
                            }
98
                            flightdeck[c].display.updateSelectedALT();
99
                        }
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
100
            }, 0, 2);
adds transponder
Sébastien MARQUE authored on 2017-03-17
101
    setlistener('/gear/gear/wow',
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
102
            func foreach (var c; keys(flightdeck))
103
                if (flightdeck[c] != nil and flightdeck[c].role == 'PFD')
104
                    flightdeck[c].display.updateXPDR(),
adds transponder
Sébastien MARQUE authored on 2017-03-17
105
            0, 0);
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
106
    setlistener('/instrumentation/altimeter/setting-inhg',
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
107
            func foreach (var c; keys(flightdeck))
108
                if (flightdeck[c] != nil and flightdeck[c].role == 'PFD')
109
                    flightdeck[c].display.updateBARO(), 0, 2);
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
110
}
111

            
commit initial
Sébastien MARQUE authored on 2017-03-07
112
var deviceClass = {
new var organistaion (and fi...
Sébastien MARQUE authored on 2017-03-26
113
    new: func (role) {
commit initial
Sébastien MARQUE authored on 2017-03-07
114
        var m = { parents: [ deviceClass ] };
new var organistaion (and fi...
Sébastien MARQUE authored on 2017-03-26
115
        m.role = role;
116
        m.node = zkv.getNode(role, 1);
add V-speeds bugs
Sébastien MARQUE authored on 2017-04-04
117
        m.data = {};
118
        foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide']) {
119
            m.data[v] = alerts.getNode(v).getValue();
120
            m.data[v ~ '-visible'] = 1;
121
        }
pass device pointer to displ...
Sébastien MARQUE authored on 2017-03-14
122
        m.display  = displayClass.new(m, m.role);
commit initial
Sébastien MARQUE authored on 2017-03-07
123
        m.display.showInitProgress(m.role);
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
124
        m.softkeys = softkeysClass.new(m, m.node, m.role);
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
125
        m.buttons  = buttonsClass.new(m.node);
126
        m.knobs    = knobsClass.new(m);
commit initial
Sébastien MARQUE authored on 2017-03-07
127
        m.display.loadsvg();
AI disponible
Sébastien MARQUE authored on 2017-03-10
128
        m.display.loadGroup({
129
            hide : [
commit initial
Sébastien MARQUE authored on 2017-03-07
130
                'Failures',
131
                'SoftKeysTexts',
132
                'PFD-Widgets', 
133
                'COMM',
134
                'XPDR-TIME', 
135
                'NAV',
136
                'FlightInstruments', 
137
                'VDI',
138
                'OMI',
AI disponible
Sébastien MARQUE authored on 2017-03-10
139
            ],
140
            clip : 'PitchScale',
141
        });
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
142
        m.windows  = pageClass.new(m);
commit initial
Sébastien MARQUE authored on 2017-03-07
143
        zkv.getNode(m.role ~ 'init').setIntValue(0);
new var organistaion (and fi...
Sébastien MARQUE authored on 2017-03-26
144
        setprop('/instrumentation/zkv1000/' ~ m.role ~ '/status', 1);
PFD+MFD allumés ensemble
Sébastien MARQUE authored on 2017-03-11
145
        msg(m.role ~ ' switched on!');
commit initial
Sébastien MARQUE authored on 2017-03-07
146
        return m;
147
    },
148
};
149

            
PFD+MFD allumés ensemble
Sébastien MARQUE authored on 2017-03-11
150
var powerOn = func {
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
151
    foreach (var role; keys(flightdeck))
new var organistaion (and fi...
Sébastien MARQUE authored on 2017-03-26
152
        if (zkv.getNode(role) != nil)
153
#            thread.newthread(func {
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
154
                flightdeck[role] = deviceClass.new(role);
new var organistaion (and fi...
Sébastien MARQUE authored on 2017-03-26
155
#            });
correction listeners
Sébastien MARQUE authored on 2017-03-12
156
    settimer(setListeners, 5);
commit initial
Sébastien MARQUE authored on 2017-03-07
157
}