Mercurial > public > ostc4
annotate Discovery/Src/tMenu.c @ 652:f6212495f34f
Allow setpoint starting at 0.4 ppO2:
Some rebreathers (e.g. Sentinel) start with a ppO2 of 0.4 Bar => modified range check to allow this value (was 0.5 before)
author | Ideenmodellierer |
---|---|
date | Mon, 19 Apr 2021 20:34:53 +0200 |
parents | 5f0d3dce5ef4 |
children | 4df22790dc0c |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenu.c | |
5 /// \brief Major menu with extra page 0 for edit functionality since V0.0.2 | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 30-April-2014 | |
8 /// | |
9 /// \details | |
10 /// | |
11 /// $Id$ | |
12 /////////////////////////////////////////////////////////////////////////////// | |
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
14 /// | |
15 /// This program is free software: you can redistribute it and/or modify | |
16 /// it under the terms of the GNU General Public License as published by | |
17 /// the Free Software Foundation, either version 3 of the License, or | |
18 /// (at your option) any later version. | |
19 /// | |
20 /// This program is distributed in the hope that it will be useful, | |
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 /// GNU General Public License for more details. | |
24 /// | |
25 /// You should have received a copy of the GNU General Public License | |
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
27 ////////////////////////////////////////////////////////////////////////////// | |
28 | |
29 /* Includes ------------------------------------------------------------------*/ | |
30 #include "tMenu.h" | |
31 | |
32 #include "gfx_fonts.h" | |
33 #include "tHome.h" | |
34 #include "tMenuDeco.h" | |
35 #include "tMenuDecoParameter.h" | |
36 #include "tMenuEditDeco.h" | |
37 #include "tMenuEditDecoParameter.h" | |
38 #include "tMenuEditGasOC.h" | |
39 #include "tMenuEditHardware.h" | |
40 #include "tMenuEditPlanner.h" | |
41 #include "tMenuEditSetpoint.h" | |
42 #include "tMenuEditSystem.h" | |
43 #include "tMenuEditXtra.h" | |
507 | 44 #include "tMenuEditCustom.h" |
38 | 45 #include "tMenuGas.h" |
46 #include "tMenuHardware.h" | |
47 #include "tMenuPlanner.h" | |
48 #include "tMenuSetpoint.h" | |
49 #include "tMenuSystem.h" | |
50 #include "tMenuXtra.h" | |
507 | 51 #include "tMenuCustom.h" |
38 | 52 |
53 /* Private types -------------------------------------------------------------*/ | |
521
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
507
diff
changeset
|
54 #define MAXPAGES 11 |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
55 #define CURSOR_HIGH 25 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
56 #define TAB_HEADER_HIGH 25 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
57 #define TAB_BAR_HIGH 5 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
58 #define MENU_WDW_HIGH 390 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
59 #define KEY_LABEL_HIGH 25 /* Height of the label used for the the user keys */ |
38 | 60 |
61 typedef struct | |
62 { | |
63 uint32_t StartAddressForPage[MAXPAGES+1]; | |
64 uint8_t lineMemoryForNavigationForPage[MAXPAGES+1]; | |
65 uint8_t pageMemoryForNavigation; | |
66 uint8_t linesAvailableForPage[MAXPAGES+1]; | |
67 uint8_t pagesAvailable; | |
68 uint8_t pageCountNumber[MAXPAGES+1]; | |
69 uint8_t pageCountTotal; | |
70 uint8_t modeFlipPages; | |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
71 uint8_t shadowPage[MAXPAGES+1]; /* the page is switch in the context of another page */ |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
72 uint8_t activeShadow; /* Base page which is used for the shadow */ |
38 | 73 } SMenuMemory; |
74 | |
75 /* Exported variables --------------------------------------------------------*/ | |
76 | |
77 /* Announced Private variables -----------------------------------------------*/ | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
78 static GFX_DrawCfgScreen tMdesignSolo; |
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
79 static GFX_DrawCfgScreen tMdesignCursor; |
38 | 80 |
81 /* Private variables ---------------------------------------------------------*/ | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
82 static GFX_DrawCfgWindow tMwindow; |
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
83 static GFX_DrawCfgScreen tMscreen; |
38 | 84 |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
85 static SMenuMemory menu; |
38 | 86 |
87 uint8_t actual_menu_content = MENU_UNDEFINED; | |
88 | |
89 /* Private function prototypes -----------------------------------------------*/ | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
90 static void draw_tMheader(uint8_t page); |
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
91 static void draw_tMcursorDesign(void); |
38 | 92 |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
93 static void draw_tMdesignSubUnselected(uint32_t *ppDestination); |
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
94 static void draw_tMdesignSubSelected(uint32_t *ppDestination); |
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
95 static void draw_tMdesignSubSelectedBorder(uint32_t *ppDestination); |
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
96 static void tMenu_write(uint8_t page, char *text, char *subtext); |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
97 static void nextLine(void); |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
98 static void clean_line_actual_page(void); |
38 | 99 void tM_build_pages(void); |
100 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
101 static void gotoMenuEdit(void); |
38 | 102 |
103 /* Exported functions --------------------------------------------------------*/ | |
104 | |
105 GFX_DrawCfgScreen * get_PointerMenuCursorScreen(void) | |
106 { | |
107 return &tMdesignCursor; | |
108 } | |
109 | |
110 | |
111 GFX_DrawCfgScreen * get_PointerMenuCursorDesignSoloScreen(void) | |
112 { | |
113 return &tMdesignSolo; | |
114 } | |
115 | |
116 | |
117 void nextline(char * text, uint8_t *textPointer) | |
118 { | |
119 text[(*textPointer)++] = '\n'; | |
120 text[(*textPointer)++] = '\r'; | |
121 text[*textPointer] = 0; | |
122 } | |
123 | |
124 | |
125 void tM_init(void) | |
126 { | |
127 uint8_t i; | |
128 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
129 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
130 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
131 |
38 | 132 tMdesignCursor.FBStartAdress = getFrame(3); |
133 tMdesignCursor.ImageHeight = 390; | |
134 tMdesignCursor.ImageWidth = 800; | |
135 tMdesignCursor.LayerIndex = 0; | |
136 | |
137 tMdesignSolo.FBStartAdress = getFrame(4); | |
138 tMdesignSolo.ImageHeight = 390; | |
139 tMdesignSolo.ImageWidth = 800; | |
140 tMdesignSolo.LayerIndex = 0; | |
141 | |
142 menu.pagesAvailable = 0; | |
143 menu.pageMemoryForNavigation = 0; | |
144 for(i=0;i<=MAXPAGES;i++) | |
145 { | |
146 menu.lineMemoryForNavigationForPage[i] = 0; | |
147 menu.StartAddressForPage[i] = 0; | |
148 menu.linesAvailableForPage[i] = 0; | |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
149 menu.shadowPage[i] = 0; |
38 | 150 } |
151 | |
152 tMscreen.FBStartAdress = 0; | |
153 tMscreen.ImageHeight = 480; | |
154 tMscreen.ImageWidth = 800; | |
155 tMscreen.LayerIndex = 1; | |
156 | |
157 draw_tMcursorDesign(); | |
158 | |
159 tMwindow.Image = &tMscreen; | |
160 tMwindow.WindowNumberOfTextLines = 6; | |
161 tMwindow.WindowLineSpacing = 65; | |
162 tMwindow.WindowTab = 400; | |
163 tMwindow.WindowX0 = 20; | |
164 tMwindow.WindowX1 = 779; | |
165 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
166 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
167 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
168 tMwindow.WindowY0 = 4 + KEY_LABEL_HIGH; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
169 tMwindow.WindowY1 = 390 + KEY_LABEL_HIGH; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
170 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
171 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
172 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
173 tMwindow.WindowY0 = 480 - MENU_WDW_HIGH - TAB_HEADER_HIGH;// - TAB_BAR_HIGH; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
174 tMwindow.WindowY1 = 480 - TAB_HEADER_HIGH - TAB_BAR_HIGH; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
175 } |
38 | 176 actual_menu_content = MENU_UNDEFINED; |
177 } | |
178 | |
179 void tM_refresh(char *text, uint8_t *textPointer, uint8_t line, const char content[6]) | |
180 { | |
181 for(uint8_t i=0; i<6; i++) | |
182 { | |
183 if(((line == 0) || (line == i)) && content[i]) | |
184 { | |
185 text[(*textPointer)++] = content[i]; | |
186 } | |
187 text[(*textPointer)++] = '\n'; | |
188 text[(*textPointer)++] = '\r'; | |
189 text[*textPointer] = 0; | |
190 } | |
191 } | |
192 | |
193 | |
194 void tM_rebuild_pages(void) | |
195 { | |
196 menu.pagesAvailable = 0; | |
197 // menu.pageMemoryForNavigation = 0; | |
198 for(int i=0;i<=MAXPAGES;i++) | |
199 { | |
200 menu.lineMemoryForNavigationForPage[i] = 0; | |
201 menu.linesAvailableForPage[i] = 0; | |
202 menu.StartAddressForPage[i] = 0; // only with GFX_forceReleaseFramesWithId(5); !!!!! | |
203 } | |
204 GFX_forceReleaseFramesWithId(5); | |
205 tM_build_pages(); | |
206 } | |
207 | |
208 | |
209 void tM_rebuild_menu_after_tComm(void) | |
210 { | |
211 tM_rebuild_pages(); | |
212 } | |
213 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
214 void tM_check_content(void) |
38 | 215 { |
216 uint8_t mode = 0; | |
217 | |
218 if(stateUsed->mode == MODE_DIVE) | |
219 { | |
220 if(stateUsed == stateRealGetPointer()) | |
221 mode = MENU_DIVE_REAL; | |
222 else | |
223 mode = MENU_DIVE_SIM; | |
224 } | |
225 else | |
226 mode = MENU_SURFACE; | |
227 | |
228 if(actual_menu_content != mode) | |
229 { | |
230 actual_menu_content = mode; | |
231 tM_rebuild_pages(); | |
232 } | |
233 } | |
234 | |
235 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
236 static void clean_line_actual_page(void) |
38 | 237 { |
238 uint8_t line, page; | |
239 | |
240 page = menu.pageMemoryForNavigation; | |
241 line = menu.lineMemoryForNavigationForPage[page]; | |
122
871baf20776b
Take care for display orientation if deleting lines
Ideenmodellierer
parents:
110
diff
changeset
|
242 if(settingsGetPointer()->FlipDisplay) /* Reselect line to be deleted if display is rotated */ |
871baf20776b
Take care for display orientation if deleting lines
Ideenmodellierer
parents:
110
diff
changeset
|
243 { |
871baf20776b
Take care for display orientation if deleting lines
Ideenmodellierer
parents:
110
diff
changeset
|
244 line = 6 - line + 1; |
871baf20776b
Take care for display orientation if deleting lines
Ideenmodellierer
parents:
110
diff
changeset
|
245 } |
38 | 246 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; |
247 GFX_clean_line(&tMwindow, line); | |
248 } | |
249 | |
250 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
251 static void update_content_actual_page(char *text, uint16_t tab, char *subtext) |
38 | 252 { |
253 uint8_t page; | |
254 | |
255 page = menu.pageMemoryForNavigation; | |
256 | |
257 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; | |
258 if(tab == 0) | |
259 tMwindow.WindowTab = 400; | |
260 else | |
261 tMwindow.WindowTab = tab; | |
262 | |
263 tMenu_write(page, text, subtext); | |
264 } | |
265 | |
266 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
267 static void update_content_with_new_frame(uint8_t page, char *text, uint16_t tab, char *subtext) |
38 | 268 { |
269 char localtext[32]; | |
270 | |
271 uint32_t rememberPage = menu.StartAddressForPage[page]; | |
272 menu.StartAddressForPage[page] = getFrame(5); | |
273 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; | |
274 | |
275 if(tab == 0) | |
276 tMwindow.WindowTab = 400; | |
277 else | |
278 tMwindow.WindowTab = tab; | |
279 | |
280 draw_tMheader(page); | |
281 tMenu_write(page, text, subtext); | |
282 | |
283 localtext[0] = TXT_2BYTE; | |
284 localtext[1] = TXT2BYTE_ButtonBack; | |
285 localtext[2] = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
286 write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); |
38 | 287 |
288 localtext[0] = '\001'; | |
289 localtext[1] = TXT_2BYTE; | |
290 localtext[2] = TXT2BYTE_ButtonEnter; | |
291 localtext[3] = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
292 write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); |
38 | 293 |
294 localtext[0] = '\002'; | |
295 localtext[1] = TXT_2BYTE; | |
296 localtext[2] = TXT2BYTE_ButtonNext; | |
297 localtext[3] = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
298 write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); |
38 | 299 |
300 // gfx_write_page_number(&tMscreen ,menu.pageCountNumber[page],menu.pageCountTotal,0); | |
301 | |
302 if(page == menu.pageMemoryForNavigation) | |
303 GFX_SetFrameTop(tMscreen.FBStartAdress); | |
304 releaseFrame(5,rememberPage); | |
305 } | |
306 | |
307 | |
169
842f57bbaaad
Bugfix: highlight the menu underline correctly on selected state
Jan Mulder <jlmulder@xs4all.nl>
parents:
167
diff
changeset
|
308 static void tM_create_pagenumbering(void) |
38 | 309 { |
310 menu.pageCountTotal = 0; | |
311 | |
312 for(int i=0;i<=MAXPAGES;i++) | |
313 { | |
314 if(menu.pageCountNumber[i]) | |
315 { | |
316 menu.pageCountTotal++; | |
317 menu.pageCountNumber[i] = menu.pageCountTotal; | |
318 } | |
319 } | |
320 } | |
321 | |
322 | |
379 | 323 void tM_build_page(uint32_t id, char *text, uint16_t tab, char *subtext) |
38 | 324 { |
325 uint8_t linesFound; | |
326 uint16_t i; | |
327 SStateList idList; | |
328 uint8_t page; | |
329 | |
330 char localtext[32]; | |
331 | |
332 if(menu.pagesAvailable > MAXPAGES) | |
333 return; | |
334 | |
335 get_idSpecificStateList(id, &idList); | |
336 | |
337 if(idList.base != BaseMenu) | |
338 return; | |
339 | |
340 if(idList.page == 0) | |
341 return; | |
342 | |
343 if(idList.page > MAXPAGES) | |
344 return; | |
345 | |
346 page = idList.page; | |
347 | |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
348 if((!menu.pageCountNumber[page]) && (!menu.shadowPage[page])) /* shadow pages are not visible on top level */ |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
349 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
350 return; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
351 } |
38 | 352 |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
353 if(menu.pagesAvailable == 0) |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
354 tM_create_pagenumbering(); |
38 | 355 |
356 if(*text == 0) | |
357 return; | |
358 | |
359 linesFound = 1; | |
360 | |
361 if(menu.StartAddressForPage[page]) | |
362 releaseFrame(5,menu.StartAddressForPage[page]); | |
363 | |
364 menu.StartAddressForPage[page] = getFrame(5); | |
365 | |
366 if(menu.StartAddressForPage[page] == 0) | |
367 return; | |
368 | |
369 i = 0; | |
370 while((i < MAX_PAGE_TEXTSIZE) && text[i]) | |
371 { | |
372 if((text[i] == '\n') && ((i + 2) < MAX_PAGE_TEXTSIZE) && text[i+1] && text[i+2]) | |
373 linesFound += 1; | |
374 i++; | |
375 } | |
376 | |
377 menu.linesAvailableForPage[page] = linesFound; | |
378 menu.pagesAvailable++; /* even if it was used before */ | |
379 | |
380 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; | |
381 if(tab == 0) | |
382 tMwindow.WindowTab = 400; | |
383 else | |
384 tMwindow.WindowTab = tab; | |
385 | |
386 draw_tMheader(page); | |
387 | |
388 tMenu_write(page, text, subtext); | |
389 | |
390 localtext[0] = TXT_2BYTE; | |
391 localtext[1] = TXT2BYTE_ButtonBack; | |
392 localtext[2] = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
393 write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); |
38 | 394 |
395 localtext[0] = '\001'; | |
396 localtext[1] = TXT_2BYTE; | |
397 localtext[2] = TXT2BYTE_ButtonEnter; | |
398 localtext[3] = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
399 write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); |
38 | 400 |
401 localtext[0] = '\002'; | |
402 localtext[1] = TXT_2BYTE; | |
403 localtext[2] = TXT2BYTE_ButtonNext; | |
404 localtext[3] = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
405 write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); |
38 | 406 } |
407 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
408 static void findValidPosition(uint8_t *pageOuput, uint8_t *lineOutput) |
38 | 409 { |
51
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
410 uint8_t page = 0; |
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
411 uint8_t line = 0; |
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
412 uint8_t first = 0; |
38 | 413 |
414 *pageOuput = 0; | |
415 *lineOutput = 0; | |
416 | |
417 /* test */ | |
418 if(menu.pagesAvailable == 0) | |
419 return; | |
420 | |
421 for(int i=1;i<=MAXPAGES;i++) | |
422 { | |
423 if((menu.pageCountNumber[i] != 0) | |
424 && (menu.linesAvailableForPage[i] != 0) | |
425 && (menu.StartAddressForPage[i] != 0)) | |
426 { | |
427 first = i; | |
428 break; | |
429 } | |
430 } | |
431 | |
432 /* select */ | |
433 if(menu.pageMemoryForNavigation > MAXPAGES) | |
434 menu.pageMemoryForNavigation = first; | |
435 | |
436 page = menu.pageMemoryForNavigation; | |
437 | |
438 if(page == 0) | |
439 page = first; | |
440 | |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
441 while((page <= MAXPAGES) && ((menu.linesAvailableForPage[page] == 0) || (menu.StartAddressForPage[page] == 0) || ((menu.pageCountNumber[page] == 0) && !((menu.shadowPage[page]) && (menu.pageMemoryForNavigation == page))))) |
38 | 442 page += 1; |
443 | |
444 if(page > MAXPAGES) | |
445 page = first; | |
446 | |
447 line = menu.lineMemoryForNavigationForPage[page]; | |
448 | |
449 if(line == 0) | |
450 line = 1; | |
451 | |
452 if(line > menu.linesAvailableForPage[page]) | |
453 line = 1; | |
454 | |
455 *pageOuput = page; | |
456 *lineOutput = line; | |
457 } | |
458 | |
459 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
460 static void tM_add(uint32_t id) |
38 | 461 { |
462 SStateList idList; | |
463 uint8_t page; | |
464 | |
465 get_idSpecificStateList(id, &idList); | |
466 | |
467 page = idList.page; | |
468 | |
469 if(page > MAXPAGES) | |
470 return; | |
471 | |
472 menu.pageCountNumber[page] = 1; | |
473 } | |
474 | |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
475 static void tM_addShadow(uint32_t id) |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
476 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
477 SStateList idList; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
478 uint8_t page; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
479 |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
480 get_idSpecificStateList(id, &idList); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
481 |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
482 page = idList.page; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
483 |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
484 if(page > MAXPAGES) |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
485 return; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
486 |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
487 menu.shadowPage[page] = 1; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
488 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
489 |
38 | 490 |
491 void tM_build_pages(void) | |
492 { | |
493 char text[MAX_PAGE_TEXTSIZE]; | |
494 char subtext[MAX_PAGE_TEXTSIZE]; | |
495 uint32_t id; | |
496 uint16_t tabPosition; | |
497 SSettings *pSettings = settingsGetPointer(); | |
498 | |
499 menu.pagesAvailable = 0; | |
500 for(int i=0;i<=MAXPAGES;i++) | |
501 menu.pageCountNumber[i] = 0; | |
502 | |
503 tabPosition = 400; | |
504 *text = 0; | |
505 *subtext = 0; | |
506 | |
507 /* 2015 Feb 02, hw | |
508 * max 8 Menu Pages | |
509 */ | |
510 | |
511 | |
512 tM_add(StMSYS); //now in both modes | |
513 if(actual_menu_content == MENU_SURFACE) | |
514 { | |
515 tM_add(StMDECO); | |
516 tM_add(StMHARD); | |
507 | 517 tM_add(StMCustom); |
38 | 518 // tM_add(StMSYS); now in both modes |
519 } | |
520 else | |
521 { | |
522 tM_add(StMXTRA); | |
523 } | |
524 if(actual_menu_content == MENU_SURFACE) | |
525 { | |
526 tM_add(StMPLAN); | |
527 } | |
528 // if((pSettings->dive_mode != DIVEMODE_Gauge) && (pSettings->dive_mode != DIVEMODE_Apnea)) | |
529 // { | |
530 tM_add(StMDECOP); | |
531 // } | |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
532 |
38 | 533 if((pSettings->dive_mode == DIVEMODE_CCR) || (stateUsed->diveSettings.ccrOption == 1)) |
534 { | |
535 tM_add(StMCG); | |
536 tM_add(StMSP); | |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
537 if (actual_menu_content == MENU_SURFACE) /* StMOG is now accessed using StMCG in CCR mode*/ |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
538 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
539 tM_add(StMXTRA); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
540 tM_addShadow(StMOG); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
541 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
542 else |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
543 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
544 tM_add(StMOG); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
545 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
546 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
547 else |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
548 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
549 tM_add(StMOG); |
38 | 550 } |
551 | |
552 id = tMOG_refresh(0, text, &tabPosition, subtext); | |
553 tM_build_page(id, text, tabPosition, subtext); | |
554 | |
555 id = tMCG_refresh(0, text, &tabPosition, subtext); | |
556 tM_build_page(id, text, tabPosition, subtext); | |
557 | |
558 id = tMSP_refresh(0, text, &tabPosition, subtext); | |
559 tM_build_page(id, text, tabPosition, subtext); | |
560 | |
561 id = tMXtra_refresh(0, text, &tabPosition, subtext); | |
562 tM_build_page(id, text, tabPosition, subtext); | |
563 | |
564 id = tMPlanner_refresh(0, text, &tabPosition, subtext); | |
565 tM_build_page(id, text, tabPosition, subtext); | |
566 | |
567 id = tMDeco_refresh(0, text, &tabPosition, subtext); | |
568 tM_build_page(id, text, tabPosition, subtext); | |
569 | |
570 id = tMDecoParameters_refresh(0, text, &tabPosition, subtext); | |
571 tM_build_page(id, text, tabPosition, subtext); | |
572 | |
573 id = tMPlanner_refresh(0, text, &tabPosition, subtext); | |
574 tM_build_page(id, text, tabPosition, subtext); | |
575 | |
576 id = tMHardware_refresh(0, text, &tabPosition, subtext); | |
577 tM_build_page(id, text, tabPosition, subtext); | |
578 | |
579 id = tMSystem_refresh(0, text, &tabPosition, subtext); | |
580 tM_build_page(id, text, tabPosition, subtext); | |
507 | 581 |
582 id = tMCustom_refresh(0, text, &tabPosition, subtext); | |
583 tM_build_page(id, text, tabPosition, subtext); | |
38 | 584 } |
585 | |
586 | |
587 void tM_refresh_live_content(void) | |
588 { | |
51
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
589 uint8_t page = 0; |
38 | 590 char text[MAX_PAGE_TEXTSIZE]; |
591 char subtext[MAX_PAGE_TEXTSIZE]; | |
592 uint16_t tabPosition; | |
593 | |
594 if((get_globalState() == StMSYS) && (actual_menu_content == MENU_SURFACE)) | |
595 { | |
596 page = menu.pageMemoryForNavigation; | |
597 tMSystem_refresh(0, text, &tabPosition, subtext); | |
598 update_content_with_new_frame(page, text, tabPosition, subtext); | |
599 } | |
600 else | |
601 if(get_globalState() == StMHARD) | |
602 { | |
603 page = menu.pageMemoryForNavigation; | |
604 tMHardware_refresh(0, text, &tabPosition, subtext); | |
605 update_content_with_new_frame(page, text, tabPosition, subtext); | |
606 } | |
607 | |
608 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; | |
609 tHome_show_lost_connection_count(&tMscreen); | |
610 /* | |
611 SStateList idList; | |
612 if(actual_menu_content == MENU_SURFACE) | |
613 { | |
614 page = menu.pageMemoryForNavigation; | |
615 get_idSpecificStateList(StMSYS, &idList); | |
616 if(page == idList.page) | |
617 { | |
618 tMSystem_refresh(0, text, &tabPosition, subtext); | |
619 update_content_with_new_frame(page, text, tabPosition, subtext); | |
620 } | |
621 } | |
622 */ | |
623 } | |
624 | |
625 | |
626 /* new frame only! */ | |
627 void updateSpecificMenu(uint32_t id) | |
628 { | |
629 uint8_t page; | |
630 SStateList idList; | |
631 | |
632 char text[MAX_PAGE_TEXTSIZE]; | |
633 char subtext[MAX_PAGE_TEXTSIZE]; | |
634 uint16_t tabPosition; | |
635 | |
636 *subtext = 0; | |
637 *text = 0; | |
638 tabPosition = 400; | |
639 | |
640 get_idSpecificStateList(id, &idList); | |
641 page = idList.page; | |
642 | |
643 switch(id) | |
644 { | |
645 case StMOG: | |
646 tMOG_refresh(0, text, &tabPosition, subtext); | |
647 update_content_with_new_frame(page, text, tabPosition, subtext); | |
648 break; | |
649 case StMCG: | |
650 tMCG_refresh(0, text, &tabPosition, subtext); | |
651 update_content_with_new_frame(page, text, tabPosition, subtext); | |
652 break; | |
653 case StMSP: | |
654 tMSP_refresh(0, text, &tabPosition, subtext); | |
655 update_content_with_new_frame(page, text, tabPosition, subtext); | |
656 break; | |
657 default: | |
658 break; | |
659 } | |
660 } | |
661 | |
662 | |
663 void updateMenu(void) | |
664 { | |
665 uint8_t page, line; | |
666 | |
667 char text[MAX_PAGE_TEXTSIZE]; | |
668 char subtext[MAX_PAGE_TEXTSIZE]; | |
669 uint16_t tabPosition; | |
670 | |
671 *subtext = 0; | |
672 *text = 0; | |
673 tabPosition = 400; | |
674 | |
675 page = menu.pageMemoryForNavigation; | |
676 line = menu.lineMemoryForNavigationForPage[page]; | |
677 | |
678 switch(get_globalState()) | |
679 { | |
680 case StMOG: | |
681 tMOG_refresh(0, text, &tabPosition, subtext); | |
682 update_content_with_new_frame(page, text, tabPosition, subtext); | |
683 break; | |
684 case StMCG: | |
685 tMCG_refresh(0, text, &tabPosition, subtext); | |
686 update_content_with_new_frame(page, text, tabPosition, subtext); | |
687 break; | |
688 case StMSP: | |
689 tMSP_refresh(0, text, &tabPosition, subtext); | |
690 update_content_with_new_frame(page, text, tabPosition, subtext); | |
691 break; | |
692 case StMXTRA: | |
693 tMXtra_refresh(0, text, &tabPosition, subtext); | |
694 update_content_with_new_frame(page, text, tabPosition, subtext); | |
695 break; | |
696 case StMDECO: | |
697 if((line == 1) || (line == 3)) // dive mode or ppO2 limits (the later for correct MOD in gaslists) | |
698 { | |
699 tM_rebuild_pages(); | |
700 menu.lineMemoryForNavigationForPage[page] = line; // fix 160623 | |
701 GFX_SetFrameTop(menu.StartAddressForPage[page]); | |
702 } | |
703 else | |
704 { | |
705 tMDeco_refresh(line, text, &tabPosition, subtext); | |
706 clean_line_actual_page(); | |
707 update_content_actual_page(text, tabPosition, subtext); | |
708 } | |
709 break; | |
710 case StMDECOP: | |
711 tMDecoParameters_refresh(line, text, &tabPosition, subtext); | |
712 clean_line_actual_page(); | |
713 update_content_actual_page(text, tabPosition, subtext); | |
714 break; | |
715 case StMPLAN: | |
716 tMPlanner_refresh(line, text, &tabPosition, subtext); | |
717 clean_line_actual_page(); | |
718 update_content_actual_page(text, tabPosition, subtext); | |
719 break; | |
720 case StMHARD: | |
721 tMHardware_refresh(line, text, &tabPosition, subtext); | |
722 clean_line_actual_page(); | |
723 update_content_actual_page(text, tabPosition, subtext); | |
724 break; | |
725 case StMSYS: | |
726 if((line == 2) || (line == 3) || (line == 6)) | |
727 { | |
728 tM_rebuild_pages(); | |
729 menu.lineMemoryForNavigationForPage[page] = line; // fix 160623 | |
730 GFX_SetFrameTop(menu.StartAddressForPage[page]); | |
731 menu.lineMemoryForNavigationForPage[page] = line; | |
732 } | |
733 else | |
734 { | |
735 tMSystem_refresh(line, text, &tabPosition, subtext); | |
736 clean_line_actual_page(); | |
737 update_content_actual_page(text, tabPosition, subtext); | |
738 } | |
739 break; | |
507 | 740 case StMCustom: |
741 tMCustom_refresh(line, text, &tabPosition, subtext); | |
742 clean_line_actual_page(); | |
743 update_content_actual_page(text, tabPosition, subtext); | |
744 break; | |
38 | 745 default: |
746 break; | |
747 } | |
748 } | |
749 | |
750 void openMenu_first_page_with_OC_gas_update(void) | |
751 { | |
752 menu.pageMemoryForNavigation = 1; | |
753 for(int i=0;i<=MAXPAGES;i++) | |
754 menu.lineMemoryForNavigationForPage[i] = 0; | |
755 | |
756 set_globalState(StMOG); | |
757 updateMenu(); | |
758 openMenu(1); | |
759 } | |
760 | |
761 | |
762 void openMenu(uint8_t freshWithFlipPages) | |
763 { | |
764 uint8_t page, line; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
765 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
766 pSettings = settingsGetPointer(); |
38 | 767 |
768 findValidPosition(&page, &line); | |
769 if((page == 0) || (line == 0)) | |
770 return; | |
771 | |
772 menu.pageMemoryForNavigation = page; | |
773 /* new test for 3button design */ | |
774 if(freshWithFlipPages) | |
775 { | |
776 menu.lineMemoryForNavigationForPage[page] = 0; | |
777 menu.modeFlipPages = 1; | |
778 } | |
779 else | |
780 { | |
781 menu.lineMemoryForNavigationForPage[page] = line; | |
782 menu.modeFlipPages = 0; | |
783 } | |
784 | |
785 set_globalState_Menu_Page(page); | |
786 | |
787 | |
788 change_CLUT_entry(CLUT_MenuLineSelectedSides, (CLUT_MenuPageGasOC + page - 1)); | |
789 change_CLUT_entry(CLUT_MenuLineSelectedSeperator, (CLUT_MenuPageGasOC + page - 1)); | |
790 | |
791 | |
792 if(((page == 6) || (page == 8)) && (menu.pageCountNumber[page-1] == 0)) | |
793 { | |
794 change_CLUT_entry(CLUT_MenuLineSelectedSides, (CLUT_MenuPageGasOC + page - 2)); | |
795 change_CLUT_entry(CLUT_MenuLineSelectedSeperator, (CLUT_MenuPageGasOC + page - 2)); | |
796 | |
797 } | |
798 | |
799 GFX_SetFrameTop(menu.StartAddressForPage[page]); | |
800 /* new test for 3button design */ | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
801 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
802 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
803 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
804 if(freshWithFlipPages) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
805 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
806 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
807 GFX_SetFrameBottom((tMdesignCursor.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
808 } |
38 | 809 else |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
810 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
811 if(freshWithFlipPages) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
812 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
813 GFX_SetFrameBottom((tMdesignSolo.FBStartAdress), 0, 480-390-KEY_LABEL_HIGH, 800, 390); //- (25 * 2 * 800), 0, 25, 800, 390); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
814 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
815 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
816 GFX_SetFrameBottom((tMdesignCursor.FBStartAdress + (390 - 65 *(line)) *2), 0,480-390-KEY_LABEL_HIGH, 800, 390); //480-390-KEY_LABEL_HIGH + 65*2*(line - 1) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
817 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
818 |
38 | 819 } |
820 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
821 static void block_diluent_handler(_Bool Unblock) |
38 | 822 { |
823 SStateList list; | |
824 static uint8_t linesAvailableForPageDiluent = 0; | |
825 get_idSpecificStateList(StMCG, &list); | |
826 | |
827 if(Unblock && linesAvailableForPageDiluent) | |
828 { | |
829 menu.linesAvailableForPage[list.page] = linesAvailableForPageDiluent; | |
830 } | |
831 else | |
832 { | |
833 linesAvailableForPageDiluent = menu.linesAvailableForPage[list.page]; | |
834 menu.linesAvailableForPage[list.page] = 0; | |
835 } | |
836 } | |
837 | |
838 void block_diluent_page(void) | |
839 { | |
840 block_diluent_handler(0); | |
841 } | |
842 | |
843 | |
844 void unblock_diluent_page(void) | |
845 { | |
846 block_diluent_handler(1); | |
847 } | |
848 | |
849 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
850 static void nextPage(void) |
38 | 851 { |
852 uint8_t page, line; | |
853 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
854 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
855 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
856 |
38 | 857 menu.pageMemoryForNavigation += 1; |
858 | |
859 findValidPosition(&page, &line); | |
860 menu.pageMemoryForNavigation = page; | |
861 /* new test for 3button design */ | |
862 //menu.lineMemoryForNavigationForPage[page] = line; | |
863 menu.lineMemoryForNavigationForPage[page] = 0; | |
864 menu.modeFlipPages = 1; | |
865 | |
866 set_globalState_Menu_Page(page); | |
867 | |
868 change_CLUT_entry(CLUT_MenuLineSelectedSides, (CLUT_MenuPageGasOC + page - 1)); | |
869 change_CLUT_entry(CLUT_MenuLineSelectedSeperator, (CLUT_MenuPageGasOC + page - 1)); | |
870 | |
871 GFX_SetFrameTop(menu.StartAddressForPage[page]); | |
872 /* new test for 3button design */ | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
873 //GFX_SetFrameBottom((.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
874 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
875 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
876 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
877 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
878 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
879 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
880 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 65, 800, 390); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
881 } |
38 | 882 } |
883 | |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
884 void selectPage(uint32_t selection) |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
885 { |
650 | 886 uint8_t page; |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
887 SStateList idList; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
888 |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
889 SSettings* pSettings; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
890 pSettings = settingsGetPointer(); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
891 |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
892 // menu.pageMemoryForNavigation = selection; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
893 |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
894 // findValidPosition(&page, &line); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
895 if(selection > MAXPAGES) /* selection via structure */ |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
896 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
897 get_idSpecificStateList(selection, &idList); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
898 page = idList.page; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
899 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
900 else |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
901 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
902 page = selection; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
903 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
904 |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
905 if(menu.shadowPage[page]) /* backup base page in case a shadow was selected */ |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
906 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
907 menu.activeShadow = menu.pageMemoryForNavigation; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
908 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
909 |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
910 menu.pageMemoryForNavigation = page; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
911 /* new test for 3button design */ |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
912 //menu.lineMemoryForNavigationForPage[page] = line; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
913 menu.lineMemoryForNavigationForPage[page] = 0; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
914 menu.modeFlipPages = 1; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
915 |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
916 set_globalState_Menu_Page(page); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
917 |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
918 change_CLUT_entry(CLUT_MenuLineSelectedSides, (CLUT_MenuPageGasOC + page - 1)); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
919 change_CLUT_entry(CLUT_MenuLineSelectedSeperator, (CLUT_MenuPageGasOC + page - 1)); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
920 |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
921 GFX_SetFrameTop(menu.StartAddressForPage[page]); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
922 /* new test for 3button design */ |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
923 //GFX_SetFrameBottom((.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
924 if(!pSettings->FlipDisplay) |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
925 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
926 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
927 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
928 else |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
929 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
930 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 65, 800, 390); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
931 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
932 nextLine(); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
933 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
934 |
38 | 935 |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
936 static void nextLine(void) |
38 | 937 { |
938 uint8_t page, line; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
939 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
940 pSettings = settingsGetPointer(); |
38 | 941 |
942 page = menu.pageMemoryForNavigation; | |
943 menu.lineMemoryForNavigationForPage[page] += 1; | |
944 | |
945 findValidPosition(&page, &line); | |
946 menu.lineMemoryForNavigationForPage[page] = line; | |
947 | |
948 /* new test for 3button design */ | |
949 menu.modeFlipPages = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
950 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
951 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
952 GFX_SetFrameBottom((tMdesignCursor.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
953 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
954 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
955 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
956 GFX_SetFrameBottom((tMdesignCursor.FBStartAdress)+ (390 - 65 *(line)) *2, 0, 480-390-KEY_LABEL_HIGH, 800, 390); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
957 } |
38 | 958 } |
959 | |
960 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
961 static void stepBackMenu(void) |
38 | 962 { |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
963 if(menu.activeShadow) /* restore base page */ |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
964 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
965 selectPage(menu.activeShadow); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
966 menu.activeShadow = 0; |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
967 } |
38 | 968 if(menu.modeFlipPages == 0) |
969 { | |
970 menu.lineMemoryForNavigationForPage[menu.pageMemoryForNavigation] = 0; | |
971 menu.modeFlipPages = 1; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
972 if(!settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
973 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
974 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
975 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
976 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
977 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
978 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 480-390-KEY_LABEL_HIGH, 800, 390); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
979 } |
38 | 980 } |
981 else | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
982 { |
38 | 983 exitMenu(); |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
984 } |
38 | 985 } |
986 | |
987 | |
988 void exitMenu(void) | |
989 { | |
990 set_globalState_tHome(); | |
991 } | |
992 | |
993 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
994 static void stepForwardMenu(void) |
38 | 995 { |
996 if(menu.modeFlipPages == 1) | |
997 { | |
998 nextLine(); | |
999 } | |
1000 else | |
1001 gotoMenuEdit(); | |
1002 } | |
1003 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1004 static void gotoMenuEdit(void) |
38 | 1005 { |
1006 uint8_t line; | |
1007 | |
1008 line = menu.lineMemoryForNavigationForPage[menu.pageMemoryForNavigation]; | |
1009 | |
1010 switch(get_globalState()) | |
1011 { | |
1012 case StMOG: | |
1013 openEdit_GasOC(line); | |
1014 break; | |
1015 case StMCG: | |
1016 openEdit_GasCC(line); | |
1017 break; | |
1018 case StMSP: | |
1019 openEdit_Setpoint(line); | |
1020 break; | |
1021 case StMXTRA: | |
1022 openEdit_Xtra(line); | |
1023 break; | |
1024 case StMDECO: | |
1025 openEdit_Deco(line); | |
1026 break; | |
1027 case StMDECOP: | |
1028 openEdit_DecoParameter(line); | |
1029 break; | |
1030 case StMPLAN: | |
1031 openEdit_Planner(line); | |
1032 break; | |
1033 case StMHARD: | |
1034 openEdit_Hardware(line); | |
1035 break; | |
1036 case StMSYS: | |
1037 openEdit_System(line); | |
1038 break; | |
507 | 1039 case StMCustom: |
1040 openEdit_Custom(line); | |
1041 break; | |
38 | 1042 default: |
1043 break; | |
1044 } | |
1045 } | |
1046 | |
1047 | |
1048 void sendActionToMenu(uint8_t sendAction) | |
1049 { | |
1050 switch(sendAction) | |
1051 { | |
1052 case ACTION_BUTTON_ENTER: | |
1053 stepForwardMenu(); | |
1054 break; | |
1055 case ACTION_BUTTON_NEXT: | |
1056 if(menu.modeFlipPages) | |
1057 nextPage(); | |
1058 else | |
1059 nextLine(); | |
1060 break; | |
1061 case ACTION_TIMEOUT: | |
1062 case ACTION_MODE_CHANGE: | |
1063 case ACTION_BUTTON_BACK: | |
1064 /* new test for 3button design */ | |
1065 stepBackMenu(); | |
1066 break; | |
1067 default: | |
1068 break; | |
1069 case ACTION_IDLE_TICK: | |
1070 case ACTION_IDLE_SECOND: | |
1071 break; | |
1072 } | |
1073 /* tMC_OC_Gas(StMOG1, pSettings); */ | |
1074 } | |
1075 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1076 static void tMenu_write(uint8_t page, char *text, char *subtext) |
38 | 1077 { |
1078 if(page > MAXPAGES) | |
1079 return; | |
1080 if(menu.linesAvailableForPage[page] == 0) | |
1081 return; | |
1082 | |
1083 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; | |
1084 GFX_write_string(&FontT48, &tMwindow, text,1); | |
1085 if((*subtext) && (menu.linesAvailableForPage[page] < 6)) | |
1086 { | |
1087 GFX_write_string(&FontT42, &tMwindow, subtext, (menu.linesAvailableForPage[page] + 1)); | |
1088 } | |
1089 } | |
1090 | |
1091 | |
1092 /* Private functions ---------------------------------------------------------*/ | |
1093 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1094 static void draw_tMdesignSubUnselected(uint32_t *ppDestination) |
38 | 1095 { |
1096 union al88_u | |
1097 { | |
1098 uint8_t al8[2]; | |
1099 uint16_t al88; | |
1100 }; | |
1101 | |
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
122
diff
changeset
|
1102 uint16_t* prunning = (uint16_t*)*ppDestination; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1103 |
38 | 1104 union al88_u color_seperator; |
1105 union al88_u color_unselected; | |
1106 int i; | |
1107 | |
1108 color_seperator.al8[0] = CLUT_MenuLineUnselectedSeperator; | |
1109 color_unselected.al8[0] = CLUT_MenuLineUnselected; | |
1110 | |
1111 color_seperator.al8[1] = 0xFF; | |
1112 color_unselected.al8[1] = 0xFF; | |
1113 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1114 *(__IO uint16_t*)prunning++ = color_seperator.al88; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1115 *(__IO uint16_t*)prunning++ = color_seperator.al88; |
38 | 1116 |
1117 for(i = 61; i > 0; i--) | |
1118 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1119 *(__IO uint16_t*)prunning++ = color_unselected.al88; |
38 | 1120 } |
1121 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1122 *(__IO uint16_t*)prunning++ = color_seperator.al88; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1123 *(__IO uint16_t*)prunning++ = color_seperator.al88; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1124 |
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
122
diff
changeset
|
1125 *ppDestination = (uint32_t)prunning; |
38 | 1126 } |
1127 | |
1128 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1129 static void draw_tMdesignSubSelected(uint32_t *ppDestination) |
38 | 1130 { |
1131 union al88_u | |
1132 { | |
1133 uint8_t al8[2]; | |
1134 uint16_t al88; | |
1135 }; | |
1136 | |
1137 union al88_u color_selected; | |
1138 union al88_u color_seperator; | |
1139 int i; | |
1140 | |
1141 color_selected.al8[0] = CLUT_MenuLineSelected; | |
1142 color_selected.al8[1] = 0xFF; | |
1143 | |
1144 color_seperator.al8[0] = CLUT_MenuLineSelectedSeperator; | |
1145 color_seperator.al8[1] = 0xFF; | |
1146 | |
1147 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
1148 *ppDestination += 2; | |
1149 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
1150 *ppDestination += 2; | |
1151 | |
1152 for(i = 61; i > 0; i--) | |
1153 { | |
1154 *(__IO uint16_t*)*ppDestination = color_selected.al88; | |
1155 *ppDestination += 2; | |
1156 } | |
1157 | |
1158 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
1159 *ppDestination += 2; | |
1160 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
1161 *ppDestination += 2; | |
1162 } | |
1163 | |
1164 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1165 static void draw_tMdesignSubSelectedBorder(uint32_t *ppDestination) |
38 | 1166 { |
1167 union al88_u | |
1168 { | |
1169 uint8_t al8[2]; | |
1170 uint16_t al88; | |
1171 }; | |
1172 | |
1173 union al88_u color_selected_sides; | |
1174 | |
1175 int i; | |
1176 | |
1177 color_selected_sides.al8[0] = CLUT_MenuLineSelectedSides; | |
1178 color_selected_sides.al8[1] = 0xFF; | |
1179 | |
1180 for(i = 65; i > 0; i--) | |
1181 { | |
1182 *(__IO uint16_t*)*ppDestination = color_selected_sides.al88; | |
1183 *ppDestination += 2; | |
1184 } | |
1185 } | |
1186 | |
1187 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1188 static void draw_tMcursorDesign(void) |
38 | 1189 { |
1190 int i,j; | |
1191 uint32_t pDestination; | |
1192 | |
1193 pDestination = tMdesignCursor.FBStartAdress; | |
1194 | |
1195 for(j = 801; j > 0; j--) | |
1196 { | |
1197 for(i = 5; i > 0; i--) | |
1198 { | |
1199 draw_tMdesignSubUnselected(&pDestination); | |
1200 } | |
1201 if((j > 787) || (j < 17)) | |
1202 draw_tMdesignSubSelectedBorder(&pDestination); | |
1203 else | |
1204 draw_tMdesignSubSelected(&pDestination); | |
1205 } | |
1206 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1207 /* Draw menu background boxes which are visible if nothing is selected */ |
38 | 1208 pDestination = tMdesignSolo.FBStartAdress; |
1209 | |
1210 for(j = 801; j > 0; j--) | |
1211 { | |
1212 for(i = 6; i > 0; i--) | |
1213 { | |
1214 draw_tMdesignSubUnselected(&pDestination); | |
1215 } | |
1216 } | |
1217 } | |
1218 | |
1219 | |
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1220 static void draw_tMheader(uint8_t page) |
38 | 1221 { |
1222 union al88_u | |
1223 { | |
1224 uint8_t al8[2]; | |
1225 uint16_t al88; | |
1226 }; | |
1227 union al88_u color_top; | |
1228 int i,j, k, k4text; | |
1229 uint32_t pBackup; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1230 uint16_t* pDestination; |
38 | 1231 uint8_t colorText; |
1232 uint16_t positionText; | |
1233 uint8_t pageText; | |
1234 | |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1235 char text8max[MAXPAGES+1][8] = |
38 | 1236 { "", |
1237 "OC", | |
1238 "CC", | |
1239 "SP", | |
1240 "DATA", | |
1241 "DECO", | |
1242 "", | |
1243 "SYS", | |
1244 "", | |
507 | 1245 "", |
1246 "SIM" | |
38 | 1247 }; |
1248 | |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1249 _Bool spacing[MAXPAGES+1] = |
38 | 1250 { 0, |
1251 0, // behind OC | |
1252 0, // behind CC | |
1253 1, // behind SP | |
1254 1, // behind DATA | |
1255 0, // behind DECO1 | |
1256 1, // behind DECO2 | |
1257 0, // behind SYS1 | |
507 | 1258 0, // behind SYS2 |
1259 1, // behind SYS3 | |
38 | 1260 1, // behind SIM |
1261 0 | |
1262 }; | |
1263 | |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1264 if(actual_menu_content == MENU_SURFACE) |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1265 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1266 spacing[3] = 0; /* Display extra menu directly after setpoint */ |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1267 sprintf(text8max[4],"OP"); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1268 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1269 |
38 | 1270 pBackup = tMscreen.FBStartAdress; |
1271 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; | |
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
122
diff
changeset
|
1272 pDestination = (uint16_t*) menu.StartAddressForPage[page]; |
38 | 1273 positionText = 10; |
1274 pageText = page; | |
1275 | |
1276 gfx_write_page_number(&tMscreen ,menu.pageCountNumber[page],menu.pageCountTotal,0); | |
1277 | |
1278 while((text8max[pageText][0] == 0) && (pageText > 1)) | |
1279 { | |
1280 pageText--; | |
1281 } | |
1282 | |
1283 for(k = 1; k <= MAXPAGES; k++) | |
1284 { | |
1285 if(menu.pageCountNumber[k] != 0) | |
1286 { | |
1287 k4text = k; // new hw 170522 | |
1288 if((text8max[k][0] == 0) && (menu.pageCountNumber[k-1] == 0)) | |
1289 k4text = k-1; | |
1290 | |
1291 color_top.al8[0] = CLUT_MenuPageGasOC + k - 1; | |
169
842f57bbaaad
Bugfix: highlight the menu underline correctly on selected state
Jan Mulder <jlmulder@xs4all.nl>
parents:
167
diff
changeset
|
1292 if (k == page) |
38 | 1293 { |
1294 color_top.al8[1] = 0xFF; | |
1295 } | |
1296 else | |
1297 { | |
1298 color_top.al8[1] = 0x50; | |
1299 } | |
1300 | |
1301 if(k4text == pageText) | |
1302 { | |
1303 colorText = CLUT_Font020; | |
1304 } | |
1305 else | |
1306 { | |
1307 colorText = CLUT_Font021; | |
1308 } | |
1309 | |
1310 write_content_simple(&tMscreen,positionText,775,0,&FontT42,text8max[k4text],colorText); | |
1311 /* | |
1312 write_content_simple(&tMscreen,positionText,775,0,&FontT42,text8max[k],colorText); | |
1313 if((text8max[k][0] == 0) && (menu.pageCountNumber[k-1] == 0)) | |
1314 write_content_simple(&tMscreen,positionText,775,0,&FontT42,text8max[k-1],colorText); | |
1315 */ | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1316 /* Draw color bars */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1317 if(!settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1318 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1319 pDestination += 5 * 480; |
38 | 1320 |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1321 for(j = 60; j > 0; j--) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1322 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1323 pDestination += (390 + 26); |
38 | 1324 |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1325 for(i = 16; i > 0; i--) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1326 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1327 *(__IO uint16_t*)pDestination++ = color_top.al88; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1328 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1329 pDestination += 48; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1330 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1331 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1332 pDestination += 5 * 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1333 positionText += 70; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1334 |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1335 if(((k == 4) && (actual_menu_content != MENU_SURFACE)) || ((k == 6) && (menu.pageCountNumber[5] == 0))) |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1336 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1337 pDestination += 70 * 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1338 positionText += 70; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1339 } |
38 | 1340 |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1341 if(spacing[k]) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1342 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1343 pDestination += 35 * 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1344 positionText += 35; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1345 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1346 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1347 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1348 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1349 pDestination += (800 - 5)* 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1350 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1351 for(j = 60; j > 0; j--) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1352 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1353 pDestination -= (390 + 26); |
38 | 1354 |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1355 for(i = 16; i > 0; i--) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1356 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1357 *(__IO uint16_t*)pDestination-- = color_top.al88; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1358 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1359 pDestination -= 48; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1360 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1361 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1362 pDestination -= (800) * 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1363 positionText += 70; |
38 | 1364 |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1365 if((k == 4) || ((k == 6) && (menu.pageCountNumber[5] == 0))) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1366 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1367 pDestination -= 70 * 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1368 positionText += 70; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1369 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1370 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1371 if(spacing[k]) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1372 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1373 pDestination -= 35 * 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1374 positionText += 35; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1375 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1376 } |
38 | 1377 } |
1378 } | |
1379 tMscreen.FBStartAdress = pBackup; | |
1380 } |