-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsaitekswitch.nas
40 lines (36 loc) · 1.47 KB
/
saitekswitch.nas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
####################################################
# FUNCTIONS in Saitek Switch Panel
####################################################
####################################################
# Issue the switch command
####################################################
var do_action = func {
var thing = getprop("/saitek-switch-panel/switch");
var action = getprop("/saitek-switch-panel/action");
if (thing == "autopilot engage") {
# looking for autopilot engage/disengage for KAP140 on PA28-116
var state = getprop("autopilot/kap140/panel/state");
if (state == 5 and action == 1) {
# engaging - no sound
setprop("autopilot/kap140/panel/state-old", 5);
setprop("autopilot/kap140/panel/state", 6);
}
else if (state == 6 and action == 0) {
# disengaging - make sound
setprop("autopilot/kap140/panel/ap-timer", 5);
setprop("autopilot/kap140/panel/state", 5);
}
} else if (thing =="instrumentation/nav-source/selector") {
if (action ==1) {
setprop(thing, 2); # GPS select
}
else {
setprop(thing, 0); # NAV1 select
}
setprop("autopilot/kap140/panel/nav-timer",getprop("sim/time/elapsed-sec"));
setprop("/sim/sounde/switch1", 1);
} else if (thing == "controls/engines/engine/primer-lever") {
c172p.pumpPrimer();
} else setprop(thing, action);
}
setlistener ("/saitek-switch-panel/action", do_action);