zkv1000 / Nasal / knobs.nas /
Newer Older
68 lines | 2.944kb
commit initial
Sébastien MARQUE authored on 2017-03-07
1
var knobsClass = {
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
2
    new : func (device) {
commit initial
Sébastien MARQUE authored on 2017-03-07
3
        var m = { parents: [ knobsClass ] };
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
4
        m.device = device;
commit initial
Sébastien MARQUE authored on 2017-03-07
5
        return m;
6
    },
7

            
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
8
    XPDRCodeSetDigits : func (d) {
9
        # disable SoftKey entering method
10
        setprop('/instrumentation/zkv1000/radios/xpdr-tuning-fms-method', 1);
11
        if (!contains(me.device.softkeys.bindings.PFD.XPDR.CODE, 'on_change_inactivity')) {
12
            me.device.softkeys.bindings.PFD.XPDR.CODE.inactivity.stop();
13
            me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity = maketimer(10,
14
                func {
15
                    setprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit', 3);
16
                    call(me.device.softkeys.bindings.PFD.XPDR.CODE.restore, [], me);
17
                });
18
            me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity.singleShot = 1;
19
            me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity.start();
20
        }
21
        else
22
            me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10);
23
        var digit = getprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit');
24
        var code = getprop('/instrumentation/transponder/id-code');
25
        if (digit == 3)
26
            var val = int(code/100) + d;
27
        else
28
            var val = math.mod(code, 100) + d;
29
        if (math.mod(val, 10) == 8) {
30
            if (val > 77)
31
                val = 0;
32
            else
33
                val += 2;
34
        }
35
        elsif (val < 0)
36
            val = 77;
37
        elsif (math.mod(val, 10) == 9)
38
            val -= 2;
39
        if (digit == 3)
40
            setprop('/instrumentation/transponder/id-code',
41
                    sprintf('%i', val * 100 + math.mod(code, 100)));
42
        else
43
            setprop('/instrumentation/transponder/id-code',
44
                    sprintf('%i', int(code/100) * 100 + val));
45
        me.device.display.updateXPDR();
46
    },
47

            
48
    XPDRCodeNextDigits : func {
49
        setprop('/instrumentation/zkv1000/radios/xpdr-tuning-fms-method', 1);
50
        if (!contains(me.device.softkeys.bindings.PFD.XPDR.CODE, 'on_change_inactivity')) {
51
            me.device.softkeys.bindings.PFD.XPDR.CODE.inactivity.stop();
52
            me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity = maketimer(10,
53
                func {
54
                    setprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit', 3);
55
                    call(me.device.softkeys.bindings.PFD.XPDR.CODE.restore, [], me);
56
                });
57
            me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity.singleShot = 1;
58
            me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity.start();
59
        }
60
        else
61
            me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10);
62
        setprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit', 1);
63
        me.device.display.updateXPDR();
64
    },
65

            
commit initial
Sébastien MARQUE authored on 2017-03-07
66
    FmsInner : void,
67
    FmsOuter : void
68
};