Subversion Repositories group.electronics

Rev

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

Rev 172 Rev 173
Line 7... Line 7...
7
 
7
 
8
namespace nitdcscore {
8
namespace nitdcscore {
9
    public class NitMultiPanel : Panel {
9
    public class NitMultiPanel : Panel {
10
 
10
 
11
        private mcp23017[] chips;
11
        private mcp23017[] chips;
-
 
12
        public byte ledShadow = 0x00;
12
        
13
        
13
        public NitMultiPanel(mcp2221 mcp) : base(mcp) {
14
        public NitMultiPanel(mcp2221 mcp) : base(mcp) {
14
            chips = new mcp23017[2] { new mcp23017(mcp, 0x20), new mcp23017(mcp, 0x24) };
15
            chips = new mcp23017[2] { new mcp23017(mcp, 0x20), new mcp23017(mcp, 0x24) };
15
 
16
 
16
            this.Init();
17
            this.Init();
Line 121... Line 122...
121
            this.addLed(new Led(0, 3, 0x1112, 0x0020, 5));     // NMSP_ILS_LED
122
            this.addLed(new Led(0, 3, 0x1112, 0x0020, 5));     // NMSP_ILS_LED
122
            this.addLed(new Led(0, 0, 0x1110, 0x8000, 15));    // NMSP_STEERPT_LED
123
            this.addLed(new Led(0, 0, 0x1110, 0x8000, 15));    // NMSP_STEERPT_LED
123
            this.addLed(new Led(0, 2, 0x1112, 0x0008, 3));     // NMSP_TCN_LED
124
            this.addLed(new Led(0, 2, 0x1112, 0x0008, 3));     // NMSP_TCN_LED
124
            this.addLed(new Led(0, 7, 0x11bc, 0x0002, 1));     // NMSP_UHF_LED
125
            this.addLed(new Led(0, 7, 0x11bc, 0x0002, 1));     // NMSP_UHF_LED
125
 
126
 
-
 
127
            //this.addLed(new Led(0, 6, 0x1012, 0x0800, 11));     // MASTER_CAUTION
-
 
128
 
126
            this.Refresh();
129
            this.Refresh();
127
            data.prev = data.buttons;
130
            data.prev = data.buttons;
128
            data.axis[0].prev = data.axis[0].value;
131
            data.axis[0].prev = data.axis[0].value;
129
            data.axis[1].prev = data.axis[1].value;
132
            data.axis[1].prev = data.axis[1].value;
130
            data.changed = false;
133
            data.changed = false;
Line 154... Line 157...
154
            if (data.buttons != data.prev)
157
            if (data.buttons != data.prev)
155
                data.changed = true;
158
                data.changed = true;
156
            else
159
            else
157
                data.changed = false;
160
                data.changed = false;
158
 
161
 
159
 
-
 
160
            byte ledByte = (byte)(data.buttons >> 16);
162
            byte tmpShadow = this.ledShadow;
161
            foreach (Led led in this.leds) {
163
            foreach (Led led in this.leds) {
162
                if (led.Tick(ref ledByte)) {
164
                led.Tick(ref ledShadow);
163
                    Console.WriteLine("Led: " + ledByte);
-
 
164
                    chips[1].SetBank(led.bank, ledByte);
-
 
165
                }
-
 
166
            }
165
            }
167
 
166
 
-
 
167
            // Only update if leds have changed
-
 
168
            if (tmpShadow != this.ledShadow)
-
 
169
                chips[1].SetBank(0, ledShadow);
-
 
170
 
-
 
171
 
168
            return rslt;
172
            return rslt;
169
        }
173
        }
170
 
174
 
171
        public override int Input() {
175
        public override int Input() {
172
            //Console.WriteLine(input.curr.ToString("X"));
176
            //Console.WriteLine(input.curr.ToString("X"));