| 1 |
############################################################################### |
| 2 |
## $Id$ |
| 3 |
## |
| 4 |
## Nasal for KDI 572 DME. |
| 5 |
## |
| 6 |
## Copyright (C) 2006 - 2008 Syd Adams |
| 7 |
## Adapted for dual control by Anders Gidenstam |
| 8 |
## |
| 9 |
## This file is licensed under the GPL license version 2 or later. |
| 10 |
## |
| 11 |
############################################################################### |
| 12 |
|
| 13 |
# Note: |
| 14 |
# This module MUST be loaded as KDI572. |
| 15 |
# |
| 16 |
|
| 17 |
var base = ["instrumentation/dme[0]", |
| 18 |
"instrumentation/dme[1]"]; |
| 19 |
|
| 20 |
########################################################################### |
| 21 |
# API for pick animations. |
| 22 |
########################################################################### |
| 23 |
|
| 24 |
var dme_step = func(stp) { |
| 25 |
var switch= getprop("instrumentation/dme/switch-position"); |
| 26 |
switch += stp; |
| 27 |
if (switch >3) switch=3; |
| 28 |
if (switch <0) switch=0; |
| 29 |
setprop("instrumentation/dme/switch-position", switch); |
| 30 |
|
| 31 |
if (switch==0) { |
| 32 |
setprop("instrumentation/dme/frequencies/source", |
| 33 |
"instrumentation/dme/frequencies/selected-mhz"); |
| 34 |
} elsif (switch==1) { |
| 35 |
setprop("instrumentation/dme/frequencies/source", |
| 36 |
"instrumentation/nav[0]/frequencies/selected-mhz"); |
| 37 |
} elsif (switch==2) { |
| 38 |
setprop("instrumentation/dme/frequencies/source", |
| 39 |
"instrumentation/dme/frequencies/selected-mhz"); |
| 40 |
} elsif (switch==3) { |
| 41 |
setprop("instrumentation/dme/frequencies/source", |
| 42 |
"instrumentation/nav[1]/frequencies/selected-mhz"); |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
########################################################################### |
| 47 |
# API for dual control setup. |
| 48 |
########################################################################### |
| 49 |
|
| 50 |
########################################################################### |
| 51 |
# Create aliases to drive a KDI-572 3d model in an AI/MP model. |
| 52 |
# n - unit# |
| 53 |
var animate_aimodel = func(n, airoot) { |
| 54 |
var p = "systems/electrical/outputs/dme"; |
| 55 |
airoot.getNode(p, 1).alias(props.globals.getNode(p)); |
| 56 |
p = base[n] ~ "/switch-position"; |
| 57 |
airoot.getNode(p, 1).alias(props.globals.getNode(p)); |
| 58 |
p = base[n] ~ "/in-range"; |
| 59 |
airoot.getNode(p, 1).alias(props.globals.getNode(p)); |
| 60 |
p = base[n] ~ "/indicated-distance-nm"; |
| 61 |
airoot.getNode(p, 1).alias(props.globals.getNode(p)); |
| 62 |
p = base[n] ~ "/indicated-ground-speed-kt"; |
| 63 |
airoot.getNode(p, 1).alias(props.globals.getNode(p)); |
| 64 |
p = base[n] ~ "/indicated-time-min"; |
| 65 |
airoot.getNode(p, 1).alias(props.globals.getNode(p)); |
| 66 |
} |