zkv1000 / Nasal / buttons.nas /
Sébastien MARQUE commit initial
56c0030 7 years ago
1 contributor
68 lines | 2.204kb
var buttonsClass = {
    new : func (node) {
        var m = { parents: [ buttonsClass ] };
        m.node = node;
        return m;
    },

    PAN : func (xdir = 0, ydir = 0) {
    },

    AsSwitchNAV : func {
        var n = getprop('/instrumentation/zkv1000/radios/nav-tune');
        var tmp = getprop('/instrumentation/nav[' ~ n ~ ']/frequencies/selected-mhz');
        setprop('/instrumentation/nav[' ~ n ~ ']/frequencies/selected-mhz', getprop('/instrumentation/nav[' ~ n ~ ']/frequencies/standby-mhz'));
        setprop('/instrumentation/nav[' ~ n ~ ']/frequencies/standby-mhz', tmp);
    },

    AsSwitchCOM : func (emergency = 0) {
        if (emergency) {
            setprop('/instrumentation/comm/frequencies/selected-mhz', 121.500);
            setprop('/instrumentation/zkv1000/radios/comm1-selected', 1);
            setprop('/instrumentation/zkv1000/radios/comm2-selected', 0);
        }
        else {
            var c = getprop('/instrumentation/zkv1000/radios/comm-tune');
            var tmp = getprop('/instrumentation/comm[' ~ c ~ ']/frequencies/selected-mhz');
            setprop('/instrumentation/comm[' ~ c ~ ']/frequencies/selected-mhz', getprop('/instrumentation/comm[' ~ c ~ ']/frequencies/standby-mhz'));
            setprop('/instrumentation/comm[' ~ c ~ ']/frequencies/standby-mhz', tmp);
        }
    },

    NAV : func (x) {
        if (x) {
            fgcommand('property-toggle', props.Node.new({
                property: '/instrumentation/zkv1000/radios/nav-tune'
            }));
        }
    },

    COM : func (x) {
        if (x) {
            fgcommand('property-toggle', props.Node.new({
                property: '/instrumentation/zkv1000/radios/comm-tune'
            }));
        }
    },

    HDG : func (x) {
        if (x) {
            fgcommand('property-assign', props.Node.new({
                property: '/instrumentation/zkv1000/afcs/heading-bug-deg',
                property: '/orientation/heading-magnetic-deg'
            }));
        }
    },

    VolNAV : void,
    VolCOM : void,
    ALT : void,
    BARO : void,
    DirectTo : void,
    MENU : void,
    FPL : void,
    PROC : void,
    CLR : void,
    ENT : void,
    FMS : void,
};