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

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

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