Showing 1 changed files with 0 additions and 108 deletions
-108
Nasal/lib.nas
... ...
@@ -14,32 +14,6 @@ var msg_popup = func (str...) { gui.popupTip("ZKV1000\n" ~ str, 3) }
14 14
 # just do nothing
15 15
 var void = func { }
16 16
 
17
-###
18
-# returns decimal part arg
19
-var frac = func (x) { return (x - int(x)) }
20
-
21
-###
22
-# rounds regarding proximity
23
-# e.g.:
24
-#   round(1540, 300) gives 1500
25
-#   round(2370, 400) gives 2400
26
-var round = func (x, m = 1) {
27
-    var v = x / m;
28
-    if (frac(v) >= 0.5) v += 1;
29
-    return (int(v) * m);
30
-}
31
-
32
-###
33
-# rounds regarless proximity
34
-# e.g.:
35
-#   round_bis(1540, 300) gives 1500
36
-#   round_bis(2370, 400) gives 2000
37
-var round_bis = func (x, m) {
38
-    var r = round(x, m);
39
-    if (r > x) r -= m;
40
-    return r;
41
-}
42
-
43 17
 var alt = vs = vs_abs = ias = tas = pitch = roll = agl = stall = rpm = 0;
44 18
 var getData = func {
45 19
     alt = math.abs(getprop('/instrumentation/altimeter/indicated-altitude-ft'));
... ...
@@ -117,85 +91,3 @@ var HMS = func (hh, mm, ss, d = 0) {
117 91
     }
118 92
     return sprintf('%02i:%02i:%02i', hh, mm, ss);
119 93
 }
120
-
121
-###
122
-# Loads a fligtplan (route) from a XML file
123
-# replaces existing route by the new one
124
-var loadFPLfromFile = func (file) {
125
-    afcs.getNode('route').removeChildren();
126
-    fgcommand('loadxml', props.Node.new({
127
-              'filename': file,
128
-              'targetnode': afcs.getNode('route').getPath()})
129
-            );
130
-    FPLtoRouteManager();
131
-    msg('route loaded from ' ~ file);
132
-}
133
-
134
-var wipeRoute = func {
135
-    var command = props.globals.getNode('/instrumentation/gps/command');
136
-    var v = getprop('/autopilot/route-manager/route/num');
137
-    setprop('/autopilot/route-manager/active', 0);
138
-    setprop('/instrumentation/gps/scratch/index', 0);
139
-    while (v) {
140
-        v -= 1;
141
-        command.setValue('route-delete');
142
-    }
143
-}
144
-
145
-var FPLtoRouteManager = func {
146
-    wipeRoute();
147
-    lockSearches();
148
-    var scratch = props.globals.getNode('/instrumentation/gps/scratch');
149
-    var command = scratch.getNode('../command');
150
-    foreach (var waypoint; afcs.getNode('route').getChildren()) {
151
-        scratch.getNode('index').setIntValue(-1);
152
-        searchNearestNavaid(waypoint.getNode('type').getValue(), 1, waypoint.getPath());
153
-        command.setValue('route-insert-after');
154
-    }
155
-    unlockSearches();
156
-}
157
-
158
-####
159
-# Search nav facilities
160
-var searchNearestNavaid = func (type, quantity = 1, path = nil) {
161
-    getprop('/instrumentation/zkv1000/searches-locked') or return;
162
-    scratch = props.globals.getNode('/instrumentation/gps/scratch/');
163
-    scratch.getNode('max-results', 1).setIntValue(quantity);
164
-    var lat = lon = -9999;
165
-    if (path != nil) {
166
-        if (props.globals.getNode(path) != nil) {
167
-            lon = getprop(path ~ '/longitude-deg');
168
-            lat = getprop(path ~ '/latitude-deg');
169
-        }
170
-    }
171
-    scratch.getNode('longitude-deg', 1).setDoubleValue(lon);
172
-    scratch.getNode('latitude-deg', 1).setDoubleValue(lat);
173
-    scratch.getNode('type').setValue(type);
174
-    setprop('/instrumentation/gps/command', 'nearest');
175
-}
176
-
177
-var lockSearches = func (v = 1) {
178
-    props.globals.getNode('/instrumentation/zkv1000/searches-locked', 1).setBoolValue(v);
179
-}
180
-
181
-var unlockSearches = func {
182
-    lockSearches(0);
183
-}
184
-
185
-#var dialog = func {
186
-#    var d = gui.Widget.new();
187
-#    d.set({'name': 'ZKV1000 text entry interface', 
188
-#           'layout': 'vbox',
189
-#           'default-padding' : 0});
190
-#    d.addChild('text').
191
-#}
192
-
193
-var computeAltitudeDiff = void;
194
-var computeAirspeedDiff = void;
195
-var FLCcomputation = void;
196
-var checkRollAcquisition = void;
197
-var checkPitchAcquisition = void;
198
-var checkTrafficProximity = void;
199
-var manageLandingGears = void;
200
-var checkAbnormalAttitude = void;
201
-var applyFilter = void;