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