Subversion Repositories group.electronics

Rev

Rev 161 | Rev 164 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 161 Rev 162
Line 1... Line 1...
1
using System;
1
using System;
2
using System.Collections.Generic;
2
using System.Collections.Generic;
3
using System.Linq;
3
using System.Linq;
4
using System.Text;
4
using System.Text;
5
using System.Threading.Tasks;
5
using System.Threading.Tasks;
-
 
6
using WindowsInput.Native;
6
 
7
 
7
namespace nitdcscore {
8
namespace nitdcscore {
8
    public interface IPanel {
9
    public interface IPanel {
9
        int Init();
10
        int Init();
10
        int Refresh();
11
        int Refresh();
Line 72... Line 73...
72
 
73
 
73
            this.Init();
74
            this.Init();
74
        }
75
        }
75
 
76
 
76
        public override int Init() {
77
        public override int Init() {
77
            
78
            //AHCP
78
            this.addControl(new Switch3Pos(new CommandDCS("AHCP_MASTER_ARM"), 8, 9));   // Train - Safe - Arm
79
            this.addControl(new Switch3Pos(new CommandDCS("AHCP_MASTER_ARM"), 8, 9));   // Train - Safe - Arm
79
            this.addControl(new Switch3Pos(new CommandDCS("AHCP_GUNPAC"), 10, 11));     // Gunarm - Safe - Arm
80
            this.addControl(new Switch3Pos(new CommandDCS("AHCP_GUNPAC"), 10, 11));     // Gunarm - Safe - Arm
80
            this.addControl(new Switch3Pos(new CommandDCS("AHCP_LASER_ARM"), 12, 13));  // Train - Safe - Arm
81
            this.addControl(new Switch3Pos(new CommandDCS("AHCP_LASER_ARM"), 12, 13));  // Train - Safe - Arm
81
            this.addControl(new Switch2Pos(new CommandDCS("AHCP_TGP"), 14));            // Off - On
82
            this.addControl(new Switch2Pos(new CommandDCS("AHCP_TGP"), 14));            // Off - On
82
            this.addControl(new Switch3Pos(new CommandDCS("AHCP_ALT_SCE"), 0, 1));      // Radar  - Delta - Baro
83
            this.addControl(new Switch3Pos(new CommandDCS("AHCP_ALT_SCE"), 0, 1));      // Radar  - Delta - Baro
83
            this.addControl(new Switch2Pos(new CommandDCS("AHCP_HUD_DAYNIGHT"), 2));    // Night - Day
84
            this.addControl(new Switch2Pos(new CommandDCS("AHCP_HUD_DAYNIGHT"), 2));    // Night - Day
84
            this.addControl(new Switch2Pos(new CommandDCS("AHCP_HUD_MODE"), 15));       // Stby - Norm
85
            this.addControl(new Switch2Pos(new CommandDCS("AHCP_HUD_MODE"), 15));       // Stby - Norm
85
            this.addControl(new Switch2Pos(new CommandDCS("AHCP_CICU"), 3));            // Off - On
86
            this.addControl(new Switch2Pos(new CommandDCS("AHCP_CICU"), 3));            // Off - On
86
            this.addControl(new Switch2Pos(new CommandDCS("AHCP_JTRS"), 4));            // Off - On
87
            this.addControl(new Switch2Pos(new CommandDCS("AHCP_JTRS"), 4));            // Off - On
87
            this.addControl(new Switch3Pos(new CommandDCS("AHCP_IFFCC"), 6, 5));        // Off - Test - On
88
            this.addControl(new Switch3Pos(new CommandDCS("AHCP_IFFCC"), 6, 5));        // Off - Test - On
88
            this.addControl(new Switch2Pos(new CommandDCS("HARS_FAST_ERECT"), 7));      // Off - On
89
            //this.addControl(new Switch2Pos(new CommandDCS("HARS_FAST_ERECT"), 7));      // Off - On
-
 
90
            this.addControl(new Switch2Pos(new CommandTrackIRKey(VirtualKeyCode.F9), 7));
89
            
91
            
90
              
92
            // Fuel System
-
 
93
            this.addControl(new Switch2Pos(new CommandDCS("FSCP_AMPL"), 16));
-
 
94
            this.addControl(new Switch2Pos(new CommandDCS("FSCP_BOOST_MAIN_L"), 24));
-
 
95
            this.addControl(new Switch2Pos(new CommandDCS("FSCP_BOOST_MAIN_R"), 25));
-
 
96
            this.addControl(new Switch2Pos(new CommandDCS("FSCP_BOOST_WING_L"), 26));
-
 
97
            this.addControl(new Switch2Pos(new CommandDCS("FSCP_BOOST_WING_R"),27 ));
-
 
98
            this.addControl(new Switch2Pos(new CommandDCS("FSCP_CROSSFEED"), 28));
-
 
99
            this.addControl(new Switch2Pos(new CommandDCS("FSCP_EXT_TANKS_FUS"), 30));
-
 
100
            this.addControl(new Switch2Pos(new CommandDCS("FSCP_EXT_TANKS_WING"), 31));
-
 
101
            this.addControl(new Switch2Pos(new CommandDCS("FSCP_FD_MAIN_L"), 20, true));
-
 
102
            this.addControl(new Switch2Pos(new CommandDCS("FSCP_FD_MAIN_R"), 21, true));
-
 
103
            this.addControl(new Switch2Pos(new CommandDCS("FSCP_FD_WING_L"), 18, true));
-
 
104
            this.addControl(new Switch2Pos(new CommandDCS("FSCP_FD_WING_R"), 19, true));
-
 
105
            this.addControl(new Switch2Pos(new CommandDCS("FSCP_LINE_CHECK"), 17));
-
 
106
            this.addControl(new Switch2Pos(new CommandDCS("FSCP_RCVR_LEVER"), 23));
-
 
107
            this.addControl(new Switch2Pos(new CommandDCS("FSCP_TK_GATE"), 29));
91
             
108
             
92
            mcp.WriteGpio(3, 0);
109
            mcp.WriteGpio(3, 0);
93
            Utils.delayms(500);
110
            Utils.delayms(500);
94
            // Enable the mcp23017
111
            // Enable the mcp23017
95
            mcp.WriteGpio(3, 1);
112
            mcp.WriteGpio(3, 1);
Line 199... Line 216...
199
 
216
 
200
            this.Init();
217
            this.Init();
201
        }
218
        }
202
 
219
 
203
        public override int Init() {
220
        public override int Init() {
-
 
221
            this.addControl(new Switch2Pos(new CommandTrackIRKey(VirtualKeyCode.F9), 16));
-
 
222
            this.addControl(new Switch2Pos(new CommandTrackIRKey(VirtualKeyCode.F11), 17));
-
 
223
            this.addControl(new Switch2Pos(new CommandTrackIRKey(VirtualKeyCode.F7), 12));
-
 
224
            this.addControl(new Switch2Pos(new CommandVKey(VirtualKeyCode.SPACE), 13));
-
 
225
            this.addControl(new Switch2Pos(new CommandVKey(VirtualKeyCode.RETURN), 14));
-
 
226
            this.addControl(new Switch2Pos(new CommandVKey(VirtualKeyCode.VOLUME_MUTE), 15));
204
            this.addControl(new Switch2Pos(new CommandDCS("AAP_CDUPWR"), 11));
227
            this.addControl(new Switch2Pos(new CommandDCS("AAP_CDUPWR"), 11));
205
            this.addControl(new Switch2Pos(new CommandDCS("AAP_EGIPWR"), 10));
228
            this.addControl(new Switch2Pos(new CommandDCS("AAP_EGIPWR"), 10));
206
            this.addControl(new Switch3Pos(new CommandDCS("AAP_STEER"), 9, 8));
229
            this.addControl(new Switch3Pos(new CommandDCS("AAP_STEER"), 9, 8));
207
            this.addControl(new Selector(new CommandDCS("AAP_STEERPT"), new int[] { 4, 5, 6 }));
230
            this.addControl(new Selector(new CommandDCS("AAP_STEERPT"), new int[] { 4, 5, 6 }));
208
            this.addControl(new Selector(new CommandDCS("AAP_PAGE"), new int[] { 0, 1, 2, 3 }));
231
            this.addControl(new Selector(new CommandDCS("AAP_PAGE"), new int[] { 0, 1, 2, 3 }));
Line 246... Line 269...
246
            
269
            
247
            return rslt;
270
            return rslt;
248
        }
271
        }
249
 
272
 
250
        public override int Input() {
273
        public override int Input() {
-
 
274
            //Console.WriteLine(input.curr.ToString("X"));
251
            foreach (Control control in this.controls) {
275
            foreach (Control control in this.controls) {
252
                control.data = this.input;
276
                control.data = this.input;
253
                control.Tick();
277
                control.Tick();
254
            }
278
            }
255
            input.prev = input.curr;
279
            input.prev = input.curr;