zkv1000 / zkv1000.nas /
Newer Older
167 lines | 8.242kb
commit initial
Sébastien MARQUE authored on 2017-03-07
1
# Nasal files to be loaded at start
2
# the order could be important as some files need other one to be loaded first
3
files_to_load = [
4
    'lib.nas',     # some useful functions, should stay first loaded
Correction swap NAV tuning
Sébastien MARQUE authored on 2017-03-12
5
    'radios.nas',  # all about radios COMM, NAV, XPDR
commit initial
Sébastien MARQUE authored on 2017-03-07
6
    'knobs.nas',   # handles knobs
7
    'buttons.nas', # handles knobs and buttons
8
    'softkeys.nas',# handles softkeys and menus items
adds Map on MFD
Sébastien MARQUE authored on 2017-03-20
9
    'map.nas',     # moves the maps
commit initial
Sébastien MARQUE authored on 2017-03-07
10
    'display.nas',
add window management
Sébastien MARQUE authored on 2017-03-28
11
    'menu.nas',    # manage windows
commit initial
Sébastien MARQUE authored on 2017-03-07
12
    'core.nas',    # the scheduler and switch on button
13
];
14
#    'afcs.nas',    # Automatic Flight Control System
15
#    'routes.nas',  # manages flightplans and routes
16
#    'display.nas', # display messages and popups
17
#    'infos.nas',   # get informations from environment
18
#    'alerts.nas',  # in flight tests
19
#    'mud.nas',     # displays simple embedded GUI (Multi-Use Display)
20

            
21
var zkv = cdi = radios = alerts = infos = cursors = afcs = eis = nil;
22

            
23
var init_props = func {
24
    zkv = props.globals.getNode('/instrumentation/zkv1000',1);
25
    zkv.getNode('emission',1).setDoubleValue(0.5);
26
    zkv.getNode('body-emission',1).setDoubleValue(0.0);
27
    zkv.getNode('body-texture',1).setValue('');
28
    zkv.getNode('display-brightness-norm',1).setValue(0.5);
29

            
30
    radios = zkv.getNode('radios', 1);
31
    radios.getNode('nav1-selected',1).setIntValue(0);
32
    radios.getNode('nav1-standby',1).setIntValue(0);
33
    radios.getNode('nav2-selected',1).setIntValue(0);
34
    radios.getNode('nav2-standby',1).setIntValue(0);
35
    radios.getNode('nav-tune',1).setIntValue(0);
36
    radios.getNode('nav-freq-mhz',1).alias('/instrumentation/nav/frequencies/standby-mhz');
37
    radios.getNode('comm1-selected',1).setIntValue(1);
38
    radios.getNode('comm2-selected',1).setIntValue(0);
39
    radios.getNode('comm-tune',1).setIntValue(0);
40
    radios.getNode('comm-freq-mhz',1).alias('/instrumentation/comm/frequencies/standby-mhz');
41
    radios.getNode('xpdr-mode',1).setValue('GND');
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
42
    radios.getNode('brg1-source',1).setValue('OFF');
43
    radios.getNode('brg2-source',1).setValue('OFF');
commit initial
Sébastien MARQUE authored on 2017-03-07
44

            
adds CDI
Sébastien MARQUE authored on 2017-03-18
45
    cdi = zkv.getNode('cdi', 1);
46
    cdi.getNode('source', 1).setValue('OFF');
47
    cdi.getNode('no-flag', 1).setBoolValue(0);
48
    cdi.getNode('FROM-flag', 1).alias('no-flag');
49
    cdi.getNode('TO-flag', 1).alias('no-flag');
50
    cdi.getNode('course', 1);
51
    cdi.getNode('course-deflection', 1);
52
    cdi.getNode('radial', 1);
53
    cdi.getNode('in-range', 1);
54

            
commit initial
Sébastien MARQUE authored on 2017-03-07
55
    alerts = zkv.getNode('alerts',1);
56
    alerts.getNode('traffic-proximity',1).setIntValue(0);
57
    alerts.getNode('marker-beacon', 1).setIntValue(0);
58
    alerts.getNode('warning', 1).setBoolValue(0);
59
    alerts.getNode('alert', 1).setBoolValue(0);
60
    alerts.getNode('message', 1).setValue('');
add V-speeds bugs
Sébastien MARQUE authored on 2017-04-04
61
    var v = getprop('/instrumentation/zkv1000/alerts/Vx');
62
    alerts.getNode('Vx', 1).setIntValue(v != nil ? v : 999);
63
    v = getprop('/instrumentation/zkv1000/alerts/Vy');
64
    alerts.getNode('Vy', 1).setIntValue(v != nil ? v : 999);
65
    v = getprop('/instrumentation/zkv1000/alerts/Vr');
66
    alerts.getNode('Vr', 1).setIntValue(v != nil ? v : 999);
67
    v = getprop('/instrumentation/zkv1000/alerts/Vglide');
68
    alerts.getNode('Vglide', 1).setIntValue(v != nil ? v : 999);
add Vne Vspeed specific to a...
Sébastien MARQUE authored on 2017-04-04
69
    v = getprop('/instrumentation/zkv1000/alerts/Vne');
70
    alerts.getNode('Vne', 1).setIntValue(v != nil ? v : 999);
commit initial
Sébastien MARQUE authored on 2017-03-07
71

            
72
    afcs = zkv.getNode('afcs',1);
73
    afcs.getNode('fd-bars-visible',1).setBoolValue(0);
74
    afcs.getNode('alt-bug-visible',1).setBoolValue(0);
75
    afcs.getNode('heading-bug-deg',1).setDoubleValue(getprop('/orientation/heading-magnetic-deg'));
76
    afcs.getNode('target-pitch-deg',1).setDoubleValue(0.0);
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
77
    afcs.getNode('selected-alt-ft',1).setIntValue(2000);
commit initial
Sébastien MARQUE authored on 2017-03-07
78
    afcs.getNode('selected-alt-ft-diff',1).setDoubleValue(0.0);
79
    afcs.getNode('selected-ias-kt-diff',1).setDoubleValue(0.0);
80
    afcs.getNode('vertical-speed-fpm',1).setDoubleValue(0.0);
81
    afcs.getNode('roll-armed', 1).setBoolValue(0);
82
    afcs.getNode('pitch-armed', 1).setBoolValue(0);
83
    afcs.getNode('roll-armed-mode-text',1).setValue('');
84
    afcs.getNode('roll-active-mode-text',1).setValue('');
85
    afcs.getNode('roll-armed-mode',1).setIntValue(0);
86
    afcs.getNode('roll-active-mode',1).setIntValue(0);
87
    afcs.getNode('roll-active-mode-blink',1).setBoolValue(0);
88
    afcs.getNode('pit-armed-mode-text',1).setValue('');
89
    afcs.getNode('pit-active-mode-text',1).setValue('');
90
    afcs.getNode('pit-armed-mode',1).setIntValue(0);
91
    afcs.getNode('pit-active-mode',1).setIntValue(0);
92
    afcs.getNode('pit-active-mode-blink',1).setBoolValue(0);
93
    afcs.getNode('route',1);
94

            
animation texts EIS + power ...
Sébastien MARQUE authored on 2017-03-19
95
    eis = zkv.getNode('eis',1);
96
    eis.getNode('fuel-qty-at-start', 1).setValue(
97
        getprop('/consumables/fuel/tank/level-gal_us')
98
      + getprop('/consumables/fuel/tank/level-gal_us'));
99

            
adds Map on MFD
Sébastien MARQUE authored on 2017-03-20
100
    setprop('/sim/gui/dialogs/map-canvas/draw-APT', 1);
101
    setprop('/sim/gui/dialogs/map-canvas/draw-FIX', 1);
102
    setprop('/sim/gui/dialogs/map-canvas/draw-VOR', 1);
103
    setprop('/sim/gui/dialogs/map-canvas/draw-DME', 1);
104
    setprop('/sim/gui/dialogs/map-canvas/draw-NDB', 1);
105
    setprop('/sim/gui/dialogs/map-canvas/draw-TFC', 1);
106
    setprop('/sim/gui/dialogs/map-canvas/draw-data', 1);
107
    setprop('/sim/gui/dialogs/map-canvas/draw-FLT', 1);
108
    setprop('/sim/gui/dialogs/map-canvas/draw-WXR', 1);
109
    setprop('/sim/gui/dialogs/map-canvas/draw-TUT', 1);
110
    setprop('/sim/gui/dialogs/map-canvas/aircraft-heading-up', 0);
111
    mfd = zkv.getNode('mfd', 1);
112
    var tiles_server = getprop('/sim/online-tiles-server');
113
    var tiles_type = getprop('/sim/online-tiles-type');
fix tiles server
Sébastien MARQUE authored on 2017-03-22
114
    # see https://www.wikimedia.org/wiki/Maps
115
    mfd.getNode('online-tiles-server', 1).setValue(tiles_server != nil ? tiles_server : 'maps.wikimedia.org');
adds Map on MFD
Sébastien MARQUE authored on 2017-03-20
116
    mfd.getNode('online-tiles-type', 1).setValue(tiles_type != nil ? tiles_type : 'osm-intl');
117

            
commit initial
Sébastien MARQUE authored on 2017-03-07
118
    props.globals.getNode('/instrumentation/transponder/id-code',1).setIntValue(1200);
119
    props.globals.getNode('/instrumentation/transponder/serviceable',1).setBoolValue(1);
120
    props.globals.getNode('/autopilot/settings/heading-bug-deg', 1).alias('/instrumentation/zkv1000/afcs/heading-bug-deg');
121
    props.globals.getNode('/autopilot/settings/target-altitude-ft',1).setDoubleValue(0.0);
122
    props.globals.getNode('/autopilot/settings/target-speed-kt',1).setDoubleValue(0.0);
123
    props.globals.getNode('/autopilot/settings/vertical-speed-fpm',1).setDoubleValue(0.0);
124
    props.globals.getNode('/autopilot/internal/target-pitch-deg',1).setDoubleValue(0.0);
125
    props.globals.getNode('/autopilot/internal/flc-altitude-pitch-deg',1).setDoubleValue(0.0);
126
    props.globals.getNode('/autopilot/internal/flc-airspeed-pitch-deg',1).setDoubleValue(0.0);
127
    props.globals.getNode('/autopilot/internal/target-roll-deg',1).setDoubleValue(0.0);
128
    props.globals.getNode('/autopilot/locks/pitch',1).setValue('');
129
    props.globals.getNode('/autopilot/locks/roll',1).setValue('');
130
    props.globals.getNode('/autopilot/locks/passive-mode', 1).setIntValue(1);
131
}
132

            
133
var set_listeners = func {
134
#    setlistener('/instrumentation/nav[0]/radials/selected-deg', popup_course_info,  0, 0);
135
#    setlistener('/instrumentation/nav[1]/radials/selected-deg', popup_course_info,  0, 0);
136
#    setlistener('/instrumentation/zkv1000/afcs/heading-bug-deg',popup_hdg_info,     0, 0);
137
#    setlistener('/instrumentation/zkv1000/afcs/selected-alt-ft',popup_selected_alt, 0, 0);
138
#    setlistener('/instrumentation/zkv1000/radios/nav-tune',     setNavTune,         0, 0);
139
#    setlistener('/instrumentation/zkv1000/radios/comm-tune',    setCommTune,        0, 0);
140
}
141

            
142
var load_nasal = func {
143
    var zkv1000_dir = getprop('/sim/fg-aircraft') ~ '/Instruments-3d/zkv1000/Nasal/';
144
    for (var i = 0; i < size(files_to_load); i += 1)
145
        io.load_nasal(zkv1000_dir ~ files_to_load[i], 'zkv1000');
146
    files_to_load = nil;
147
}
148

            
149
var load_multikey = func {
150
    fgcommand('loadxml', props.Node.new({
151
        'filename': getprop('/sim/fg-aircraft') ~ '/Instruments-3d/zkv1000/Systems/multikey.xml',
152
        'targetnode': '/input/keyboard/'
153
    }));
154
    multikey.init();
155
}
156

            
157
var zkv1000_init = func {
init listener needed only on...
Sébastien MARQUE authored on 2017-03-13
158
    removelistener(init);
commit initial
Sébastien MARQUE authored on 2017-03-07
159
    load_multikey();
160
    load_nasal();
161
    init_props();
162
    set_listeners();
163
    print('zkv1000 loaded');
164
}
165

            
init listener needed only on...
Sébastien MARQUE authored on 2017-03-13
166
var init = setlistener('/sim/signals/fdm-initialized', zkv1000_init, 0, 0);
commit initial
Sébastien MARQUE authored on 2017-03-07
167