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