... | ... |
@@ -6,6 +6,7 @@ var APClass = { |
6 | 6 |
var ap_systems = { # described AP systems to search, if it returns true system is set |
7 | 7 |
STEC55X: func contains(stec55x, 'ITAF'), |
8 | 8 |
GFC700: func props.globals.getNode('/autopilot/GFC700/FSM/lateral').getPath(), |
9 |
+ KAP140: func contains(kap140, 'apButton'), |
|
9 | 10 |
}; |
10 | 11 |
foreach (var s; sort(keys(ap_systems), func(a,b) cmp(a,b))) { |
11 | 12 |
call(ap_systems[s], [], nil, nil, var errors = []); |
... | ... |
@@ -319,6 +320,96 @@ var APClass = { |
319 | 320 |
# fgcommand('property-assign', {property: '/it-stec55x/input/man-trim', value: 0}); |
320 | 321 |
}, |
321 | 322 |
], |
322 |
- } |
|
323 |
+ }, |
|
324 |
+ KAP140: { |
|
325 |
+ _blink_count: 0, |
|
326 |
+ updateDisplay: func { |
|
327 |
+ var latmod = latmod_armed = vertmod = vertmod_armed = ""; |
|
328 |
+ var vertmod_target = 0; |
|
329 |
+ var ap_enabled = kap140.lockRollMode.getValue() != kap140.rollModes["OFF"] or kap140.lockPitchMode.getValue() == kap140.pitchModes["OFF"] |
|
330 |
+ |
|
331 |
+ if (ap_enabled) { |
|
332 |
+ foreach (var mode; keys(kap140.rollModes)) |
|
333 |
+ if (kap140.lockRollMode.getValue() == kap140.rollModes[mode]) { |
|
334 |
+ latmod = mode; |
|
335 |
+ break; |
|
336 |
+ } |
|
337 |
+ |
|
338 |
+ foreach (var mode; keys(kap140.rollArmModes)) |
|
339 |
+ if (kap140.lockRollArm.getValue() == kap140.rollArmModes[mode]) { |
|
340 |
+ latmod_armed = mode; |
|
341 |
+ break; |
|
342 |
+ } |
|
343 |
+ |
|
344 |
+ foreach (var mode; keys(kap140.pitchModes)) |
|
345 |
+ if (kap140.lockPitchMode.getValue() == kap140.pitchModes[mode]) { |
|
346 |
+ vertmod = mode; |
|
347 |
+ break; |
|
348 |
+ } |
|
349 |
+ |
|
350 |
+ foreach (var mode; keys(kap140.pitchArmModes)) |
|
351 |
+ if (kap140.lockPitchArm.getValue() == kap140.pitchArmModes[mode]) { |
|
352 |
+ vertmod_armed = mode; |
|
353 |
+ break; |
|
354 |
+ } |
|
355 |
+ |
|
356 |
+ vertmod_target = kap140.settingTargetPressureRate.getValue() * 58000; |
|
357 |
+ if (kap140.lockPitchMode.getValue() == pitchModes["VS"] |
|
358 |
+ or kap140.lockPitchArm.getValue() == pitchArmModes["VS"]) |
|
359 |
+ vertmod_target = sprintf('%s%4d fpm', |
|
360 |
+ utf8.chstr(vertmod_target > 0 ? 9650 : 9660), |
|
361 |
+ math.abs(math.round(vertmod_target, 10))); |
|
362 |
+ } |
|
363 |
+ |
|
364 |
+ foreach (var terminal; me.terminals) { |
|
365 |
+ var se = flightdeck[terminal].display.screenElements; |
|
366 |
+ if (se['AP-Status-text'].getVisible() and !ap_enabled) { |
|
367 |
+ if (math.mod(me._blink_count,2)) |
|
368 |
+ se['AP-Status-text'] |
|
369 |
+ .setDrawMode(canvas.Text.TEXT + canvas.Text.FILLEDBOUNDINGBOX) |
|
370 |
+ .setColorFill(flightdeck[terminal].display.colors.yellow) |
|
371 |
+ .setColor(flightdeck[terminal].display.colors.black); |
|
372 |
+ else |
|
373 |
+ se['AP-Status-text'] |
|
374 |
+ .setDrawMode(canvas.Text.TEXT + canvas.Text.FILLEDBOUNDINGBOX) |
|
375 |
+ .setColorFill(flightdeck[terminal].display.colors.black) |
|
376 |
+ .setColor(flightdeck[terminal].display.colors.yellow); |
|
377 |
+ me._blink_count += 1; |
|
378 |
+ if (me._blink_count == 5) { |
|
379 |
+ se['AP-Status-text'] |
|
380 |
+ .setColor(flightdeck[terminal].display.colors.green) |
|
381 |
+ .setVisible(0); |
|
382 |
+ me._blink_count = 0; |
|
383 |
+ } |
|
384 |
+ return; |
|
385 |
+ } |
|
386 |
+ else { |
|
387 |
+ se['AP-Status-text'].setVisible(ap_enabled); |
|
388 |
+ me._blink_count = 0; |
|
389 |
+ se['LATMOD-Active-text'].setVisible(ap_enabled).setText(latmod); |
|
390 |
+ se['LATMOD-Armed-text'].setVisible(ap_enabled).setText(latmod_armed); |
|
391 |
+ se['VERMOD-Active-text'].setVisible(ap_enabled).setText(vertmod); |
|
392 |
+ se['VERMOD-Reference-text'].setVisible(ap_enabled).setText(vertmod_target); |
|
393 |
+ se['VERMOD-Armed-text'].setVisible(ap_enabled).setText(vertmod_armed); |
|
394 |
+ } |
|
395 |
+ } |
|
396 |
+ }, |
|
397 |
+ L: [ |
|
398 |
+ func { kap140.apButton(); }, |
|
399 |
+ func, |
|
400 |
+ func { kap140.navButton(); }, |
|
401 |
+ func { kap140.altButton(); }, |
|
402 |
+ func, |
|
403 |
+ func, |
|
404 |
+ ], |
|
405 |
+ R: [ |
|
406 |
+ func, |
|
407 |
+ func { kap140.hdgButton(); }, |
|
408 |
+ func { kap140.aprButton(); }, |
|
409 |
+ func, |
|
410 |
+ func { kap140.upButton(); }, |
|
411 |
+ func { kap140.downButton(); } |
|
412 |
+ ], |
|
413 |
+ }, |
|
323 | 414 |
} |
324 | 415 |
}; |