Sat, 01 Oct 2022 14:23:15 +0200
Updated kicad drawings to kicad 6.0.8
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 | ||
87
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
580 | void ShowLabel(uint16_t x, uint16_t y, char *label) |
0 | 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); |
87
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
586 | } |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
587 | |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
588 | |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
589 | |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
590 | void ShowText(uint16_t x, uint16_t y, char *label, char *txt) |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
591 | { |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
592 | ShowLabel(x, y, label); |
0 | 593 | TFT_print(txt, LASTX, LASTY); |
594 | } | |
595 | ||
596 | ||
597 | ||
598 | void ShowInteger(uint16_t x, uint16_t y, char *label, char *suffix, int val) | |
599 | { | |
600 | char tmp[32]; | |
601 | ||
87
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
602 | ShowLabel(x, y, label); |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
603 | sprintf(tmp, "%d", val); |
0 | 604 | TFT_print(tmp, LASTX, LASTY); |
605 | if (suffix) { | |
606 | _fg = TFT_LIGHTGREY; | |
607 | TFT_print(suffix, LASTX, LASTY); | |
608 | } | |
609 | } | |
610 | ||
611 | ||
612 | ||
101
1bc6e9263ada
Fixed HendiControl interface connecter to match the board input. Tested the new circuit.
Michiel Broek <mbroek@mbse.eu>
parents:
87
diff
changeset
|
613 | void Show2Integer(uint16_t x, uint16_t y, char *label, char *suffix, int val, int val2) |
1bc6e9263ada
Fixed HendiControl interface connecter to match the board input. Tested the new circuit.
Michiel Broek <mbroek@mbse.eu>
parents:
87
diff
changeset
|
614 | { |
1bc6e9263ada
Fixed HendiControl interface connecter to match the board input. Tested the new circuit.
Michiel Broek <mbroek@mbse.eu>
parents:
87
diff
changeset
|
615 | char tmp[32]; |
1bc6e9263ada
Fixed HendiControl interface connecter to match the board input. Tested the new circuit.
Michiel Broek <mbroek@mbse.eu>
parents:
87
diff
changeset
|
616 | |
1bc6e9263ada
Fixed HendiControl interface connecter to match the board input. Tested the new circuit.
Michiel Broek <mbroek@mbse.eu>
parents:
87
diff
changeset
|
617 | ShowLabel(x, y, label); |
1bc6e9263ada
Fixed HendiControl interface connecter to match the board input. Tested the new circuit.
Michiel Broek <mbroek@mbse.eu>
parents:
87
diff
changeset
|
618 | sprintf(tmp, "%d/%d", val, val2); |
1bc6e9263ada
Fixed HendiControl interface connecter to match the board input. Tested the new circuit.
Michiel Broek <mbroek@mbse.eu>
parents:
87
diff
changeset
|
619 | TFT_print(tmp, LASTX, LASTY); |
1bc6e9263ada
Fixed HendiControl interface connecter to match the board input. Tested the new circuit.
Michiel Broek <mbroek@mbse.eu>
parents:
87
diff
changeset
|
620 | if (suffix) { |
1bc6e9263ada
Fixed HendiControl interface connecter to match the board input. Tested the new circuit.
Michiel Broek <mbroek@mbse.eu>
parents:
87
diff
changeset
|
621 | _fg = TFT_LIGHTGREY; |
1bc6e9263ada
Fixed HendiControl interface connecter to match the board input. Tested the new circuit.
Michiel Broek <mbroek@mbse.eu>
parents:
87
diff
changeset
|
622 | TFT_print(suffix, LASTX, LASTY); |
1bc6e9263ada
Fixed HendiControl interface connecter to match the board input. Tested the new circuit.
Michiel Broek <mbroek@mbse.eu>
parents:
87
diff
changeset
|
623 | } |
1bc6e9263ada
Fixed HendiControl interface connecter to match the board input. Tested the new circuit.
Michiel Broek <mbroek@mbse.eu>
parents:
87
diff
changeset
|
624 | } |
1bc6e9263ada
Fixed HendiControl interface connecter to match the board input. Tested the new circuit.
Michiel Broek <mbroek@mbse.eu>
parents:
87
diff
changeset
|
625 | |
1bc6e9263ada
Fixed HendiControl interface connecter to match the board input. Tested the new circuit.
Michiel Broek <mbroek@mbse.eu>
parents:
87
diff
changeset
|
626 | |
1bc6e9263ada
Fixed HendiControl interface connecter to match the board input. Tested the new circuit.
Michiel Broek <mbroek@mbse.eu>
parents:
87
diff
changeset
|
627 | |
0 | 628 | void ShowBool(uint16_t x, uint16_t y, char *label, bool val) |
629 | { | |
87
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
630 | ShowLabel(x, y, label); |
0 | 631 | if (val) |
87
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
632 | TFT_print((char *)"J", LASTX, LASTY); |
0 | 633 | else |
87
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
634 | TFT_print((char *)"N", LASTX, LASTY); |
0 | 635 | } |
636 | ||
637 | ||
638 | ||
639 | void ShowSSR2(uint16_t x, uint16_t y, int val) | |
640 | { | |
87
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
641 | ShowLabel(x, y, (char *)"SSR2"); |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
41
diff
changeset
|
642 | TFT_clearStringRect(TFT_X, TFT_Y, (char *)"HLT en MLT"); |
19 | 643 | TFT_print((char *)SSR2Types[val], LASTX, LASTY); |
0 | 644 | } |
645 | ||
646 | ||
647 | ||
648 | void ShowFloat(uint16_t x, uint16_t y, char *label, char *suffix, float val, int decimals) | |
649 | { | |
650 | char tmp[32]; | |
651 | ||
87
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
652 | ShowLabel(x, y, label); |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
653 | sprintf(tmp, "%.*f", decimals, val); |
0 | 654 | TFT_print(tmp, LASTX, LASTY); |
655 | if (suffix) { | |
656 | _fg = TFT_LIGHTGREY; | |
657 | TFT_print(suffix, LASTX, LASTY); | |
658 | } | |
659 | } | |
660 | ||
661 | ||
662 | ||
663 | void ShowDouble(uint16_t x, uint16_t y, char *label, char *suffix, double val, int decimals) | |
664 | { | |
665 | char tmp[32]; | |
666 | ||
87
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
667 | ShowLabel(x, y, label); |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
668 | sprintf(tmp, "%.*f", decimals, val); |
0 | 669 | TFT_print(tmp, LASTX, LASTY); |
670 | if (suffix) { | |
671 | _fg = TFT_LIGHTGREY; | |
672 | TFT_print(suffix, LASTX, LASTY); | |
673 | } | |
674 | } | |
675 | ||
676 | ||
677 | ||
87
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
678 | void EditerTop(char *label) |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
679 | { |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
680 | _bg = TFT_BLACK; |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
681 | TFT_fillScreen(_bg); |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
682 | TFT_resetclipwin(); |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
683 | TopMessage(label); |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
684 | } |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
685 | |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
686 | |
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
687 | |
0 | 688 | void Editer(char *label, char *txt, char *errmsg, int len, int type) |
689 | { | |
690 | int key; | |
691 | ||
87
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
692 | EditerTop((char *)"Wijzigen"); |
0 | 693 | _fg = TFT_LIGHTGREY; |
694 | TFT_setFont(DEFAULT_FONT, NULL); | |
695 | TFT_print(label, 2, 28); | |
696 | if (strlen(errmsg)) { | |
697 | _fg = TFT_RED; | |
698 | TFT_print(errmsg, 2, 60); | |
699 | } | |
700 | TFT_fillRect(2, 40, 10 * len, 14, TFT_BLUE); | |
701 | _fg = TFT_YELLOW; | |
702 | _bg = TFT_BLUE; | |
703 | TFT_print(txt, 2, 41); | |
704 | TFT_fillRect(TFT_X, 50, 10, 4, TFT_GREEN); | |
705 | ||
706 | switch(type) { | |
707 | case EDIT_TYPE_INT: | |
708 | B_Digits(); | |
709 | break; | |
710 | ||
711 | default: level = 1; | |
712 | B_AlphaLow(); | |
713 | break; | |
714 | } | |
715 | ||
716 | while (1) { | |
717 | switch (type) { | |
718 | case EDIT_TYPE_INT: | |
719 | key = KeyBoardDigits(); | |
720 | break; | |
721 | ||
722 | default: key = KeyBoardAll(); | |
723 | break; | |
724 | } | |
725 | ||
726 | if (key != -1) { | |
727 | ||
728 | if (key >= 32 && key <= 126 && strlen(txt) < len) { | |
729 | // Append key | |
730 | txt[strlen(txt) + 1] = '\0'; | |
731 | txt[strlen(txt)] = key; | |
732 | } else if (key == 127 && strlen(txt)) { | |
733 | // Delete key | |
734 | txt[strlen(txt) - 1] = '\0'; | |
735 | } | |
736 | ||
737 | _fg = TFT_YELLOW; | |
738 | _bg = TFT_BLACK; | |
739 | TFT_setFont(DEFAULT_FONT, NULL); | |
740 | TFT_fillRect(2, 40, 10 * len, 14, TFT_BLUE); | |
741 | TFT_print(txt, 2, 41); | |
742 | TFT_fillRect(TFT_X, 50, 10, 4, TFT_GREEN); | |
743 | } | |
744 | ||
745 | if (key == 0) | |
746 | break; | |
747 | ||
748 | vTaskDelay(20 / portTICK_PERIOD_MS); | |
749 | } | |
750 | } | |
751 | ||
752 | ||
753 | ||
754 | void EditText(char *label, char *txt, int len) | |
755 | { | |
756 | char errmsg[40]; | |
757 | ||
758 | errmsg[0] = '\0'; | |
759 | while (1) { | |
760 | Editer(label, txt, errmsg, len, EDIT_TYPE_TEXT); | |
761 | if (strlen(txt)) | |
762 | break; | |
763 | sprintf(errmsg, "Tekst veld mag niet leeg zijn"); | |
764 | } | |
765 | } | |
766 | ||
767 | ||
768 | ||
769 | void EditTextMin(char *label, char *txt, int len, int min) | |
770 | { | |
771 | char errmsg[40]; | |
772 | ||
773 | errmsg[0] = '\0'; | |
774 | while (1) { | |
775 | Editer(label, txt, errmsg, len, EDIT_TYPE_TEXT); | |
776 | if (strlen(txt) >= min) | |
777 | break; | |
778 | sprintf(errmsg, "Tekst veld moet tussen %d en %d lang zijn", min, len); | |
779 | } | |
780 | } | |
781 | ||
782 | ||
783 | ||
784 | void EditInt(char *label, int *val, int min, int max) | |
785 | { | |
786 | char *valstr, errmsg[40]; | |
787 | int newval; | |
788 | ||
789 | errmsg[0] = '\0'; | |
790 | valstr = malloc(20); | |
791 | sprintf(valstr, "%d", *val); | |
792 | ||
793 | while (1) { | |
794 | Editer(label, valstr, errmsg, 8, EDIT_TYPE_INT); | |
795 | newval = atoi(valstr); | |
796 | if (newval < min || newval > max) { | |
797 | sprintf(errmsg, "De waarde moet tussen %d en %d zijn.", min, max); | |
798 | } else { | |
799 | break; | |
800 | } | |
801 | } | |
802 | ||
803 | *val = newval; | |
804 | free(valstr); | |
805 | } | |
806 | ||
807 | ||
808 | ||
809 | void EditUint8(char *label, uint8_t *val, uint8_t min, uint8_t max) | |
810 | { | |
811 | char *valstr, errmsg[40]; | |
812 | uint8_t newval; | |
813 | ||
814 | errmsg[0] = '\0'; | |
815 | valstr = malloc(20); | |
816 | sprintf(valstr, "%d", *val); | |
817 | ||
818 | while (1) { | |
819 | Editer(label, valstr, errmsg, 5, EDIT_TYPE_INT); | |
820 | newval = atoi(valstr); | |
821 | if (newval < min || newval > max) { | |
822 | sprintf(errmsg, "De waarde moet tussen %d en %d zijn.", min, max); | |
823 | } else { | |
824 | break; | |
825 | } | |
826 | } | |
827 | ||
828 | *val = newval; | |
829 | free(valstr); | |
830 | } | |
831 | ||
832 | ||
833 | ||
834 | void EditUint16(char *label, uint16_t *val, uint16_t min, uint16_t max) | |
835 | { | |
56
756d1a63d129
Adjusted more strings for new compiler warnings. There should now be no buffer overflows in the app. Changed the date display on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
836 | char *valstr, errmsg[64]; |
0 | 837 | uint16_t newval; |
838 | ||
839 | errmsg[0] = '\0'; | |
840 | valstr = malloc(20); | |
841 | sprintf(valstr, "%d", *val); | |
842 | ||
843 | while (1) { | |
844 | Editer(label, valstr, errmsg, 5, EDIT_TYPE_INT); | |
845 | newval = atoi(valstr); | |
846 | if (newval < min || newval > max) { | |
847 | sprintf(errmsg, "De waarde moet tussen %d en %d zijn.", min, max); | |
848 | } else { | |
849 | break; | |
850 | } | |
851 | } | |
852 | ||
853 | *val = newval; | |
854 | free(valstr); | |
855 | } | |
856 | ||
857 | ||
858 | ||
859 | void EditFloat(char *label, float *val, float min, float max, int decimals) | |
860 | { | |
56
756d1a63d129
Adjusted more strings for new compiler warnings. There should now be no buffer overflows in the app. Changed the date display on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
861 | char *valstr, errmsg[672]; |
0 | 862 | float newval; |
863 | ||
864 | errmsg[0] = '\0'; | |
865 | valstr = malloc(30); | |
866 | sprintf(valstr, " %.*f", decimals, *val); | |
867 | ||
868 | while (1) { | |
869 | Editer(label, valstr, errmsg, 25, EDIT_TYPE_INT); | |
870 | newval = atof(valstr); | |
871 | if (newval < min || newval > max) { | |
77
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
872 | sprintf(errmsg, "De waarde moet tussen %.*f en %.*f zijn.", decimals, min, decimals, max); |
0 | 873 | } else { |
874 | break; | |
875 | } | |
876 | } | |
877 | ||
878 | *val = newval; | |
879 | free(valstr); | |
880 | } | |
881 | ||
882 | ||
883 | ||
884 | void EditDouble(char *label, double *val, double min, double max, int decimals) | |
885 | { | |
56
756d1a63d129
Adjusted more strings for new compiler warnings. There should now be no buffer overflows in the app. Changed the date display on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
886 | char *valstr, errmsg[672]; |
0 | 887 | double newval; |
888 | ||
889 | errmsg[0] = '\0'; | |
890 | valstr = malloc(30); | |
891 | sprintf(valstr, " %.*f", decimals, *val); | |
892 | ||
893 | while (1) { | |
894 | Editer(label, valstr, errmsg, 25, EDIT_TYPE_INT); | |
895 | newval = atof(valstr); | |
896 | if (newval < min || newval > max) { | |
77
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
897 | sprintf(errmsg, "De waarde moet tussen %.*f en %.*f zijn.", decimals, min, decimals, max); |
0 | 898 | } else { |
899 | break; | |
900 | } | |
901 | } | |
902 | ||
903 | *val = newval; | |
904 | free(valstr); | |
905 | } | |
906 | ||
907 | ||
908 | ||
909 | void EditBool(char *label, bool *val) | |
910 | { | |
911 | bool loop = true, value = *val; | |
912 | int curpos; | |
913 | ||
87
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
914 | EditerTop((char *)"Wijzigen"); |
0 | 915 | _fg = TFT_LIGHTGREY; |
916 | TFT_setFont(DEFAULT_FONT, NULL); | |
917 | TFT_print(label, 2, 28); | |
918 | curpos = TFT_X; | |
919 | _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
|
920 | (value) ? TFT_print((char *)" J ", curpos, 28) : TFT_print((char *)" N ", curpos, 28); |
0 | 921 | |
922 | 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
|
923 | 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
|
924 | Buttons_Add(200, 100, 80, 40, (char *)"Ok", 1); |
0 | 925 | Buttons_Show(); |
926 | ||
927 | while (loop) { | |
928 | switch (Buttons_Scan()) { | |
929 | case 0: TFT_setFont(DEFAULT_FONT, NULL); | |
930 | _fg = TFT_YELLOW; | |
931 | if (value) { | |
932 | 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
|
933 | TFT_print((char *)" N ", curpos, 28); |
0 | 934 | } else { |
935 | 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
|
936 | TFT_print((char *)" J ", curpos, 28); |
0 | 937 | } |
938 | break; | |
939 | ||
940 | case 1: loop = false; | |
941 | break; | |
942 | ||
943 | default: break; | |
944 | } | |
945 | vTaskDelay(20 / portTICK_PERIOD_MS); | |
946 | } | |
947 | *val = value; | |
948 | } | |
949 | ||
950 | ||
951 | ||
952 | void EditSSR2(int *val) | |
953 | { | |
954 | bool loop = true; | |
955 | int value = *val; | |
956 | int key; | |
957 | ||
87
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
958 | EditerTop((char *)"Wijzigen"); |
0 | 959 | |
960 | Buttons_Clear(); | |
19 | 961 | Buttons_Add( 20, 60,120, 40, (char *)SSR2Types[0], 0); |
962 | Buttons_Add(180, 60,120, 40, (char *)SSR2Types[1], 1); | |
963 | Buttons_Add( 20, 130,120, 40, (char *)SSR2Types[2], 2); | |
964 | 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
|
965 | Buttons_Add(120, 200, 80, 40, (char *)"Ok", 4); |
19 | 966 | Buttons[4].dark = true; |
967 | Buttons[value].lock = true; | |
0 | 968 | Buttons_Show(); |
969 | ||
970 | while (loop) { | |
971 | key = Buttons_Scan(); | |
972 | ||
973 | if (key >= 0 && key <= 3) { | |
19 | 974 | Buttons[value].lock = false; |
0 | 975 | value = key; |
19 | 976 | Buttons[value].lock = true; |
977 | Buttons_Show(); | |
0 | 978 | } else if (key == 4) { |
979 | loop = false; | |
980 | } | |
981 | vTaskDelay(20 / portTICK_PERIOD_MS); | |
982 | } | |
983 | *val = value; | |
984 | } | |
985 | ||
986 | ||
987 | ||
19 | 988 | void EditMashType(uint8_t *val) |
989 | { | |
990 | bool loop = true; | |
991 | int value = (int)*val; | |
992 | int key; | |
993 | ||
87
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
994 | EditerTop((char *)"Wijzigen"); |
19 | 995 | |
996 | Buttons_Clear(); | |
997 | Buttons_Add( 80, 40,160, 40, (char *)mashTypes[0], 0); | |
998 | Buttons_Add( 80, 90,160, 40, (char *)mashTypes[1], 1); | |
999 | 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
|
1000 | Buttons_Add(120, 200, 80, 40, (char *)"Ok", 3); |
19 | 1001 | Buttons[3].dark = true; |
1002 | Buttons[value].lock = true; | |
1003 | Buttons_Show(); | |
1004 | ||
1005 | while (loop) { | |
1006 | key = Buttons_Scan(); | |
1007 | ||
1008 | if (key >= 0 && key <= 2) { | |
1009 | Buttons[value].lock = false; | |
1010 | value = key; | |
1011 | Buttons[value].lock = true; | |
1012 | Buttons_Show(); | |
1013 | } else if (key == 3) { | |
1014 | loop = false; | |
1015 | } | |
1016 | vTaskDelay(20 / portTICK_PERIOD_MS); | |
1017 | } | |
1018 | Buttons[value].lock = false; | |
1019 | *val = (uint8_t)value; | |
1020 | } | |
1021 | ||
1022 | ||
1023 | ||
0 | 1024 | int Confirm(char *top, char *ack, char *nak) |
1025 | { | |
1026 | int rc = false; | |
1027 | bool loop = true; | |
1028 | ||
87
47253f294a9f
SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
1029 | EditerTop(top); |
0 | 1030 | Buttons_Clear(); |
1031 | Buttons_Add( 40, 100, 80, 40, ack, 0); | |
1032 | Buttons_Add(200, 100, 80, 40, nak, 1); | |
1033 | Buttons_Show(); | |
1034 | SoundPlay(SOUND_Prompt); | |
1035 | ||
1036 | while (loop) { | |
1037 | switch (Buttons_Scan()) { | |
1038 | case 0: loop = false; | |
1039 | rc = true; | |
1040 | break; | |
1041 | ||
1042 | case 1: loop = false; | |
1043 | rc = false; | |
1044 | break; | |
1045 | ||
1046 | default: | |
1047 | break; | |
1048 | } | |
1049 | vTaskDelay(50 / portTICK_PERIOD_MS); | |
1050 | } | |
1051 | ||
1052 | Buttons_Clear(); | |
1053 | return rc; | |
1054 | } | |
1055 | ||
1056 |