37 int Key_Up = FALSE; |
37 int Key_Up = FALSE; |
38 int Key_Down = FALSE; |
38 int Key_Down = FALSE; |
39 |
39 |
40 int previous_key = KEY_NONE; |
40 int previous_key = KEY_NONE; |
41 int menutimer = 0; |
41 int menutimer = 0; |
42 |
|
43 int Led_Off = 0; |
|
44 int Led_On = 100; |
|
45 |
|
46 |
|
47 /* |
|
48 * LED flash patterns, on, off. Times in 10 mSecs. |
|
49 */ |
|
50 const int LED_OFF[2] = { 0, 100 }; |
|
51 const int LED_ON[2] = { 100, 0 }; |
|
52 const int LED_WARN[2] = { 5, 95 }; |
|
53 const int LED_ALARM[2] = { 50, 50 }; |
|
54 |
42 |
55 |
43 |
56 |
44 |
57 /* |
45 /* |
58 * Check for a key. Return last pressed key or none. |
46 * Check for a key. Return last pressed key or none. |
99 pinMode(PANEL_LED, OUTPUT); |
87 pinMode(PANEL_LED, OUTPUT); |
100 pinMode(PANEL_ENTER, INPUT); |
88 pinMode(PANEL_ENTER, INPUT); |
101 pinMode(PANEL_UP, INPUT); |
89 pinMode(PANEL_UP, INPUT); |
102 pinMode(PANEL_DOWN, INPUT); |
90 pinMode(PANEL_DOWN, INPUT); |
103 |
91 |
104 |
|
105 syslog(LOG_NOTICE, "Thread my_panel_loop started"); |
92 syslog(LOG_NOTICE, "Thread my_panel_loop started"); |
106 if (debug) |
|
107 fprintf(stdout, "Thread my_panel_loop started\n"); |
|
108 |
93 |
109 /* |
94 /* |
110 * Loop forever until the external shutdown variable is set. |
95 * Loop forever until the external shutdown variable is set. |
111 */ |
96 */ |
112 for (;;) { |
97 for (;;) { |
157 * No key pressed. |
142 * No key pressed. |
158 */ |
143 */ |
159 AnyKey = FALSE; |
144 AnyKey = FALSE; |
160 } |
145 } |
161 |
146 |
162 // if (debug && AnyKey) |
|
163 // fprintf(stdout, "keys Enter=%d,%s,%s Up=%d,%s Down=%d,%s\n", |
|
164 // Enter, Key_Enter ?"True":"False", Key_Enter_Long ?"True":"False", Up, Key_Up ?"True":"False", Down, Key_Down ?"True":"False"); |
|
165 |
|
166 Now = time(NULL); |
147 Now = time(NULL); |
167 if (Now != Last) { |
148 if (Now != Last) { |
168 Last = Now; |
149 Last = Now; |
169 |
150 |
170 // if (debug) |
|
171 // fprintf(stdout, "AnyKey=%s Backlight=%d\n", AnyKey ?"True":"False", Backlight); |
|
172 if (AnyKey == FALSE) { |
151 if (AnyKey == FALSE) { |
173 if (Backlight == 1) |
152 if (Backlight == 1) |
174 setBacklight(0); |
153 setBacklight(0); |
175 if (Backlight > 0) { |
154 if (Backlight > 0) { |
176 Backlight--; |
155 Backlight--; |