Tue, 02 Jul 2019 11:00:27 +0200
Fix compiler warning
0 | 1 | /** |
2 | * @file buttons.c | |
3 | * @brief The touch buttons. | |
4 | */ | |
5 | ||
6 | #include "config.h" | |
7 | ||
8 | ||
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
9 | sButton Buttons[MAXBUTTONS]; ///< 40 buttons on a screen. |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
10 | int level = 1; ///< Keyboard level. |
0 | 11 | |
19 | 12 | const char *mashTypes[] = { "Infusion", "Temperature", "Decoction" }; |
13 | const char *SSR2Types[] = { "Uit", "HLT of MLT", "HLT en MLT", "Idle" }; | |
14 | ||
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
15 | uint8_t WS_pressed = 0; ///< Websocket button received |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
16 | uint16_t WS_pointer_x = 0; ///< Websocket coordinate x |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
17 | uint16_t WS_pointer_y = 0; ///< Websocket coordinate y |
0 | 18 | |
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
19 | #define EDIT_TYPE_TEXT 0 ///< Editor type is text |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
20 | #define EDIT_TYPE_INT 1 ///< Editor type is integer |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
21 | #define EDIT_TYPE_FLOAT 2 ///< Editor type is float |
0 | 22 | |
23 | ||
24 | /***************************************************************************/ | |
25 | ||
26 | ||
27 | void WaitTouchReleased(void) | |
28 | { | |
29 | int tx, ty; | |
30 | ||
31 | // Do raw reads. | |
32 | while (TFT_read_touch(&tx, &ty, 1) == 1) { | |
33 | vTaskDelay(50 / portTICK_PERIOD_MS); | |
34 | } | |
35 | } | |
36 | ||
37 | ||
38 | ||
39 | void Buttons_Clear(void) | |
40 | { | |
41 | int i; | |
42 | ||
43 | for (i = 0; i < MAXBUTTONS; i++) { | |
44 | if ((Buttons[i].x != -1) && strlen(Buttons[i].text)) { | |
45 | TFT_fillRect(Buttons[i].x, Buttons[i].y, Buttons[i].w, Buttons[i].h, TFT_BLACK); | |
46 | } | |
47 | Buttons[i].x = -1; | |
48 | } | |
49 | } | |
50 | ||
51 | ||
52 | ||
53 | void Buttons_Add(int x, int y, int w, int h, char *txt, int order) | |
54 | { | |
55 | Buttons[order].x = x; | |
56 | Buttons[order].y = y; | |
57 | Buttons[order].w = w; | |
58 | Buttons[order].h = h; | |
59 | strncpy(Buttons[order].text, txt, 11); | |
19 | 60 | Buttons[order].dark = Buttons[order].small = Buttons[order].lock = false; |
0 | 61 | } |
62 | ||
63 | ||
64 | ||
65 | void Buttons_Show(void) | |
66 | { | |
67 | int i; | |
68 | const color_t KEY_NORM = { 191, 191, 191}; | |
69 | const color_t KEY_DARK = { 95, 95, 95}; | |
70 | const color_t KEY_LOCK = { 127, 127, 255}; | |
71 | ||
72 | _fg = TFT_BLACK; | |
73 | ||
74 | for (i = 0; i < MAXBUTTONS; i++) { | |
75 | if (Buttons[i].x != -1) { | |
76 | ||
77 | if (Buttons[i].lock) { | |
78 | _fg = TFT_BLACK; | |
79 | TFT_fillRoundRect(Buttons[i].x, Buttons[i].y, Buttons[i].w, Buttons[i].h, 5, KEY_LOCK); | |
80 | } else if (Buttons[i].dark) { | |
81 | _fg = TFT_WHITE; | |
82 | TFT_fillRoundRect(Buttons[i].x, Buttons[i].y, Buttons[i].w, Buttons[i].h, 5, KEY_DARK); | |
83 | } else { | |
84 | _fg = TFT_BLACK; | |
85 | TFT_fillRoundRect(Buttons[i].x, Buttons[i].y, Buttons[i].w, Buttons[i].h, 5, KEY_NORM); | |
86 | } | |
87 | TFT_drawRoundRect(Buttons[i].x, Buttons[i].y, Buttons[i].w, Buttons[i].h, 5, TFT_LIGHTGREY); | |
88 | if (Buttons[i].small) | |
89 | TFT_setFont(DEFAULT_FONT, NULL); // DEF_SMALL_FONT | |
90 | else | |
91 | TFT_setFont(DEJAVU18_FONT, NULL); | |
92 | font_transparent = 1; | |
93 | TFT_print(Buttons[i].text, | |
94 | Buttons[i].x + ((Buttons[i].w - TFT_getStringWidth(Buttons[i].text)) / 2), | |
95 | Buttons[i].y + 1 + ((Buttons[i].h - TFT_getfontheight()) / 2)); | |
96 | } | |
97 | } | |
98 | ||
99 | font_transparent = 0; | |
100 | } | |
101 | ||
102 | ||
103 | ||
104 | int Buttons_Search(int x, int y) | |
105 | { | |
106 | int i; | |
107 | ||
108 | for (i = 0; i < MAXBUTTONS; i++) { | |
109 | if (Buttons[i].x != -1) { | |
110 | if ((x >= Buttons[i].x) && (x <= (Buttons[i].x + Buttons[i].w)) && | |
111 | (y >= Buttons[i].y) && (y <= (Buttons[i].y + Buttons[i].h))) { | |
112 | return i; | |
113 | } | |
114 | } | |
115 | } | |
116 | ||
117 | return -1; | |
118 | } | |
119 | ||
120 | ||
121 | ||
122 | int Buttons_Scan(void) | |
123 | { | |
124 | int tx, ty, rc; | |
125 | static int ox = -1, oy = -1, vx = -1, vy = -1; | |
126 | static bool t_pressed = false, v_pressed = false; | |
127 | ||
128 | if (TFT_read_touch(&tx, &ty, 0)) { | |
129 | t_pressed = true; | |
130 | ox = tx; | |
131 | oy = ty; | |
132 | return -1; | |
133 | } else if (t_pressed) { | |
134 | rc = Buttons_Search(ox, oy); | |
135 | t_pressed = false; | |
136 | ox = oy = -1; | |
137 | return rc; | |
138 | } | |
139 | ||
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
140 | if (WS_pressed) { |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
141 | v_pressed = true; |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
142 | vx = WS_pointer_x; |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
143 | vy = WS_pointer_y; |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
144 | WS_pressed = 0; |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
145 | return -1; |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
146 | } else if (v_pressed) { |
0 | 147 | rc = Buttons_Search(vx, vy); |
148 | v_pressed = false; | |
149 | vx = vy = -1; | |
150 | return rc; | |
151 | } | |
152 | ||
153 | return -1; | |
154 | } | |
155 | ||
156 | ||
157 | ||
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
158 | void WS_touched(int x, int y) |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
159 | { |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
160 | WS_pointer_x = x; |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
161 | WS_pointer_y = y; |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
162 | WS_pressed = 1; |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
163 | } |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
164 | |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
165 | |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
38
diff
changeset
|
166 | |
0 | 167 | static const uint8_t alphalow_tab[] = { 'q','w','e','r','t','y','u','i','o','p', |
168 | 'a','s','d','f','g','h','j','k','l', | |
169 | 'z','x','c','v','b','n','m' }; | |
170 | ||
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
171 | /** |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
172 | * @brief Level 1 keys, lowercase alpha. |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
173 | */ |
0 | 174 | void B_AlphaLow(void) |
175 | { | |
176 | Buttons_Clear(); | |
177 | ||
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
178 | Buttons_Add( 2, 80,28,36,(char *)"q", 0); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
179 | Buttons_Add( 34, 80,28,36,(char *)"w", 1); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
180 | Buttons_Add( 66, 80,28,36,(char *)"e", 2); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
181 | Buttons_Add( 98, 80,28,36,(char *)"r", 3); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
182 | Buttons_Add(130, 80,28,36,(char *)"t", 4); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
183 | Buttons_Add(162, 80,28,36,(char *)"y", 5); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
184 | Buttons_Add(194, 80,28,36,(char *)"u", 6); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
185 | Buttons_Add(226, 80,28,36,(char *)"i", 7); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
186 | Buttons_Add(258, 80,28,36,(char *)"o", 8); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
187 | Buttons_Add(290, 80,28,36,(char *)"p", 9); |
0 | 188 | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
189 | Buttons_Add( 18,120,28,36,(char *)"a",10); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
190 | Buttons_Add( 50,120,28,36,(char *)"s",11); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
191 | Buttons_Add( 82,120,28,36,(char *)"d",12); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
192 | Buttons_Add(114,120,28,36,(char *)"f",13); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
193 | Buttons_Add(146,120,28,36,(char *)"g",14); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
194 | Buttons_Add(178,120,28,36,(char *)"h",15); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
195 | Buttons_Add(210,120,28,36,(char *)"j",16); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
196 | Buttons_Add(242,120,28,36,(char *)"k",17); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
197 | Buttons_Add(274,120,28,36,(char *)"l",18); |
0 | 198 | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
199 | Buttons_Add( 50,160,28,36,(char *)"z",19); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
200 | Buttons_Add( 82,160,28,36,(char *)"x",20); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
201 | Buttons_Add(114,160,28,36,(char *)"c",21); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
202 | Buttons_Add(146,160,28,36,(char *)"v",22); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
203 | Buttons_Add(178,160,28,36,(char *)"b",23); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
204 | Buttons_Add(210,160,28,36,(char *)"n",24); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
205 | Buttons_Add(242,160,28,36,(char *)"m",25); |
0 | 206 | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
207 | Buttons_Add( 2,160,42,36,(char *)"caps",26); |
0 | 208 | Buttons[26].dark = true; |
209 | Buttons[26].small = true; | |
210 | Buttons[26].lock = false; | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
211 | Buttons_Add(276,160,42,36,(char *)"del",27); |
0 | 212 | Buttons[27].dark = true; |
213 | Buttons[27].small = true; | |
214 | ||
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
215 | Buttons_Add( 2,200,60,36,(char *)"123",28); |
0 | 216 | Buttons[28].dark = true; |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
217 | Buttons_Add( 72,200,28,36,(char *)"/",29); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
218 | Buttons_Add(108,200,104,36,(char *)" ",30); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
219 | Buttons_Add(220,200,28,36,(char *)".",31); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
220 | Buttons_Add(258,200,60,36,(char *)"Ok",32); |
0 | 221 | Buttons[32].dark = true; |
222 | ||
223 | Buttons_Show(); | |
224 | } | |
225 | ||
226 | ||
227 | ||
228 | static const uint8_t alphacaps_tab[] = { 'Q','W','E','R','T','Y','U','I','O','P', | |
229 | 'A','S','D','F','G','H','J','K','L', | |
230 | 'Z','X','C','V','B','N','M' }; | |
231 | ||
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
232 | /** |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
233 | * @brief Level 2 and 3 keys, uppercase alpha. |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
234 | */ |
0 | 235 | void B_AlphaCaps(int level) |
236 | { | |
237 | Buttons_Clear(); | |
238 | ||
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
239 | Buttons_Add( 2, 80,28,36,(char *)"Q", 0); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
240 | Buttons_Add( 34, 80,28,36,(char *)"W", 1); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
241 | Buttons_Add( 66, 80,28,36,(char *)"E", 2); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
242 | Buttons_Add( 98, 80,28,36,(char *)"R", 3); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
243 | Buttons_Add(130, 80,28,36,(char *)"T", 4); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
244 | Buttons_Add(162, 80,28,36,(char *)"Y", 5); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
245 | Buttons_Add(194, 80,28,36,(char *)"U", 6); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
246 | Buttons_Add(226, 80,28,36,(char *)"I", 7); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
247 | Buttons_Add(258, 80,28,36,(char *)"O", 8); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
248 | Buttons_Add(290, 80,28,36,(char *)"P", 9); |
0 | 249 | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
250 | Buttons_Add( 18,120,28,36,(char *)"A",10); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
251 | Buttons_Add( 50,120,28,36,(char *)"S",11); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
252 | Buttons_Add( 82,120,28,36,(char *)"D",12); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
253 | Buttons_Add(114,120,28,36,(char *)"F",13); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
254 | Buttons_Add(146,120,28,36,(char *)"G",14); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
255 | Buttons_Add(178,120,28,36,(char *)"H",15); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
256 | Buttons_Add(210,120,28,36,(char *)"J",16); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
257 | Buttons_Add(242,120,28,36,(char *)"K",17); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
258 | Buttons_Add(274,120,28,36,(char *)"L",18); |
0 | 259 | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
260 | Buttons_Add( 50,160,28,36,(char *)"Z",19); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
261 | Buttons_Add( 82,160,28,36,(char *)"X",20); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
262 | Buttons_Add(114,160,28,36,(char *)"C",21); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
263 | Buttons_Add(146,160,28,36,(char *)"V",22); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
264 | Buttons_Add(178,160,28,36,(char *)"B",23); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
265 | Buttons_Add(210,160,28,36,(char *)"N",24); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
266 | Buttons_Add(242,160,28,36,(char *)"M",25); |
0 | 267 | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
268 | Buttons_Add( 2,160,42,36,(char *)"caps",26); |
0 | 269 | Buttons[26].dark = true; |
270 | Buttons[26].small = true; | |
271 | if (level == 3) | |
272 | Buttons[26].lock = true; | |
273 | else | |
274 | Buttons[26].lock = false; | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
275 | Buttons_Add(276,160,42,36,(char *)"del",27); |
0 | 276 | Buttons[27].dark = true; |
277 | Buttons[27].small = true; | |
278 | ||
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
279 | Buttons_Add( 2,200,60,36,(char *)"123",28); |
0 | 280 | Buttons[28].dark = true; |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
281 | Buttons_Add( 72,200,28,36,(char *)"/",29); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
282 | Buttons_Add(108,204,100,36,(char *)" ",30); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
283 | Buttons_Add(220,200,28,36,(char *)".",31); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
284 | Buttons_Add(258,200,60,36,(char *)"Ok",32); |
0 | 285 | Buttons[32].dark = true; |
286 | ||
287 | Buttons_Show(); | |
288 | } | |
289 | ||
290 | ||
291 | ||
292 | static const uint8_t nums1_tab[] = { '1','2','3','4','5','6','7','8','9','0', | |
293 | '!','@','#','$','/','^','&','*','(',')', | |
294 | '-','\'','\"',':',';',',','?' }; | |
295 | ||
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
296 | /** |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
297 | * @brief Level 4, numeric keys and symbol |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
298 | */ |
0 | 299 | void B_Nums1(void) |
300 | { | |
301 | Buttons_Clear(); | |
302 | ||
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
303 | Buttons_Add( 2, 80,28,36,(char *)"1", 0); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
304 | Buttons_Add( 34, 80,28,36,(char *)"2", 1); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
305 | Buttons_Add( 66, 80,28,36,(char *)"3", 2); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
306 | Buttons_Add( 98, 80,28,36,(char *)"4", 3); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
307 | Buttons_Add(130, 80,28,36,(char *)"5", 4); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
308 | Buttons_Add(162, 80,28,36,(char *)"6", 5); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
309 | Buttons_Add(194, 80,28,36,(char *)"7", 6); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
310 | Buttons_Add(226, 80,28,36,(char *)"8", 7); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
311 | Buttons_Add(258, 80,28,36,(char *)"9", 8); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
312 | Buttons_Add(290, 80,28,36,(char *)"0", 9); |
0 | 313 | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
314 | Buttons_Add( 2,120,28,36,(char *)"!",10); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
315 | Buttons_Add( 34,120,28,36,(char *)"@",11); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
316 | Buttons_Add( 66,120,28,36,(char *)"#",12); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
317 | Buttons_Add( 98,120,28,36,(char *)"$",13); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
318 | Buttons_Add(130,120,28,36,(char *)"/",14); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
319 | Buttons_Add(162,120,28,36,(char *)"^",15); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
320 | Buttons_Add(194,120,28,36,(char *)"&",16); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
321 | Buttons_Add(226,120,28,36,(char *)"*",17); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
322 | Buttons_Add(258,120,28,36,(char *)"(",18); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
323 | Buttons_Add(290,120,28,36,(char *)")",19); |
0 | 324 | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
325 | Buttons_Add( 50,160,28,36,(char *)"-",20); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
326 | Buttons_Add( 82,160,28,36,(char *)"'",21); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
327 | Buttons_Add(114,160,28,36,(char *)"\"",22); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
328 | Buttons_Add(146,160,28,36,(char *)":",23); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
329 | Buttons_Add(178,160,28,36,(char *)";",24); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
330 | Buttons_Add(210,160,28,36,(char *)",",25); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
331 | Buttons_Add(242,160,28,36,(char *)"?",26); |
0 | 332 | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
333 | Buttons_Add( 2,160,42,36,(char *)"1/2",27); |
0 | 334 | Buttons[27].dark = true; |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
335 | Buttons_Add(276,160,42,36,(char *)"del",28); |
0 | 336 | Buttons[28].dark = true; |
337 | Buttons[28].small = true; | |
338 | ||
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
339 | Buttons_Add( 2,200,60,36,(char *)"ABC",29); |
0 | 340 | Buttons[29].dark = true; |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
341 | Buttons_Add( 72,200,28,36,(char *)"/",30); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
342 | Buttons_Add(108,204,100,36,(char *)" ",31); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
343 | Buttons_Add(220,200,28,36,(char *)".",32); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
344 | Buttons_Add(258,200,60,36,(char *)"Ok",33); |
0 | 345 | Buttons[33].dark = true; |
346 | ||
347 | Buttons_Show(); | |
348 | } | |
349 | ||
350 | ||
351 | static const uint8_t nums2_tab[] = { '+','*','/','=','<','>','{','}','[',']', | |
352 | ' ',' ',' ',' ','%','~','`',' ',' ',' ', | |
353 | '_','\\','|',' ',' ',' ',' ' }; | |
354 | ||
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
355 | /** |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
356 | * @brief Level 5, symbol keys |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
357 | */ |
0 | 358 | void B_Nums2(void) |
359 | { | |
360 | Buttons_Clear(); | |
361 | ||
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
362 | Buttons_Add( 2, 80,28,36,(char *)"+", 0); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
363 | Buttons_Add( 34, 80,28,36,(char *)"*", 1); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
364 | Buttons_Add( 66, 80,28,36,(char *)"/", 2); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
365 | Buttons_Add( 98, 80,28,36,(char *)"=", 3); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
366 | Buttons_Add(130, 80,28,36,(char *)"<", 4); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
367 | Buttons_Add(162, 80,28,36,(char *)">", 5); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
368 | Buttons_Add(194, 80,28,36,(char *)"{", 6); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
369 | Buttons_Add(226, 80,28,36,(char *)"}", 7); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
370 | Buttons_Add(258, 80,28,36,(char *)"[", 8); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
371 | Buttons_Add(290, 80,28,36,(char *)"]", 9); |
0 | 372 | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
373 | Buttons_Add( 2,120,28,36,(char *)" ",10); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
374 | Buttons_Add( 34,120,28,36,(char *)" ",11); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
375 | Buttons_Add( 66,120,28,36,(char *)" ",12); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
376 | Buttons_Add( 98,120,28,36,(char *)" ",13); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
377 | Buttons_Add(130,120,28,36,(char *)"%",14); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
378 | Buttons_Add(162,120,28,36,(char *)"~",15); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
379 | Buttons_Add(194,120,28,36,(char *)"`",16); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
380 | Buttons_Add(226,120,28,36,(char *)" ",17); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
381 | Buttons_Add(258,120,28,36,(char *)" ",18); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
382 | Buttons_Add(290,120,28,36,(char *)" ",19); |
0 | 383 | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
384 | Buttons_Add( 50,160,28,36,(char *)"_",20); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
385 | Buttons_Add( 82,160,28,36,(char *)"\\",21); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
386 | Buttons_Add(114,160,28,36,(char *)"|",22); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
387 | Buttons_Add(146,160,28,36,(char *)" ",23); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
388 | Buttons_Add(178,160,28,36,(char *)" ",24); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
389 | Buttons_Add(210,160,28,36,(char *)" ",25); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
390 | Buttons_Add(242,160,28,36,(char *)" ",26); |
0 | 391 | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
392 | Buttons_Add( 2,160,42,36,(char *)"2/2",27); |
0 | 393 | Buttons[27].dark = true; |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
394 | Buttons_Add(276,160,42,36,(char *)"del",28); |
0 | 395 | Buttons[28].dark = true; |
396 | Buttons[28].small = true; | |
397 | ||
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
398 | Buttons_Add( 2,200,60,36,(char *)"ABC",29); |
0 | 399 | Buttons[29].dark = true; |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
400 | Buttons_Add( 72,200,28,36,(char *)"/",30); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
401 | Buttons_Add(108,204,100,36,(char *)" ",31); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
402 | Buttons_Add(220,200,28,36,(char *)".",32); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
403 | Buttons_Add(258,200,60,36,(char *)"Ok",33); |
0 | 404 | Buttons[33].dark = true; |
405 | ||
406 | Buttons_Show(); | |
407 | } | |
408 | ||
409 | ||
410 | static const uint8_t digits_tab[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '+', '-', '.' }; | |
411 | ||
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
412 | /** |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
413 | * @brief A small nummeric keyboard |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
414 | */ |
0 | 415 | void B_Digits(void) |
416 | { | |
417 | Buttons_Clear(); | |
418 | ||
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
419 | Buttons_Add( 61,200,147,36,(char *)"0", 9); |
0 | 420 | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
421 | Buttons_Add( 61,160,47,36,(char *)"1", 0); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
422 | Buttons_Add(111,160,47,36,(char *)"2", 1); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
423 | Buttons_Add(161,160,47,36,(char *)"3", 2); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
424 | Buttons_Add(211,160,47,36,(char *)"+",10); |
0 | 425 | Buttons[10].dark = true; |
426 | ||
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
427 | Buttons_Add( 61,120,47,36,(char *)"4", 3); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
428 | Buttons_Add(111,120,47,36,(char *)"5", 4); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
429 | Buttons_Add(161,120,47,36,(char *)"6", 5); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
430 | Buttons_Add(211,120,47,36,(char *)"-",11); |
0 | 431 | Buttons[11].dark = true; |
432 | ||
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
433 | Buttons_Add( 61, 80,47,36,(char *)"7", 6); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
434 | Buttons_Add(111, 80,47,36,(char *)"8", 7); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
435 | Buttons_Add(161, 80,47,36,(char *)"9", 8); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
436 | Buttons_Add(211, 80,47,36,(char *)".",12); |
0 | 437 | Buttons[12].dark = true; |
438 | ||
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
439 | Buttons_Add(211,200,47,36,(char *)"del",13); |
0 | 440 | Buttons[13].dark = true; |
441 | Buttons[13].small = true; | |
442 | ||
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
443 | Buttons_Add(271,200,47,36,(char *)"Ok",14); |
0 | 444 | Buttons[14].dark = true; |
445 | ||
446 | Buttons_Show(); | |
447 | } | |
448 | ||
449 | ||
450 | ||
451 | int KeyBoardAll(void) | |
452 | { | |
453 | int key; | |
454 | ||
455 | key = Buttons_Scan(); | |
456 | if (key == -1) | |
457 | return -1; | |
458 | ||
459 | switch (level) { | |
460 | case 1: if (key >= 0 && key <= 25) { | |
461 | key = alphalow_tab[key]; | |
462 | } else if (key == 26) { | |
463 | level = 2; | |
464 | B_AlphaCaps(level); | |
465 | } else if (key == 27) { | |
466 | key = 127; | |
467 | } else if (key == 28) { | |
468 | level = 4; | |
469 | B_Nums1(); | |
470 | } else if (key == 29) { | |
471 | key = '/'; | |
472 | } else if (key == 30) { | |
473 | key = ' '; | |
474 | } else if (key == 31) { | |
475 | key = '.'; | |
476 | } else if (key == 32) { | |
477 | key = 0; | |
478 | } | |
479 | break; | |
480 | case 2: | |
481 | case 3: if (key >= 0 && key <= 25) { | |
482 | key = alphacaps_tab[key]; | |
483 | if (level == 2) { | |
484 | level = 1; | |
485 | B_AlphaLow(); | |
486 | } | |
487 | } else if (key == 26 && level == 3) { | |
488 | level = 1; | |
489 | B_AlphaLow(); | |
490 | } else if (key == 26 && level == 2) { | |
491 | level = 3; | |
492 | B_AlphaCaps(level); | |
493 | } else if (key == 27) { | |
494 | key = 127; | |
495 | } else if (key == 28) { | |
496 | level = 4; | |
497 | B_Nums1(); | |
498 | } else if (key == 29) { | |
499 | key = '/'; | |
500 | } else if (key == 30) { | |
501 | key = ' '; | |
502 | } else if (key == 31) { | |
503 | key = '.'; | |
504 | } else if (key == 32) { | |
505 | key = 0; | |
506 | } | |
507 | break; | |
508 | case 4: if (key >= 0 && key <= 26) { | |
509 | key = nums1_tab[key]; | |
510 | } else if (key == 27) { | |
511 | level = 5; | |
512 | B_Nums2(); | |
513 | } else if (key == 28) { | |
514 | key = 127; | |
515 | } else if (key == 29) { | |
516 | level = 1; | |
517 | B_AlphaLow(); | |
518 | } else if (key == 30) { | |
519 | key = '/'; | |
520 | } else if (key == 31) { | |
521 | key = ' '; | |
522 | } else if (key == 32) { | |
523 | key = '.'; | |
524 | } else if (key == 33) { | |
525 | key = 0; | |
526 | } | |
527 | break; | |
528 | case 5: if (key >= 0 && key <= 26) { | |
529 | key = nums2_tab[key]; | |
530 | } else if (key == 27) { | |
531 | level = 4; | |
532 | B_Nums1(); | |
533 | } else if (key == 28) { | |
534 | key = 127; | |
535 | } else if (key == 29) { | |
536 | level = 1; | |
537 | B_AlphaLow(); | |
538 | } else if (key == 30) { | |
539 | key = '/'; | |
540 | } else if (key == 31) { | |
541 | key = ' '; | |
542 | } else if (key == 32) { | |
543 | key = '.'; | |
544 | } else if (key == 33) { | |
545 | key = 0; | |
546 | } | |
547 | break; | |
548 | } | |
549 | ||
550 | return key; | |
551 | } | |
552 | ||
553 | ||
554 | int KeyBoardDigits(void) | |
555 | { | |
556 | int key; | |
557 | ||
558 | key = Buttons_Scan(); | |
559 | if (key == -1) | |
560 | return -1; | |
561 | ||
562 | if (key >= 0 && key <= 12) { | |
563 | key = digits_tab[key]; | |
564 | } else if (key == 13) { | |
565 | key = 127; | |
566 | } else if (key == 14) { | |
567 | key = 0; | |
568 | } | |
569 | ||
570 | return key; | |
571 | } | |
572 | ||
573 | ||
574 | ||
575 | /**************************************************************************/ | |
576 | /* | |
577 | * Data show and edit functions. | |
578 | */ | |
579 | ||
580 | void ShowText(uint16_t x, uint16_t y, char *label, char *txt) | |
581 | { | |
582 | _fg = TFT_LIGHTGREY; | |
583 | TFT_print(label, x, y); | |
584 | _fg = TFT_YELLOW; | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
585 | TFT_print((char *)" ", LASTX, LASTY); |
0 | 586 | TFT_print(txt, LASTX, LASTY); |
587 | } | |
588 | ||
589 | ||
590 | ||
591 | void ShowInteger(uint16_t x, uint16_t y, char *label, char *suffix, int val) | |
592 | { | |
593 | char tmp[32]; | |
594 | ||
595 | _fg = TFT_LIGHTGREY; | |
596 | TFT_print(label, x, y); | |
597 | _fg = TFT_YELLOW; | |
598 | sprintf(tmp, " %d", val); | |
599 | TFT_print(tmp, LASTX, LASTY); | |
600 | if (suffix) { | |
601 | _fg = TFT_LIGHTGREY; | |
602 | TFT_print(suffix, LASTX, LASTY); | |
603 | } | |
604 | } | |
605 | ||
606 | ||
607 | ||
608 | void ShowBool(uint16_t x, uint16_t y, char *label, bool val) | |
609 | { | |
610 | _fg = TFT_LIGHTGREY; | |
611 | TFT_print(label, x, y); | |
612 | _fg = TFT_YELLOW; | |
613 | if (val) | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
614 | TFT_print((char *)" J", LASTX, LASTY); |
0 | 615 | else |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
616 | TFT_print((char *)" N", LASTX, LASTY); |
0 | 617 | } |
618 | ||
619 | ||
620 | ||
621 | void ShowSSR2(uint16_t x, uint16_t y, int val) | |
622 | { | |
623 | _fg = TFT_LIGHTGREY; | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
624 | TFT_print((char *)"SSR2 ", x, y); |
19 | 625 | _fg = TFT_YELLOW; |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
626 | TFT_clearStringRect(TFT_X, TFT_Y, (char *)"HLT en MLT"); |
19 | 627 | TFT_print((char *)SSR2Types[val], LASTX, LASTY); |
0 | 628 | } |
629 | ||
630 | ||
631 | ||
632 | void ShowFloat(uint16_t x, uint16_t y, char *label, char *suffix, float val, int decimals) | |
633 | { | |
634 | char tmp[32]; | |
635 | ||
636 | _fg = TFT_LIGHTGREY; | |
637 | TFT_print(label, x, y); | |
638 | _fg = TFT_YELLOW; | |
639 | sprintf(tmp, " %.*f", decimals, val); | |
640 | TFT_print(tmp, LASTX, LASTY); | |
641 | if (suffix) { | |
642 | _fg = TFT_LIGHTGREY; | |
643 | TFT_print(suffix, LASTX, LASTY); | |
644 | } | |
645 | } | |
646 | ||
647 | ||
648 | ||
649 | void ShowDouble(uint16_t x, uint16_t y, char *label, char *suffix, double val, int decimals) | |
650 | { | |
651 | char tmp[32]; | |
652 | ||
653 | _fg = TFT_LIGHTGREY; | |
654 | TFT_print(label, x, y); | |
655 | _fg = TFT_YELLOW; | |
656 | sprintf(tmp, " %.*f", decimals, val); | |
657 | TFT_print(tmp, LASTX, LASTY); | |
658 | if (suffix) { | |
659 | _fg = TFT_LIGHTGREY; | |
660 | TFT_print(suffix, LASTX, LASTY); | |
661 | } | |
662 | } | |
663 | ||
664 | ||
665 | ||
666 | void Editer(char *label, char *txt, char *errmsg, int len, int type) | |
667 | { | |
668 | int key; | |
669 | ||
670 | _bg = TFT_BLACK; | |
671 | TFT_fillScreen(_bg); | |
672 | TFT_resetclipwin(); | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
673 | TopMessage((char *)"Wijzigen"); |
0 | 674 | _fg = TFT_LIGHTGREY; |
675 | TFT_setFont(DEFAULT_FONT, NULL); | |
676 | TFT_print(label, 2, 28); | |
677 | if (strlen(errmsg)) { | |
678 | _fg = TFT_RED; | |
679 | TFT_print(errmsg, 2, 60); | |
680 | } | |
681 | TFT_fillRect(2, 40, 10 * len, 14, TFT_BLUE); | |
682 | _fg = TFT_YELLOW; | |
683 | _bg = TFT_BLUE; | |
684 | TFT_print(txt, 2, 41); | |
685 | TFT_fillRect(TFT_X, 50, 10, 4, TFT_GREEN); | |
686 | ||
687 | switch(type) { | |
688 | case EDIT_TYPE_INT: | |
689 | B_Digits(); | |
690 | break; | |
691 | ||
692 | default: level = 1; | |
693 | B_AlphaLow(); | |
694 | break; | |
695 | } | |
696 | ||
697 | while (1) { | |
698 | switch (type) { | |
699 | case EDIT_TYPE_INT: | |
700 | key = KeyBoardDigits(); | |
701 | break; | |
702 | ||
703 | default: key = KeyBoardAll(); | |
704 | break; | |
705 | } | |
706 | ||
707 | if (key != -1) { | |
708 | ||
709 | if (key >= 32 && key <= 126 && strlen(txt) < len) { | |
710 | // Append key | |
711 | txt[strlen(txt) + 1] = '\0'; | |
712 | txt[strlen(txt)] = key; | |
713 | } else if (key == 127 && strlen(txt)) { | |
714 | // Delete key | |
715 | txt[strlen(txt) - 1] = '\0'; | |
716 | } | |
717 | ||
718 | _fg = TFT_YELLOW; | |
719 | _bg = TFT_BLACK; | |
720 | TFT_setFont(DEFAULT_FONT, NULL); | |
721 | TFT_fillRect(2, 40, 10 * len, 14, TFT_BLUE); | |
722 | TFT_print(txt, 2, 41); | |
723 | TFT_fillRect(TFT_X, 50, 10, 4, TFT_GREEN); | |
724 | } | |
725 | ||
726 | if (key == 0) | |
727 | break; | |
728 | ||
729 | vTaskDelay(20 / portTICK_PERIOD_MS); | |
730 | } | |
731 | } | |
732 | ||
733 | ||
734 | ||
735 | void EditText(char *label, char *txt, int len) | |
736 | { | |
737 | char errmsg[40]; | |
738 | ||
739 | errmsg[0] = '\0'; | |
740 | while (1) { | |
741 | Editer(label, txt, errmsg, len, EDIT_TYPE_TEXT); | |
742 | if (strlen(txt)) | |
743 | break; | |
744 | sprintf(errmsg, "Tekst veld mag niet leeg zijn"); | |
745 | } | |
746 | } | |
747 | ||
748 | ||
749 | ||
750 | void EditTextMin(char *label, char *txt, int len, int min) | |
751 | { | |
752 | char errmsg[40]; | |
753 | ||
754 | errmsg[0] = '\0'; | |
755 | while (1) { | |
756 | Editer(label, txt, errmsg, len, EDIT_TYPE_TEXT); | |
757 | if (strlen(txt) >= min) | |
758 | break; | |
759 | sprintf(errmsg, "Tekst veld moet tussen %d en %d lang zijn", min, len); | |
760 | } | |
761 | } | |
762 | ||
763 | ||
764 | ||
765 | void EditInt(char *label, int *val, int min, int max) | |
766 | { | |
767 | char *valstr, errmsg[40]; | |
768 | int newval; | |
769 | ||
770 | errmsg[0] = '\0'; | |
771 | valstr = malloc(20); | |
772 | sprintf(valstr, "%d", *val); | |
773 | ||
774 | while (1) { | |
775 | Editer(label, valstr, errmsg, 8, EDIT_TYPE_INT); | |
776 | newval = atoi(valstr); | |
777 | if (newval < min || newval > max) { | |
778 | sprintf(errmsg, "De waarde moet tussen %d en %d zijn.", min, max); | |
779 | } else { | |
780 | break; | |
781 | } | |
782 | } | |
783 | ||
784 | *val = newval; | |
785 | free(valstr); | |
786 | } | |
787 | ||
788 | ||
789 | ||
790 | void EditUint8(char *label, uint8_t *val, uint8_t min, uint8_t max) | |
791 | { | |
792 | char *valstr, errmsg[40]; | |
793 | uint8_t newval; | |
794 | ||
795 | errmsg[0] = '\0'; | |
796 | valstr = malloc(20); | |
797 | sprintf(valstr, "%d", *val); | |
798 | ||
799 | while (1) { | |
800 | Editer(label, valstr, errmsg, 5, EDIT_TYPE_INT); | |
801 | newval = atoi(valstr); | |
802 | if (newval < min || newval > max) { | |
803 | sprintf(errmsg, "De waarde moet tussen %d en %d zijn.", min, max); | |
804 | } else { | |
805 | break; | |
806 | } | |
807 | } | |
808 | ||
809 | *val = newval; | |
810 | free(valstr); | |
811 | } | |
812 | ||
813 | ||
814 | ||
815 | void EditUint16(char *label, uint16_t *val, uint16_t min, uint16_t max) | |
816 | { | |
817 | char *valstr, errmsg[40]; | |
818 | uint16_t newval; | |
819 | ||
820 | errmsg[0] = '\0'; | |
821 | valstr = malloc(20); | |
822 | sprintf(valstr, "%d", *val); | |
823 | ||
824 | while (1) { | |
825 | Editer(label, valstr, errmsg, 5, EDIT_TYPE_INT); | |
826 | newval = atoi(valstr); | |
827 | if (newval < min || newval > max) { | |
828 | sprintf(errmsg, "De waarde moet tussen %d en %d zijn.", min, max); | |
829 | } else { | |
830 | break; | |
831 | } | |
832 | } | |
833 | ||
834 | *val = newval; | |
835 | free(valstr); | |
836 | } | |
837 | ||
838 | ||
839 | ||
840 | void EditFloat(char *label, float *val, float min, float max, int decimals) | |
841 | { | |
842 | char *valstr, errmsg[40]; | |
843 | float newval; | |
844 | ||
845 | errmsg[0] = '\0'; | |
846 | valstr = malloc(30); | |
847 | sprintf(valstr, " %.*f", decimals, *val); | |
848 | ||
849 | while (1) { | |
850 | Editer(label, valstr, errmsg, 25, EDIT_TYPE_INT); | |
851 | newval = atof(valstr); | |
852 | if (newval < min || newval > max) { | |
853 | sprintf(errmsg, "De waarde moet tussen %.2f en %.2f zijn.", min, max); | |
854 | } else { | |
855 | break; | |
856 | } | |
857 | } | |
858 | ||
859 | *val = newval; | |
860 | free(valstr); | |
861 | } | |
862 | ||
863 | ||
864 | ||
865 | void EditDouble(char *label, double *val, double min, double max, int decimals) | |
866 | { | |
867 | char *valstr, errmsg[40]; | |
868 | double newval; | |
869 | ||
870 | errmsg[0] = '\0'; | |
871 | valstr = malloc(30); | |
872 | sprintf(valstr, " %.*f", decimals, *val); | |
873 | ||
874 | while (1) { | |
875 | Editer(label, valstr, errmsg, 25, EDIT_TYPE_INT); | |
876 | newval = atof(valstr); | |
877 | if (newval < min || newval > max) { | |
878 | sprintf(errmsg, "De waarde moet tussen %.2f en %.2f zijn.", min, max); | |
879 | } else { | |
880 | break; | |
881 | } | |
882 | } | |
883 | ||
884 | *val = newval; | |
885 | free(valstr); | |
886 | } | |
887 | ||
888 | ||
889 | ||
890 | void EditBool(char *label, bool *val) | |
891 | { | |
892 | bool loop = true, value = *val; | |
893 | int curpos; | |
894 | ||
895 | _bg = TFT_BLACK; | |
896 | TFT_fillScreen(_bg); | |
897 | TFT_resetclipwin(); | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
898 | TopMessage((char *)"Wijzigen"); |
0 | 899 | _fg = TFT_LIGHTGREY; |
900 | TFT_setFont(DEFAULT_FONT, NULL); | |
901 | TFT_print(label, 2, 28); | |
902 | curpos = TFT_X; | |
903 | _fg = TFT_YELLOW; | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
904 | (value) ? TFT_print((char *)" J ", curpos, 28) : TFT_print((char *)" N ", curpos, 28); |
0 | 905 | |
906 | Buttons_Clear(); | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
907 | Buttons_Add( 40, 100, 80, 40, (char *)"J/N", 0); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
908 | Buttons_Add(200, 100, 80, 40, (char *)"Ok", 1); |
0 | 909 | Buttons_Show(); |
910 | ||
911 | while (loop) { | |
912 | switch (Buttons_Scan()) { | |
913 | case 0: TFT_setFont(DEFAULT_FONT, NULL); | |
914 | _fg = TFT_YELLOW; | |
915 | if (value) { | |
916 | value = false; | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
917 | TFT_print((char *)" N ", curpos, 28); |
0 | 918 | } else { |
919 | value = true; | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
920 | TFT_print((char *)" J ", curpos, 28); |
0 | 921 | } |
922 | break; | |
923 | ||
924 | case 1: loop = false; | |
925 | break; | |
926 | ||
927 | default: break; | |
928 | } | |
929 | vTaskDelay(20 / portTICK_PERIOD_MS); | |
930 | } | |
931 | *val = value; | |
932 | } | |
933 | ||
934 | ||
935 | ||
936 | void EditSSR2(int *val) | |
937 | { | |
938 | bool loop = true; | |
939 | int value = *val; | |
940 | int key; | |
941 | ||
942 | _bg = TFT_BLACK; | |
943 | TFT_fillScreen(_bg); | |
944 | TFT_resetclipwin(); | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
945 | TopMessage((char *)"Wijzigen"); |
0 | 946 | |
947 | Buttons_Clear(); | |
19 | 948 | Buttons_Add( 20, 60,120, 40, (char *)SSR2Types[0], 0); |
949 | Buttons_Add(180, 60,120, 40, (char *)SSR2Types[1], 1); | |
950 | Buttons_Add( 20, 130,120, 40, (char *)SSR2Types[2], 2); | |
951 | Buttons_Add(180, 130,120, 40, (char *)SSR2Types[3], 3); | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
952 | Buttons_Add(120, 200, 80, 40, (char *)"Ok", 4); |
19 | 953 | Buttons[4].dark = true; |
954 | Buttons[value].lock = true; | |
0 | 955 | Buttons_Show(); |
956 | ||
957 | while (loop) { | |
958 | key = Buttons_Scan(); | |
959 | ||
960 | if (key >= 0 && key <= 3) { | |
19 | 961 | Buttons[value].lock = false; |
0 | 962 | value = key; |
19 | 963 | Buttons[value].lock = true; |
964 | Buttons_Show(); | |
0 | 965 | } else if (key == 4) { |
966 | loop = false; | |
967 | } | |
968 | vTaskDelay(20 / portTICK_PERIOD_MS); | |
969 | } | |
970 | *val = value; | |
971 | } | |
972 | ||
973 | ||
974 | ||
19 | 975 | void EditMashType(uint8_t *val) |
976 | { | |
977 | bool loop = true; | |
978 | int value = (int)*val; | |
979 | int key; | |
980 | ||
981 | _bg = TFT_BLACK; | |
982 | TFT_fillScreen(_bg); | |
983 | TFT_resetclipwin(); | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
984 | TopMessage((char *)"Wijzigen"); |
19 | 985 | |
986 | Buttons_Clear(); | |
987 | Buttons_Add( 80, 40,160, 40, (char *)mashTypes[0], 0); | |
988 | Buttons_Add( 80, 90,160, 40, (char *)mashTypes[1], 1); | |
989 | Buttons_Add( 80, 140,160, 40, (char *)mashTypes[2], 2); | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
990 | Buttons_Add(120, 200, 80, 40, (char *)"Ok", 3); |
19 | 991 | Buttons[3].dark = true; |
992 | Buttons[value].lock = true; | |
993 | Buttons_Show(); | |
994 | ||
995 | while (loop) { | |
996 | key = Buttons_Scan(); | |
997 | ||
998 | if (key >= 0 && key <= 2) { | |
999 | Buttons[value].lock = false; | |
1000 | value = key; | |
1001 | Buttons[value].lock = true; | |
1002 | Buttons_Show(); | |
1003 | } else if (key == 3) { | |
1004 | loop = false; | |
1005 | } | |
1006 | vTaskDelay(20 / portTICK_PERIOD_MS); | |
1007 | } | |
1008 | Buttons[value].lock = false; | |
1009 | *val = (uint8_t)value; | |
1010 | } | |
1011 | ||
1012 | ||
1013 | ||
0 | 1014 | int Confirm(char *top, char *ack, char *nak) |
1015 | { | |
1016 | int rc = false; | |
1017 | bool loop = true; | |
1018 | ||
1019 | TFT_fillScreen(TFT_BLACK); | |
1020 | TopMessage(top); | |
1021 | Buttons_Clear(); | |
1022 | Buttons_Add( 40, 100, 80, 40, ack, 0); | |
1023 | Buttons_Add(200, 100, 80, 40, nak, 1); | |
1024 | Buttons_Show(); | |
1025 | SoundPlay(SOUND_Prompt); | |
1026 | ||
1027 | while (loop) { | |
1028 | switch (Buttons_Scan()) { | |
1029 | case 0: loop = false; | |
1030 | rc = true; | |
1031 | break; | |
1032 | ||
1033 | case 1: loop = false; | |
1034 | rc = false; | |
1035 | break; | |
1036 | ||
1037 | default: | |
1038 | break; | |
1039 | } | |
1040 | vTaskDelay(50 / portTICK_PERIOD_MS); | |
1041 | } | |
1042 | ||
1043 | Buttons_Clear(); | |
1044 | return rc; | |
1045 | } | |
1046 | ||
1047 |