zkv1000 / Nasal / radios.nas /
Newer Older
60 lines | 1.972kb
commit initial
Sébastien MARQUE authored on 2017-03-07
1
var xpdr_digits = 1;
2
var xpdr_id_timer = 0;
3
var tofromflag = nil;
4

            
5
var radios_list = [
6
    '/instrumentation/nav/frequencies/standby-mhz',
7
    '/instrumentation/nav[1]/frequencies/standby-mhz',
8
    '/instrumentation/nav/frequencies/selected-mhz',
9
    '/instrumentation/nav[1]/frequencies/selected-mhz',
10
    '/instrumentation/comm/frequencies/standby-mhz',
11
    '/instrumentation/comm[1]/frequencies/standby-mhz',
12
    '/instrumentation/comm/frequencies/selected-mhz',
13
    '/instrumentation/comm[1]/frequencies/selected-mhz',
14
];
15

            
16
var setNavTune = func {
17
    var freq = radios.getNode('nav-freq-mhz', 1);
18
    freq.unalias();
19
    freq.alias(radios_list[getprop('/instrumentation/zkv1000/radios/nav-tune')]);
20
}
21

            
22
var setCommTune = func {
23
    var freq = radios.getNode('comm-freq-mhz', 1);
24
    freq.unalias();
25
    freq.alias(radios_list[getprop('/instrumentation/zkv1000/radios/comm-tune') + 4]);
26
}
27

            
adds CDI
Sébastien MARQUE authored on 2017-03-18
28
var aliases = {
29
    NAV : {
30
        'in-range' : 'in-range',
31
        'course'   : 'radials/selected-deg',
32
        'course-deflection' : 'heading-needle-deflection',
33
        'FROM-flag' : 'from-flag',
34
        'TO-flag' : 'to-flag',
35
        'radial' : 'radials/reciprocal-radial-deg',
36
    },
37
    GPS : {
38
        'course' : 'desired-course-deg',
39
        'course-deflection' : 'wp/wp[1]/course-error-nm',
40
        'FROM-flag': 'wp/wp[1]/from-flag',
41
        'TO-flag': 'wp/wp[1]/to-flag',
42
    }
43
};
44

            
45
var CDIfromSOURCE = func (source) {
46
    if (source == 'OFF') {
47
# all the aliases of GPS are included in NAV too
48
        foreach (var a; keys(aliases['NAV']))
49
            cdi.getNode(a).unalias();
50
    }
51
    else {
52
        var s = (source == 'GPS') ? 'gps' : 'nav[' ~ (right(source, 1) - 1) ~ ']';
53
        foreach (var a; keys(aliases[left(source, 3)])) {
54
            cdi.getNode(a).unalias();
55
            cdi.getNode(a).alias('/instrumentation/' ~ s ~ '/' ~ aliases[left(source, 3)][a]);
56
        }
57
    }
commit initial
Sébastien MARQUE authored on 2017-03-07
58
}
59

            
60
foreach (var r; radios_list) props.globals.getNode(r ~ '-dec',1).setIntValue(0);