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