Showing 2 changed files with 71 additions and 0 deletions
+70
Nasal/afcs.nas
... ...
@@ -4,6 +4,7 @@ var APClass = {
4 4
 
5 5
         m.system = 'none';
6 6
         var ap_systems = { # described AP systems to search, if it returns true system is set
7
+            STEC55X: func contains(stec55x, 'ITAF'),
7 8
         };
8 9
         foreach (var s; sort(keys(ap_systems), func(a,b) cmp(a,b))) {
9 10
             call(ap_systems[s], [], nil, nil, var errors = []);
... ...
@@ -67,5 +68,74 @@ var APClass = {
67 68
             L: [ func, func, func, func, func, func ],
68 69
             R: [ func, func, func, func, func, func ],
69 70
         },
71
+        STEC55X: {
72
+            hook : func,
73
+            updateDisplay: func {
74
+                if (autopilot._locked)
75
+                    return;
76
+                var ap_annun = '';
77
+                if (flightdeck['PFD'].display.screenElements['AP-text'].getText() != ''
78
+                and stec55x.pitch.getValue() == -1 and stec55x.roll.getValue()  == -1) {
79
+                    autopilot._blinking();
80
+                    return;
81
+                }
82
+                elsif (stec55x.roll.getValue() != -1 or stec55x.pitch.getValue() != -1)
83
+                    ap_annun = 'AP';
84
+
85
+                foreach (var mode; ['HDG', 'NAV', 'APR'])
86
+                    if (stec55x[mode ~ '_annun'].getValue())
87
+                        ap_annun ~= ' ' ~ mode;
88
+
89
+                if (stec55x.ALT_annun.getValue())
90
+                    ap_annun ~= sprintf('ALT %5d ft', math.round(me.data.alt), 10); # even if pressure is hold, we show alt in feet
91
+
92
+                if (stec55x.VS_annun.getValue())
93
+                    ap_annun ~= sprintf('VS %s %4d fpm',
94
+                                        utf8.chstr(stec55x.vs.getValue() > 0 ? 9650 : 9660),
95
+                                        math.abs(math.round(stec55x.vs.getValue(), 10)));
96
+
97
+            },
98
+            L: [
99
+                func {
100
+                    var ap_master_sw = '/it-stec55x/input/ap-master-sw';
101
+                    setprop(ap_master_sw, !getprop(ap_master_sw));
102
+                },
103
+                func {
104
+                    var apfd_master_sw = '/it-stec55x/input/apfd-master-sw';
105
+                    setprop(apfd_master_sw, !getprop(apfd_master_sw));
106
+                },
107
+                func {
108
+                    call(stec55x.button.NAV, [], nil, stec55x);
109
+                },
110
+                func {
111
+                    call(stec55x.button.ALT, [], nil, stec55x);
112
+                },
113
+                func {
114
+                    call(stec55x.button.VS, [], nil, stec55x);
115
+                },
116
+                func,
117
+            ],
118
+            R: [
119
+                func {
120
+                    var yaw_dumper_sw = '/it-stec55x/input/yaw-damper-sw';
121
+                    setprop(yaw_dumper_sw, !getprop(yaw_dumper_sw));
122
+                },
123
+                func {
124
+                    call(stec55x.button.HDG, [], nil, stec55x);
125
+                },
126
+                func {
127
+                    call(stec55x.button.APR, [], nil, stec55x);
128
+                },
129
+                func,
130
+                func { # UP (trim)
131
+                    fgcommand('property-assign', {property: '/it-stec55x/input/man-trim', value: -1});
132
+                    fgcommand('property-assign', {property: '/it-stec55x/input/man-trim', value:  0});
133
+                },
134
+                func { # DN (trim)
135
+                    fgcommand('property-assign', {property: '/it-stec55x/input/man-trim', value: 1});
136
+                    fgcommand('property-assign', {property: '/it-stec55x/input/man-trim', value: 0});
137
+                },
138
+            ],
139
+        }
70 140
     }
71 141
 };
+1
README.md
... ...
@@ -88,6 +88,7 @@ Please report bug at <zkv1000@seb.lautre.net>.
88 88
   * XPDR: emergency code depending of the country (eg.: 1200 for US, 7700 for Europe), should be set in settings
89 89
   * use of [maketimer()](http://wiki.flightgear.org/Nasal_library#maketimer.28.29) instead of [settimer()](http://wiki.flightgear.org/Nasal_library#settimer.28.29) when possible
90 90
   * AFCS capabilities
91
+    * integration of Octal540's [S-TEC 55X](http://wiki.flightgear.org/S-TEC_55X) autopilot system
91 92
 * ![][80%]
92 93
   * route displayed on map: legs ![][done], current and next leg ![][done], TOC/TOD ![][ongoing], OBS ![][ongoing]
93 94
 * ![][70%]