Mercurial > public > ostc4
annotate Discovery/Src/tMenuEdit.c @ 852:b2aad621aeb0 Evo_2_23
Bugfix Selection of custom views:
In case less than 5 views were displayed on a page it could happen that the cursor was put in a wrong position in case the next page was selected. Rootcause was the setting of the element events which was only update in case the menu was entered via the open function.
author | Ideenmodellierer |
---|---|
date | Thu, 07 Mar 2024 21:46:49 +0100 |
parents | 17d9d6eddd8d |
children | de6023cc0580 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuEdit.c | |
5 /// \brief Main Template file for Menu Setting Modifications | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 04-July-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 ------------------------------------------------------------------*/ | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
30 #include <stdlib.h> |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
31 |
38 | 32 #include "tMenuEdit.h" |
33 | |
34 #include "externLogbookFlash.h" | |
35 #include "gfx_fonts.h" | |
36 #include "tHome.h" | |
37 #include "tInfoCompass.h" | |
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
38 #include "tInfoSensor.h" |
845 | 39 #include "tInfoPreDive.h" |
38 | 40 #include "tMenuEditHardware.h" |
41 #include "tMenuEditPlanner.h" | |
42 #include "tMenuEditSystem.h" | |
43 #include "tMenuEditXtra.h" | |
508 | 44 #include "tMenuEditCustom.h" |
38 | 45 |
46 /* Private types -------------------------------------------------------------*/ | |
47 #define TEXTSIZE 16 | |
48 | |
49 typedef struct | |
50 { | |
51 uint32_t pEventFunction; | |
52 uint32_t callerID; | |
53 } SEventHandler; | |
54 | |
55 typedef struct | |
56 { | |
57 uint32_t pEventFunction; | |
58 uint8_t functionParameter; | |
59 uint8_t line; | |
60 } SBackMenuHandler; | |
61 | |
62 typedef struct | |
63 { | |
64 char orgText[32]; | |
65 char newText[32]; | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
66 uint32_t input[4]; |
38 | 67 uint16_t coord[3]; |
68 int8_t begin[4], size[4]; | |
69 tFont *fontUsed; | |
70 uint32_t callerID; | |
71 uint8_t maintype; | |
72 uint8_t subtype; | |
73 } SEditIdent; | |
74 | |
75 typedef enum | |
76 { | |
77 FIELD_NUMBERS = 0, | |
78 FIELD_BUTTON, | |
79 FIELD_SELECT, | |
80 FIELD_SYMBOL, | |
81 FIELD_TOGGLE, | |
82 FIELD_ON_OFF, | |
83 FIELD_UDIGIT, | |
84 FIELD_2DIGIT, | |
85 FIELD_3DIGIT, | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
86 FIELD_SDIGIT, |
38 | 87 FIELD_FLOAT, |
88 FIELD_END | |
89 } SField; | |
90 | |
91 /* Private variables ---------------------------------------------------------*/ | |
92 GFX_DrawCfgScreen tMEscreen; | |
93 GFX_DrawCfgScreen tMEcursor; | |
94 GFX_DrawCfgScreen tMEcursorNew; | |
95 | |
508 | 96 static uint32_t menuID; |
97 static uint8_t menuColor; | |
38 | 98 |
508 | 99 static int8_t id = 0; |
100 static int8_t idLast = -1; | |
101 static SEditIdent ident[10]; | |
102 static int8_t tME_stop = 0; | |
38 | 103 |
508 | 104 static int8_t evid = 0; |
105 static int8_t evidLast = -1; | |
106 static SEventHandler event[10]; | |
38 | 107 |
508 | 108 static SBackMenuHandler backmenu; |
38 | 109 |
508 | 110 static int8_t block = 0; |
111 static int8_t subBlockPosition = 0; | |
38 | 112 |
508 | 113 static _Bool EnterPressedBeforeButtonAction = 0; |
114 static _Bool EnterPressed = 0; | |
38 | 115 |
508 | 116 static _Bool WriteSettings = 0; |
38 | 117 |
118 /* Private function prototypes -----------------------------------------------*/ | |
119 void draw_tMEdesign(void); | |
120 void set_cursorNew(uint8_t forThisIdentID); | |
121 void startMenuEditFieldSelect(void); | |
122 void create_newText_for_actual_Id(void); | |
123 void write_content_of_actual_Id(void); | |
124 void clean_content_of_actual_Id(void); | |
125 void write_content_without_Id(void); | |
126 | |
127 void nextMenuEditFieldDigit(void); | |
128 void upMenuEditFieldDigit(void); | |
129 void downMenuEditFieldDigit(void); | |
130 | |
131 void draw_tMEcursorNewDesign(void); | |
132 | |
133 uint8_t split_Content_to_Digit_helper(uint8_t inContentAscii, uint8_t *outDigit100, uint8_t *outDigit10, uint8_t *outDigit1); | |
134 | |
135 /* Exported functions --------------------------------------------------------*/ | |
136 | |
137 void tMenuEdit_init(void) | |
138 { | |
139 tMEcursor.FBStartAdress = getFrame(7); | |
140 tMEcursor.ImageHeight = 480; | |
141 tMEcursor.ImageWidth = 800; | |
142 tMEcursor.LayerIndex = 0; | |
143 | |
144 GFX_fill_buffer(tMEcursor.FBStartAdress, 0xFF, CLUT_MenuEditCursor); | |
145 | |
146 tMEcursorNew.FBStartAdress = getFrame(8); | |
147 tMEcursorNew.ImageHeight = 390; | |
148 tMEcursorNew.ImageWidth = 800; | |
149 tMEcursorNew.LayerIndex = 0; | |
150 | |
151 draw_tMEcursorNewDesign(); | |
152 } | |
153 | |
154 void stop_cursor_fields(void) | |
155 { | |
156 tME_stop = 1; | |
157 } | |
158 | |
159 void resetMenuEdit(uint8_t color) | |
160 { | |
161 id = 0; | |
162 idLast = -1; | |
163 evid = 0; | |
164 evidLast = -1; | |
165 tME_stop = 0; | |
166 EnterPressed = 0; | |
167 EnterPressedBeforeButtonAction = 0; | |
168 | |
169 setBackMenu(0,0,0); | |
170 | |
171 releaseFrame(9,tMEscreen.FBStartAdress); | |
172 | |
173 tMEscreen.FBStartAdress = getFrame(9); | |
174 tMEscreen.ImageHeight = 480; | |
175 tMEscreen.ImageWidth = 800; | |
176 tMEscreen.LayerIndex = 1; | |
177 | |
178 /* | |
179 write_content_simple(&tMEscreen, 0, 38, 0, &Awe48,"x",CLUT_ButtonSymbols); | |
180 write_content_simple(&tMEscreen, 800-46, 800, 0, &Awe48,"u",CLUT_ButtonSymbols); | |
181 write_content_simple(&tMEscreen, 0, 45, 480-45, &Awe48,"d",CLUT_ButtonSymbols); | |
182 write_content_simple(&tMEscreen, 800-48, 800, 480-45, &Awe48,"e",CLUT_ButtonSymbols); | |
183 */ | |
184 menuID = get_globalState(); | |
185 | |
186 menuColor = color; | |
187 | |
188 // draw_tMEdesign(); | |
189 // GFX_SetFramesTopBottom(tMEscreen.FBStartAdress, tMEcursor.FBStartAdress,480); | |
190 uint8_t line = 1; | |
191 // GFX_SetFramesTopBottom(tMEscreen.FBStartAdress, (tMEcursorNew.FBStartAdress) + 65*2*(line - 1),390); | |
192 GFX_SetFrameTop(tMEscreen.FBStartAdress); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
193 if(!settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
194 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
195 GFX_SetFrameBottom((tMEcursorNew.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
196 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
197 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
198 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
199 GFX_SetFrameBottom((tMEcursorNew.FBStartAdress)+ (390 - 65 *(line)) *2, 0, 480-390-25, 800, 390); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
200 } |
38 | 201 } |
202 | |
203 | |
204 void tMenuEdit_refresh_live_content(void) | |
205 { | |
508 | 206 uint32_t globState = get_globalState(); |
207 void (*refreshFct)() = NULL; | |
38 | 208 |
508 | 209 |
210 switch(globState) | |
211 { | |
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
212 case (StMHARD3_O2_Sensor1): |
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
552
diff
changeset
|
213 case (StMHARD3_O2_Sensor1 & MaskFieldDigit): |
584 | 214 case (StMHARD3_O2_Calibrate): |
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
718
diff
changeset
|
215 case (StMHARD3_Sensor_Detect): |
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
718
diff
changeset
|
216 case (StMHARD3_Sensor_Info): refreshFct = refresh_O2Sensors; |
508 | 217 break; |
774
6169309d6eb9
more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents:
734
diff
changeset
|
218 case (StMHARD2_Compass_SetCourse & MaskFieldDigit): |
6169309d6eb9
more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents:
734
diff
changeset
|
219 refreshFct = refresh_CompassEdit; |
6169309d6eb9
more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents:
734
diff
changeset
|
220 break; |
6169309d6eb9
more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents:
734
diff
changeset
|
221 case (StMXTRA_CompassHeading & MaskFieldDigit): |
6169309d6eb9
more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents:
734
diff
changeset
|
222 refreshFct = refresh_CompassHeading; |
6169309d6eb9
more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents:
734
diff
changeset
|
223 break; |
520 | 224 case (StMSYS4_Info & MaskFieldDigit): refreshFct = &refresh_InformationPage; |
508 | 225 break; |
226 case (StMPLAN5_ExitResult & MaskFieldDigit): refreshFct = refresh_PlanResult; | |
227 break; | |
228 case (StMHARD5_Button1 & MaskFieldDigit): // will not be executed in EditFieldMode as global state is different | |
229 refreshFct = refresh_ButtonValuesFromPIC; | |
230 break; | |
231 case (StMSYS3_Units & MaskFieldDigit): refreshFct = refresh_Design; | |
232 break; | |
520 | 233 case (StMCustom1_CViewTimeout & MaskFieldDigit):refreshFct = refresh_Customviews; |
508 | 234 break; |
531 | 235 case (StMCustom4_CViewSelection1 & MaskFieldDigit): |
236 case (StMCustom3_CViewSelection1 & MaskFieldDigit): | |
521
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
520
diff
changeset
|
237 case StMCustom3_CViewSelection2: |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
520
diff
changeset
|
238 case StMCustom3_CViewSelection3: |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
520
diff
changeset
|
239 case StMCustom3_CViewSelection4: |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
520
diff
changeset
|
240 case StMCustom3_CViewSelection5: |
531 | 241 case StMCustom3_CViewSelection6: refreshFct = CustomviewDivemode_refresh; |
508 | 242 break; |
604
fb5bb04ad914
Merged menu items of viewport and motion control:
Ideenmodellierer
parents:
584
diff
changeset
|
243 case (StMCustom5_CViewPortCalib & MaskFieldDigit): |
fb5bb04ad914
Merged menu items of viewport and motion control:
Ideenmodellierer
parents:
584
diff
changeset
|
244 case StMCustom5_CViewPortLayout: |
fb5bb04ad914
Merged menu items of viewport and motion control:
Ideenmodellierer
parents:
584
diff
changeset
|
245 case StMCustom5_CViewPortAmbient: refreshFct = refresh_ViewPort; |
552
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
531
diff
changeset
|
246 break; |
508 | 247 default: /* no menu has been updated */ |
248 break; | |
249 } | |
250 | |
251 if(refreshFct != NULL) | |
252 { | |
253 uint32_t rememberPage = tMEscreen.FBStartAdress; | |
254 tMEscreen.FBStartAdress = getFrame(9); | |
255 | |
256 refreshFct(); | |
257 | |
258 GFX_SetFrameTop(tMEscreen.FBStartAdress); | |
259 releaseFrame(9,rememberPage); | |
260 } | |
38 | 261 } |
262 | |
263 void tMenuEdit_writeSettingsToFlash(void) | |
264 { | |
265 if(WriteSettings) | |
266 { | |
662 | 267 reset_SettingWarning(); |
38 | 268 GFX_logoAutoOff(); |
427 | 269 ext_flash_write_settings(0); |
38 | 270 WriteSettings = 0; |
271 } | |
272 } | |
273 | |
274 void helperLeaveMenuEditField(uint8_t idID) | |
275 { | |
276 if(ident[idID].maintype == FIELD_NUMBERS) | |
277 { | |
278 change_CLUT_entry((CLUT_MenuEditField0 + idID), CLUT_MenuEditFieldRegular); | |
279 } | |
280 } | |
281 | |
282 | |
283 void helperGotoMenuEditField(uint8_t idID) | |
284 { | |
285 /* | |
286 if(ident[idID].maintype == FIELD_NUMBERS) | |
287 { | |
288 change_CLUT_entry((CLUT_MenuEditField0 + idID), CLUT_MenuEditFieldSelected); | |
289 } | |
290 */ | |
291 set_cursorNew(idID); | |
292 // set_cursor(idID); | |
293 } | |
294 | |
295 | |
296 void exitMenuEdit_to_BackMenu(void) | |
297 { | |
298 _Bool EnterPressedBackup = EnterPressed; | |
299 | |
300 if(backmenu.pEventFunction) | |
301 { | |
302 ((void (*)(uint8_t))(backmenu.pEventFunction))(backmenu.functionParameter); | |
303 | |
304 EnterPressed = EnterPressedBackup; | |
305 // if(backmenu.line > 1) | |
306 // helperGotoMenuEditField(backmenu.line); | |
307 } | |
308 } | |
309 | |
310 | |
311 void exitMenuEdit_to_Menu_with_Menu_Update(void) | |
312 { | |
313 EnterPressed = 1; | |
314 exitMenuEdit(1); | |
315 } | |
316 | |
317 | |
318 void exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only(void) | |
319 { | |
320 EnterPressed = 1; | |
321 exitMenuEdit(0); | |
322 } | |
323 | |
324 | |
325 void exitMenuEdit_to_Home_with_Menu_Update(void) | |
326 { | |
327 EnterPressed = 1; | |
328 exitMenuEdit(1); | |
329 set_globalState_tHome(); | |
330 } | |
331 | |
332 | |
333 void exitMenuEdit_to_InfoCompassCalibration(void) | |
334 { | |
335 exitMenuEdit(1); | |
336 openInfo_Compass(); | |
337 } | |
338 | |
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
339 void exitMenuEdit_to_InfoSensor(void) |
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
340 { |
783 | 341 uint32_t globState = get_globalState(); |
342 | |
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
343 exitMenuEdit(1); |
783 | 344 switch(globState) |
345 { | |
786 | 346 case (StMHARD3_O2_Sensor3): openInfo_Sensor(2); |
783 | 347 break; |
786 | 348 case (StMHARD3_O2_Sensor2): openInfo_Sensor(1); |
783 | 349 break; |
350 default: | |
786 | 351 case (StMHARD3_O2_Sensor1): openInfo_Sensor(0); |
783 | 352 break; |
353 } | |
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
354 } |
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
355 |
38 | 356 |
357 void exitMenuEdit_to_Home(void) | |
358 { | |
359 exitMenuEdit(1); | |
360 set_globalState_tHome(); | |
361 } | |
362 | |
363 | |
364 void exitMenuEdit(uint8_t writeSettingsIfEnterPressed) | |
365 { | |
366 openMenu(0); | |
367 if(EnterPressed) | |
368 { | |
369 updateMenu(); | |
370 if((stateUsed->mode == MODE_SURFACE) && writeSettingsIfEnterPressed) | |
371 WriteSettings = 1; | |
372 } | |
373 releaseFrame(9,tMEscreen.FBStartAdress); | |
374 } | |
375 | |
376 | |
377 void exitMenuEditBackMenuOption(void) | |
378 { | |
379 if(backmenu.pEventFunction == 0) | |
380 exitMenuEdit(1); | |
381 else | |
382 exitMenuEdit_to_BackMenu(); | |
383 } | |
384 | |
385 | |
386 void startMenuEditFieldSelect(void) | |
387 { | |
388 id = 0; | |
389 helperGotoMenuEditField(id); | |
390 } | |
391 | |
392 | |
393 void nextMenuEditField(void) | |
394 { | |
395 helperLeaveMenuEditField(id); | |
396 | |
397 if(id < idLast) | |
398 id++; | |
399 else | |
400 id = 0; | |
401 helperGotoMenuEditField(id); | |
402 } | |
403 | |
404 /* | |
405 void previousMenuEditField(void) | |
406 { | |
407 helperLeaveMenuEditField(id); | |
408 if(id > 0) | |
409 id--; | |
410 else | |
411 id = idLast; | |
412 helperGotoMenuEditField(id); | |
413 } | |
414 */ | |
415 | |
416 _Bool inc_subBlock_or_block_of_actual_id(void) | |
417 { | |
418 if(event[evid].callerID != ident[id].callerID) | |
419 return 0; | |
420 | |
421 if((ident[id].subtype != FIELD_3DIGIT) && (ident[id].subtype != FIELD_2DIGIT) && ((subBlockPosition + 1) < ident[id].size[block])) | |
422 { | |
423 subBlockPosition++; | |
424 return 1; | |
425 } | |
426 | |
427 if(((block + 1) < 4) && (ident[id].size[block+1] > 0)) | |
428 { | |
429 block++; | |
430 subBlockPosition = 0; | |
431 return 1; | |
432 } | |
433 | |
434 return 0; | |
435 } | |
436 | |
437 | |
438 uint8_t get_newContent_of_actual_id_block_and_subBlock(uint8_t action) | |
439 { | |
440 uint8_t (*onActionFunc)(uint32_t, uint8_t, uint8_t, uint8_t, uint8_t); | |
441 uint8_t content; | |
442 | |
443 if(event[evid].callerID != ident[id].callerID) | |
444 return 0; | |
445 | |
446 onActionFunc = (uint8_t (*)(uint32_t, uint8_t, uint8_t, uint8_t, uint8_t))(event[evid].pEventFunction); | |
447 | |
448 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_3DIGIT)) | |
449 { | |
450 content = 100 * ( ident[id].newText[ident[id].begin[block] + 0] - '0'); | |
451 content += 10 * ( ident[id].newText[ident[id].begin[block] + 1] - '0'); | |
452 content += ident[id].newText[ident[id].begin[block] + 2]; | |
453 } | |
454 else | |
455 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_2DIGIT)) | |
456 { | |
457 content = 10 * (ident[id].newText[ident[id].begin[block] + 0] - '0'); | |
458 content += ident[id].newText[ident[id].begin[block] + 1]; | |
459 } | |
460 else | |
461 if(ident[id].maintype == FIELD_NUMBERS) | |
462 content = ident[id].newText[ident[id].begin[block] + subBlockPosition]; | |
463 else | |
584 | 464 if((ident[id].maintype == FIELD_ON_OFF) || (ident[id].maintype == FIELD_TOGGLE)) |
38 | 465 content = ident[id].input[block]; |
466 else | |
467 content = 0; /* just a default for protection */ | |
468 | |
469 return onActionFunc(ident[id].callerID, block, subBlockPosition, content, action); | |
470 } | |
471 | |
472 void mark_digit_of_actual_id_with_this_block_and_subBlock(int8_t oldblock, int8_t oldsubblockpos) | |
473 { | |
474 char oneCharText[2]; | |
475 uint16_t positionOffset; | |
476 | |
477 if(event[evid].callerID != ident[id].callerID) | |
478 return; | |
479 | |
480 if(ident[id].maintype == FIELD_NUMBERS) | |
481 { | |
482 oneCharText[0] = ident[id].newText[ident[id].begin[oldblock] + oldsubblockpos]; | |
483 oneCharText[1] = 0; | |
484 positionOffset = GFX_return_offset(ident[id].fontUsed, ident[id].newText, ident[id].begin[oldblock] + oldsubblockpos); | |
485 write_content( ident[id].coord[0] + positionOffset, ident[id].coord[1], ident[id].coord[2], ident[id].fontUsed, oneCharText, CLUT_MenuEditFieldSelected); | |
486 } | |
487 } | |
488 | |
489 | |
490 void mark_new_2digit_of_actual_id_block(void) | |
491 { | |
492 char oneCharText[3]; | |
493 uint16_t positionOffset; | |
494 | |
495 if(event[evid].callerID != ident[id].callerID) | |
496 return; | |
497 | |
498 if(ident[id].maintype == FIELD_NUMBERS) | |
499 { | |
500 oneCharText[0] = ident[id].newText[ident[id].begin[block] + 0]; | |
501 oneCharText[1] = ident[id].newText[ident[id].begin[block] + 1]; | |
502 oneCharText[2] = 0; | |
503 positionOffset = GFX_return_offset(ident[id].fontUsed, ident[id].newText, ident[id].begin[block] + 0); | |
504 write_content( ident[id].coord[0] + positionOffset, ident[id].coord[1], ident[id].coord[2], ident[id].fontUsed, oneCharText, CLUT_MenuEditDigit); | |
505 } | |
506 } | |
507 | |
508 | |
509 void mark_new_3digit_of_actual_id_block(void) | |
510 { | |
511 char oneCharText[4]; | |
512 uint16_t positionOffset; | |
513 | |
514 if(event[evid].callerID != ident[id].callerID) | |
515 return; | |
516 | |
517 if(ident[id].maintype == FIELD_NUMBERS) | |
518 { | |
519 oneCharText[0] = ident[id].newText[ident[id].begin[block] + 0]; | |
520 oneCharText[1] = ident[id].newText[ident[id].begin[block] + 1]; | |
521 oneCharText[2] = ident[id].newText[ident[id].begin[block] + 2]; | |
522 oneCharText[3] = 0; | |
523 positionOffset = GFX_return_offset(ident[id].fontUsed, ident[id].newText, ident[id].begin[block] + 0); | |
524 write_content( ident[id].coord[0] + positionOffset, ident[id].coord[1], ident[id].coord[2], ident[id].fontUsed, oneCharText, CLUT_MenuEditDigit); | |
525 } | |
526 } | |
527 | |
528 | |
529 void mark_new_digit_of_actual_id_block_and_subBlock(void) | |
530 { | |
531 char oneCharText[2]; | |
532 uint16_t positionOffset; | |
533 | |
534 if(event[evid].callerID != ident[id].callerID) | |
535 return; | |
536 | |
537 if(ident[id].maintype == FIELD_NUMBERS) | |
538 { | |
539 oneCharText[0] = ident[id].newText[ident[id].begin[block] + subBlockPosition]; | |
540 oneCharText[1] = 0; | |
541 positionOffset = GFX_return_offset(ident[id].fontUsed, ident[id].newText, ident[id].begin[block] + subBlockPosition); | |
542 write_content( ident[id].coord[0] + positionOffset, ident[id].coord[1], ident[id].coord[2], ident[id].fontUsed, oneCharText, CLUT_MenuEditDigit); | |
543 } | |
544 } | |
545 | |
546 | |
547 void enterMenuEditField(void) | |
548 { | |
549 uint8_t newContent; | |
550 uint8_t digit100; | |
551 uint8_t digit10; | |
552 uint8_t digit1; | |
553 | |
554 evid = 0; | |
555 while((evid < evidLast) && (event[evid].callerID != ident[id].callerID)) | |
556 { | |
557 evid++; | |
558 } | |
559 | |
560 if(event[evid].callerID != ident[id].callerID) | |
561 return; | |
562 | |
563 set_globalState(event[evid].callerID); | |
564 block = 0; | |
565 subBlockPosition = 0; | |
566 | |
567 if(ident[id].maintype == FIELD_NUMBERS) | |
568 { | |
569 change_CLUT_entry(CLUT_MenuEditLineSelected, CLUT_MenuEditCursor); | |
570 // old stuff? hw 150916, reactivated 150923, this shows which digit will be changed now as it marks the other grey/black | |
571 // now fixed for button settings with newContent <= '0'+99 condition | |
572 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldSelected); | |
573 } | |
584 | 574 if(ident[id].maintype == FIELD_TOGGLE) |
575 { | |
576 change_CLUT_entry(CLUT_MenuEditLineSelected, CLUT_MenuEditCursor); | |
577 } | |
578 | |
38 | 579 |
580 newContent = get_newContent_of_actual_id_block_and_subBlock(ACTION_BUTTON_ENTER); | |
581 | |
582 if (((newContent == UPDATE_DIVESETTINGS) || (newContent == UPDATE_AND_EXIT_TO_HOME) || (newContent == UPDATE_AND_EXIT_TO_MENU)) && (actual_menu_content == MENU_SURFACE)) | |
583 createDiveSettings(); | |
584 | |
585 if(newContent == EXIT_TO_MENU_WITH_LOGO) | |
586 { | |
587 GFX_logoAutoOff(); | |
588 } | |
589 | |
590 if((newContent == EXIT_TO_MENU) || (newContent == UPDATE_AND_EXIT_TO_MENU) || (newContent == EXIT_TO_MENU_WITH_LOGO)) | |
591 { | |
592 if(backmenu.pEventFunction == 0) | |
593 exitMenuEdit(1); | |
594 else | |
595 exitMenuEdit_to_BackMenu(); | |
596 return; | |
597 } | |
598 | |
599 if((newContent == EXIT_TO_HOME) || (newContent == UPDATE_AND_EXIT_TO_HOME)) | |
600 { | |
601 exitMenuEdit_to_Home(); | |
602 return; | |
603 } | |
604 | |
605 if(newContent == EXIT_TO_INFO_COMPASS) | |
606 { | |
607 exitMenuEdit_to_InfoCompassCalibration(); | |
608 return; | |
609 } | |
610 | |
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
611 if(newContent == EXIT_TO_INFO_SENSOR) |
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
612 { |
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
613 exitMenuEdit_to_InfoSensor(); |
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
614 return; |
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
615 } |
38 | 616 |
617 switch(ident[id].maintype) | |
618 { | |
619 case FIELD_NUMBERS: | |
620 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); | |
621 | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
622 switch (ident[id].subtype) { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
623 case FIELD_UDIGIT: |
38 | 624 if((newContent >= '0') && (newContent <= '9')) |
625 ident[id].newText[ident[id].begin[block] + subBlockPosition] = newContent; | |
626 | |
627 mark_new_digit_of_actual_id_block_and_subBlock(); | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
628 |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
629 break; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
630 case FIELD_3DIGIT: |
38 | 631 if((newContent >= '0') && (newContent <= '0'+200)) |
632 { | |
633 split_Content_to_Digit_helper( newContent, &digit100, &digit10, &digit1); | |
634 ident[id].newText[ident[id].begin[block] + 0] = '0' + digit100; | |
635 ident[id].newText[ident[id].begin[block] + 1] = '0' + digit10; | |
636 ident[id].newText[ident[id].begin[block] + 2] = '0' + digit1; | |
637 mark_new_3digit_of_actual_id_block(); | |
638 } | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
639 |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
640 break; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
641 case FIELD_2DIGIT: |
38 | 642 if((newContent >= '0') && (newContent <= '0'+99)) |
643 { | |
644 ident[id].newText[ident[id].begin[block]] = '0' + (newContent - '0')/10; | |
645 ident[id].newText[ident[id].begin[block] + 1] = '0' + ((newContent - '0') - (10*((newContent - '0')/10))); | |
646 mark_new_2digit_of_actual_id_block(); | |
647 } | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
648 |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
649 break; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
650 case FIELD_SDIGIT: |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
651 if ((subBlockPosition == 0 && (newContent == '+' || newContent == '-')) || (subBlockPosition > 0 && newContent >= '0' && newContent <= '9')) { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
652 ident[id].newText[ident[id].begin[block] + subBlockPosition] = newContent; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
653 } |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
654 |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
655 mark_new_digit_of_actual_id_block_and_subBlock(); |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
656 |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
657 break; |
38 | 658 } |
659 break; | |
660 case FIELD_BUTTON: | |
661 case FIELD_ON_OFF: | |
662 set_globalState(menuID); | |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
663 |
38 | 664 break; |
665 case FIELD_SYMBOL: | |
666 ident[id].input[0] += 1; | |
667 if(ident[id].input[0] >= ident[id].input[1]) | |
668 ident[id].input[0] = 0; | |
669 ident[id].newText[0] = ident[id].orgText[ident[id].input[0]]; | |
670 write_content_of_actual_Id(); | |
671 set_globalState(menuID); | |
672 break; | |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
673 case FIELD_SELECT: |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
674 write_buttonTextline(TXT2BYTE_ButtonMinus, TXT2BYTE_ButtonEnter, TXT2BYTE_ButtonPlus); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
675 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
676 break; |
38 | 677 } |
678 } | |
679 | |
680 | |
681 void exitMenuEditField(void) | |
682 { | |
683 uint8_t newContent; | |
684 | |
685 set_globalState(menuID); | |
686 | |
687 if(event[evid].callerID != ident[id].callerID) | |
688 return; | |
689 | |
690 newContent = get_newContent_of_actual_id_block_and_subBlock(ACTION_TIMEOUT); | |
691 | |
692 /* | |
693 uint8_t (*onActionFunc)(uint32_t, uint8_t, uint8_t, uint8_t, uint8_t); | |
694 uint8_t newContent; | |
695 | |
696 onActionFunc = (uint8_t (*)(uint32_t, uint8_t, uint8_t, uint8_t, uint8_t))(event[evid].pEventFunction); | |
697 | |
698 newContent = onActionFunc(ident[id].callerID, 0, 0, 255, ACTION_BUTTON_BACK); | |
699 */ | |
700 | |
701 /* destroy changes of editing in newText */ | |
702 change_CLUT_entry(CLUT_MenuEditLineSelected, CLUT_MenuLineSelected); | |
703 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldRegular); | |
704 | |
705 create_newText_for_actual_Id(); | |
706 write_content_of_actual_Id(); | |
707 | |
708 if((newContent == EXIT_TO_MENU) || (newContent == UPDATE_AND_EXIT_TO_MENU)) | |
709 { | |
710 exitMenuEdit(1); | |
711 return; | |
712 } | |
713 | |
714 if((newContent == EXIT_TO_HOME) || (newContent == UPDATE_AND_EXIT_TO_HOME)) | |
715 { | |
716 exitMenuEdit_to_Home(); | |
717 return; | |
718 } | |
719 | |
720 } | |
721 | |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
722 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
723 static void startNextEdit(void) |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
724 { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
725 EnterPressed = 1; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
726 nextMenuEditField(); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
727 enterMenuEditField(); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
728 } |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
729 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
730 |
38 | 731 void nextMenuEditFieldDigit(void) |
732 { | |
733 uint8_t action; | |
734 uint8_t newContent; | |
735 int8_t blockOld = 0; | |
736 int8_t subBlockPositionOld = 0; | |
737 | |
738 if(event[evid].callerID != ident[id].callerID) | |
739 return; | |
740 | |
741 blockOld = block; | |
742 subBlockPositionOld = subBlockPosition; | |
743 | |
744 if(inc_subBlock_or_block_of_actual_id()) | |
745 action = ACTION_BUTTON_ENTER; | |
746 else | |
747 action = ACTION_BUTTON_ENTER_FINAL; | |
748 | |
749 newContent = get_newContent_of_actual_id_block_and_subBlock(action); | |
750 | |
751 if(action == ACTION_BUTTON_ENTER_FINAL) | |
752 { | |
753 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
754 | |
755 change_CLUT_entry(CLUT_MenuEditLineSelected, CLUT_MenuLineSelected); | |
756 for(int i = 0;i<=9;i++) | |
757 change_CLUT_entry((CLUT_MenuEditField0 + i), CLUT_MenuEditFieldRegular); | |
758 | |
759 if(((newContent == UPDATE_DIVESETTINGS) || (newContent == UPDATE_AND_EXIT_TO_HOME) || (newContent == UPDATE_AND_EXIT_TO_MENU)) && (actual_menu_content == MENU_SURFACE)) | |
760 createDiveSettings(); | |
761 | |
762 if((newContent == EXIT_TO_MENU) || (newContent == UPDATE_AND_EXIT_TO_MENU)) | |
763 { | |
764 exitMenuEdit(1); | |
765 return; | |
766 } | |
767 | |
768 if((newContent == EXIT_TO_HOME) || (newContent == UPDATE_AND_EXIT_TO_HOME)) | |
769 { | |
770 exitMenuEdit_to_Home(); | |
771 return; | |
772 } | |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
773 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
774 if (newContent == EXIT_TO_NEXT_MENU) { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
775 startNextEdit(); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
776 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
777 return; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
778 } |
38 | 779 } |
780 | |
781 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_3DIGIT) && (action == ACTION_BUTTON_ENTER) &&(newContent >= '0') && (newContent <= '0' + 99)) | |
782 { | |
783 ident[id].newText[ident[id].begin[block] + 0] = '0' + (newContent - '0')/100; | |
784 ident[id].newText[ident[id].begin[block] + 1] = '0' + (newContent - '0')/10; | |
785 ident[id].newText[ident[id].begin[block] + 2] = '0' + ((newContent - '0') - (10*((newContent - '0')/10))); | |
786 } | |
787 else | |
788 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_2DIGIT) && (action == ACTION_BUTTON_ENTER) &&(newContent >= '0') && (newContent <= '0' + 99)) | |
789 { | |
790 ident[id].newText[ident[id].begin[block] + 0] = '0' + (newContent - '0')/10; | |
791 ident[id].newText[ident[id].begin[block] + 1] = '0' + ((newContent - '0') - (10*((newContent - '0')/10))); | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
792 } else if (ident[id].maintype == FIELD_NUMBERS && ident[id].subtype == FIELD_SDIGIT && action == ACTION_BUTTON_ENTER && subBlockPosition == 0) { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
793 if (newContent == '+' || newContent == '-') { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
794 ident[id].newText[ident[id].begin[block] + subBlockPosition] = newContent; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
795 } |
38 | 796 } |
797 else | |
798 if((ident[id].maintype == FIELD_NUMBERS) && (action == ACTION_BUTTON_ENTER) && (newContent >= '0') && (newContent <= '9')) | |
799 ident[id].newText[ident[id].begin[block] + subBlockPosition] = newContent; | |
800 | |
801 if(action == ACTION_BUTTON_ENTER) | |
802 { | |
803 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_3DIGIT)) | |
804 { | |
805 mark_new_3digit_of_actual_id_block(); | |
806 mark_digit_of_actual_id_with_this_block_and_subBlock(blockOld,0); | |
807 mark_digit_of_actual_id_with_this_block_and_subBlock(blockOld,1); | |
808 mark_digit_of_actual_id_with_this_block_and_subBlock(blockOld,2); | |
809 } | |
810 else | |
811 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_2DIGIT)) | |
812 { | |
813 mark_new_2digit_of_actual_id_block(); | |
814 mark_digit_of_actual_id_with_this_block_and_subBlock(blockOld,0); | |
815 mark_digit_of_actual_id_with_this_block_and_subBlock(blockOld,1); | |
816 } | |
817 else | |
818 { | |
819 mark_new_digit_of_actual_id_block_and_subBlock(); | |
820 mark_digit_of_actual_id_with_this_block_and_subBlock(blockOld,subBlockPositionOld); | |
821 } | |
822 } | |
823 else /* action == ACTION_BUTTON_ENTER_FINAL */ | |
824 set_globalState(menuID); | |
825 } | |
826 | |
827 uint8_t split_Content_to_Digit_helper(uint8_t inContentAscii, uint8_t *outDigit100, uint8_t *outDigit10, uint8_t *outDigit1) | |
828 { | |
829 uint8_t newContent, tempDigit, CopyContent; | |
830 | |
831 newContent = inContentAscii - '0'; | |
832 CopyContent = newContent; | |
833 | |
834 tempDigit = newContent / 100; | |
835 newContent -= tempDigit * 100; | |
836 if(outDigit100) | |
837 *outDigit100 = tempDigit; | |
838 | |
839 tempDigit = newContent / 10; | |
840 newContent -= tempDigit * 10; | |
841 if(outDigit10) | |
842 *outDigit10 = tempDigit; | |
843 | |
844 tempDigit = newContent; | |
845 if(outDigit1) | |
846 *outDigit1 = tempDigit; | |
847 | |
848 return CopyContent; | |
849 } | |
850 | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
851 |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
852 static void checkUpdateSDigit(uint8_t newContent) |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
853 { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
854 if ((subBlockPosition == 0 && (newContent == '+' || newContent == '-')) || (subBlockPosition > 0 && newContent >= '0' && newContent <= '9')) { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
855 ident[id].newText[ident[id].begin[block] + subBlockPosition] = newContent; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
856 } |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
857 } |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
858 |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
859 |
38 | 860 void upMenuEditFieldDigit(void) |
861 { | |
862 uint8_t newContent; | |
863 uint8_t digit100; | |
864 uint8_t digit10; | |
865 uint8_t digit1; | |
866 | |
867 if(event[evid].callerID != ident[id].callerID) | |
868 return; | |
869 | |
870 newContent = get_newContent_of_actual_id_block_and_subBlock(ACTION_BUTTON_NEXT); | |
871 | |
872 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_3DIGIT) &&(newContent >= '0') && (newContent <= '0' + 200)) | |
873 { | |
874 split_Content_to_Digit_helper( newContent, &digit100, &digit10, &digit1); | |
875 ident[id].newText[ident[id].begin[block] + 0] = '0' + digit100; | |
876 ident[id].newText[ident[id].begin[block] + 1] = '0' + digit10; | |
877 ident[id].newText[ident[id].begin[block] + 2] = '0' + digit1; | |
878 mark_new_3digit_of_actual_id_block(); | |
879 return; | |
880 } | |
881 | |
882 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_2DIGIT) &&(newContent >= '0') && (newContent <= '0' + 99)) | |
883 { | |
884 ident[id].newText[ident[id].begin[block] + 0] = '0' + (newContent - '0')/10; | |
885 ident[id].newText[ident[id].begin[block] + 1] = '0' + ((newContent - '0') - (10*((newContent - '0')/10))); | |
886 mark_new_2digit_of_actual_id_block(); | |
887 return; | |
888 } | |
889 | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
890 if (ident[id].maintype == FIELD_NUMBERS && ident[id].subtype == FIELD_SDIGIT) { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
891 checkUpdateSDigit(newContent); |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
892 } else if (ident[id].maintype == FIELD_NUMBERS && newContent >= '0' && newContent <= '9') { |
38 | 893 ident[id].newText[ident[id].begin[block] + subBlockPosition] = newContent; |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
894 } |
38 | 895 |
896 mark_new_digit_of_actual_id_block_and_subBlock(); | |
897 } | |
898 | |
899 | |
900 void downMenuEditFieldDigit(void) | |
901 { | |
902 uint8_t newContent; | |
903 uint8_t digit100; | |
904 uint8_t digit10; | |
905 uint8_t digit1; | |
906 | |
907 if(event[evid].callerID != ident[id].callerID) | |
908 return; | |
909 | |
910 newContent = get_newContent_of_actual_id_block_and_subBlock(ACTION_BUTTON_BACK); | |
911 | |
912 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_3DIGIT) &&(newContent >= '0') && (newContent <= '0' + 200)) | |
913 { | |
914 split_Content_to_Digit_helper( newContent, &digit100, &digit10, &digit1); | |
915 ident[id].newText[ident[id].begin[block] + 0] = '0' + digit100; | |
916 ident[id].newText[ident[id].begin[block] + 1] = '0' + digit10; | |
917 ident[id].newText[ident[id].begin[block] + 2] = '0' + digit1; | |
918 mark_new_3digit_of_actual_id_block(); | |
919 return; | |
920 } | |
921 | |
922 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_2DIGIT) &&(newContent >= '0') && (newContent <= '0' + 99)) | |
923 { | |
924 ident[id].newText[ident[id].begin[block] + 0] = '0' + (newContent - '0')/10; | |
925 ident[id].newText[ident[id].begin[block] + 1] = '0' + ((newContent - '0') - (10*((newContent - '0')/10))); | |
926 mark_new_2digit_of_actual_id_block(); | |
927 return; | |
928 } | |
929 | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
930 if (ident[id].maintype == FIELD_NUMBERS && ident[id].subtype == FIELD_SDIGIT) { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
931 checkUpdateSDigit(newContent); |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
932 } else if (ident[id].maintype == FIELD_NUMBERS && newContent >= '0' && newContent <= '9') { |
38 | 933 ident[id].newText[ident[id].begin[block] + subBlockPosition] = newContent; |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
934 } |
38 | 935 |
936 mark_new_digit_of_actual_id_block_and_subBlock(); | |
937 } | |
938 | |
939 | |
940 void evaluateNewString(uint32_t editID, uint32_t *pNewValue1, uint32_t *pNewValue2, uint32_t *pNewValue3, uint32_t *pNewValue4) | |
941 { | |
942 if(editID != ident[id].callerID) | |
943 return; | |
944 | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
945 bool isSigned = ident[id].maintype == FIELD_NUMBERS && ident[id].subtype == FIELD_SDIGIT; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
946 |
38 | 947 uint8_t i, digitCount, digit; |
948 uint32_t sum[4], multiplier; | |
949 | |
950 for(i=0;i<4;i++) | |
951 sum[i] = 0; | |
952 | |
953 i = 0; | |
954 while( ident[id].size[i] && (i < 4)) | |
955 { | |
956 multiplier = 1; | |
957 for(digitCount = 1; digitCount < ident[id].size[i]; digitCount++) | |
958 multiplier *= 10; | |
959 | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
960 bool isNegative = false; |
38 | 961 for(digitCount = 0; digitCount < ident[id].size[i]; digitCount++) |
962 { | |
963 digit = ident[id].newText[ident[id].begin[i] + digitCount]; | |
964 | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
965 if (isSigned && digitCount == 0) { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
966 if (digit == '-') { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
967 isNegative = true; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
968 } |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
969 } else { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
970 if(digit > '0') |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
971 digit -= '0'; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
972 else |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
973 digit = 0; |
38 | 974 |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
975 if(digit > 9) |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
976 digit = 9; |
38 | 977 |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
978 sum[i] += digit * multiplier; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
979 } |
38 | 980 |
981 if(multiplier >= 10) | |
982 multiplier /= 10; | |
983 else | |
984 multiplier = 0; | |
985 } | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
986 |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
987 if (isSigned) { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
988 int32_t value = sum[i]; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
989 if (isNegative) { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
990 value = -value; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
991 } |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
992 sum[i] = ((input_u)value).uint32; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
993 } |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
994 |
38 | 995 i++; |
996 } | |
997 | |
998 *pNewValue1 = sum[0]; | |
999 *pNewValue2 = sum[1]; | |
1000 *pNewValue3 = sum[2]; | |
1001 *pNewValue4 = sum[3]; | |
1002 } | |
1003 | |
1004 | |
1005 uint8_t get_id_of(uint32_t editID) | |
1006 { | |
1007 uint8_t temp_id; | |
1008 | |
1009 if(editID == ident[id].callerID) | |
1010 return id; | |
1011 else | |
1012 { | |
1013 temp_id = 0; | |
1014 while((temp_id < 9) && (editID != ident[temp_id].callerID)) | |
1015 temp_id++; | |
1016 if(editID != ident[temp_id].callerID) | |
1017 temp_id = 255; | |
1018 return temp_id; | |
1019 } | |
1020 } | |
1021 | |
1022 | |
1023 void tMenuEdit_newButtonText(uint32_t editID, char *text) | |
1024 { | |
1025 uint8_t backup_id, temp_id; | |
1026 | |
1027 temp_id = get_id_of(editID); | |
1028 if(temp_id == 255) | |
1029 return; | |
1030 | |
1031 backup_id = id; | |
1032 id = temp_id; | |
1033 | |
1034 strncpy(ident[id].newText, text, 32); | |
1035 ident[id].newText[31] = 0; | |
1036 | |
1037 clean_content_of_actual_Id(); | |
1038 write_content_of_actual_Id(); | |
1039 | |
1040 id = backup_id; | |
1041 } | |
1042 | |
1043 | |
1044 void tMenuEdit_set_on_off(uint32_t editID, uint32_t int1) | |
1045 { | |
1046 uint8_t backup_id, temp_id; | |
1047 | |
1048 temp_id = get_id_of(editID); | |
1049 if(temp_id == 255) | |
1050 return; | |
1051 | |
1052 backup_id = id; | |
1053 id = temp_id; | |
1054 | |
1055 ident[id].input[0] = int1; | |
1056 | |
1057 if(int1) | |
1058 ident[id].newText[0] = '\005'; | |
1059 else | |
1060 ident[id].newText[0] = '\006'; | |
1061 | |
1062 clean_content_of_actual_Id(); | |
1063 write_content_of_actual_Id(); | |
1064 | |
1065 id = backup_id; | |
1066 } | |
1067 | |
508 | 1068 void tMenuEdit_select(uint32_t editID) |
1069 { | |
1070 uint8_t id_local = 0; | |
1071 id_local = get_id_of(editID); | |
38 | 1072 |
508 | 1073 if(id_local <= idLast) |
1074 { | |
1075 id = id_local; | |
1076 set_cursorNew(id); | |
1077 } | |
1078 } | |
1079 | |
1080 #if OLD_SELECTION | |
38 | 1081 void tMenuEdit_select(uint32_t editID, uint32_t int1, uint32_t int2, uint32_t int3, uint32_t int4) |
1082 { | |
1083 if(int1 > 4) | |
1084 return; | |
1085 | |
1086 uint8_t backup_id, temp_id; | |
1087 | |
1088 temp_id = get_id_of(editID); | |
1089 if(temp_id == 255) | |
1090 return; | |
1091 | |
1092 backup_id = id; | |
1093 id = temp_id; | |
1094 | |
1095 ident[id].input[0] = int1; | |
1096 ident[id].input[1] = int1; | |
1097 ident[id].input[2] = int1; | |
1098 ident[id].input[3] = int1; | |
1099 | |
1100 create_newText_for_actual_Id(); | |
1101 clean_content_of_actual_Id(); | |
1102 write_content_of_actual_Id(); | |
1103 | |
1104 id = backup_id; | |
1105 } | |
508 | 1106 #endif |
38 | 1107 |
1108 | |
1109 void tMenuEdit_newInput(uint32_t editID, uint32_t int1, uint32_t int2, uint32_t int3, uint32_t int4) | |
1110 { | |
1111 uint8_t backup_id, temp_id; | |
1112 | |
1113 temp_id = get_id_of(editID); | |
1114 if(temp_id == 255) | |
1115 return; | |
1116 | |
1117 backup_id = id; | |
1118 id = temp_id; | |
1119 | |
1120 if(editID != ident[id].callerID) | |
1121 { | |
1122 temp_id = 0; | |
1123 while((temp_id < 9) && (editID != ident[temp_id].callerID)) | |
1124 temp_id++; | |
1125 if(editID != ident[temp_id].callerID) | |
1126 return; | |
1127 id = temp_id; | |
1128 } | |
1129 ident[id].input[0] = int1; | |
1130 ident[id].input[1] = int2; | |
1131 ident[id].input[2] = int3; | |
1132 ident[id].input[3] = int4; | |
1133 | |
1134 create_newText_for_actual_Id(); | |
1135 if(id <= idLast) | |
1136 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldRegular); | |
1137 write_content_of_actual_Id(); | |
1138 | |
1139 id = backup_id; | |
1140 } | |
1141 | |
1142 | |
1143 void resetEnterPressedToStateBeforeButtonAction(void) | |
1144 { | |
1145 EnterPressed = EnterPressedBeforeButtonAction; | |
1146 } | |
1147 | |
1148 | |
1149 void sendActionToMenuEdit(uint8_t sendAction) | |
1150 { | |
1151 if(get_globalState() == menuID) | |
1152 { | |
1153 switch(sendAction) | |
1154 { | |
1155 case ACTION_BUTTON_ENTER: | |
1156 EnterPressedBeforeButtonAction = EnterPressed; | |
1157 EnterPressed = 1; | |
1158 enterMenuEditField(); | |
1159 break; | |
1160 case ACTION_BUTTON_NEXT: | |
1161 nextMenuEditField(); | |
1162 // previousMenuEditField(); | |
1163 break; | |
1164 case ACTION_BUTTON_BACK: | |
1165 exitMenuEditBackMenuOption(); | |
1166 break; | |
1167 case ACTION_TIMEOUT: | |
1168 case ACTION_MODE_CHANGE: | |
1169 exitMenuEdit(1); | |
1170 break; | |
1171 case ACTION_IDLE_TICK: | |
1172 case ACTION_IDLE_SECOND: | |
219 | 1173 default: |
38 | 1174 break; |
219 | 1175 |
38 | 1176 } |
1177 } | |
1178 else | |
1179 if(get_globalState() == event[evid].callerID) | |
1180 { | |
1181 switch(sendAction) | |
1182 { | |
1183 case ACTION_BUTTON_ENTER: | |
1184 nextMenuEditFieldDigit(); | |
1185 break; | |
1186 case ACTION_BUTTON_NEXT: | |
1187 upMenuEditFieldDigit(); | |
1188 break; | |
1189 case ACTION_BUTTON_BACK: | |
1190 downMenuEditFieldDigit(); | |
1191 break; | |
1192 case ACTION_TIMEOUT: | |
1193 case ACTION_MODE_CHANGE: | |
1194 exitMenuEditField(); | |
1195 break; | |
1196 case ACTION_IDLE_TICK: | |
1197 case ACTION_IDLE_SECOND: | |
1198 break; | |
219 | 1199 default: |
1200 break; | |
38 | 1201 } |
1202 } | |
1203 else | |
1204 { | |
1205 switch(sendAction) | |
1206 { | |
1207 case ACTION_BUTTON_ENTER: | |
1208 break; | |
1209 case ACTION_BUTTON_NEXT: | |
1210 break; | |
1211 case ACTION_BUTTON_BACK: | |
1212 break; | |
1213 case ACTION_TIMEOUT: | |
1214 case ACTION_MODE_CHANGE: | |
1215 exitMenuEdit(1); | |
1216 break; | |
1217 case ACTION_IDLE_TICK: | |
1218 case ACTION_IDLE_SECOND: | |
1219 break; | |
219 | 1220 default: |
1221 break; | |
38 | 1222 } |
1223 } | |
1224 } | |
1225 | |
1226 | |
1227 void create_newText_for_actual_Id_and_field_select(void) | |
1228 { | |
1229 uint8_t i; | |
1230 | |
1231 i = 0; | |
1232 while( ident[id].size[i] && (i < 4)) | |
1233 { | |
1234 if(ident[id].input[i]) | |
1235 ident[id].newText[ident[id].begin[i]] = '\005'; | |
1236 else | |
1237 ident[id].newText[ident[id].begin[i]] = '\006'; | |
1238 i++; | |
1239 } | |
1240 } | |
1241 | |
1242 | |
1243 void create_newText_for_actual_Id(void) | |
1244 { | |
1245 if( ident[id].maintype == FIELD_SELECT) | |
1246 { | |
1247 create_newText_for_actual_Id_and_field_select(); | |
1248 return; | |
1249 } | |
1250 | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1251 bool isSigned = ident[id].maintype == FIELD_NUMBERS && ident[id].subtype == FIELD_SDIGIT; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1252 |
38 | 1253 uint8_t i, digitCount; |
1254 uint32_t remainder, digit, divider; | |
1255 | |
1256 i = 0; | |
1257 while( ident[id].size[i] && (i < 4)) | |
1258 { | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1259 bool isNegative = false; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1260 if (isSigned) { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1261 int32_t value = ((input_u)ident[id].input[i]).int32; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1262 if (value < 0) { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1263 isNegative = true; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1264 } |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1265 remainder = abs(value); |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1266 } else { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1267 remainder = ident[id].input[i]; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1268 } |
38 | 1269 divider = 1; |
1270 | |
1271 for(digitCount = 1; digitCount < ident[id].size[i]; digitCount++) | |
1272 divider *= 10; | |
1273 | |
1274 for(digitCount = 0; digitCount < ident[id].size[i]; digitCount++) | |
1275 { | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1276 if (isSigned && digitCount == 0) { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1277 ident[id].newText[ident[id].begin[i] + digitCount] = isNegative ? '-' : '+'; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1278 } else { |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1279 digit = remainder / divider; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1280 remainder -= digit * divider; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1281 if(digit < 10) |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1282 ident[id].newText[ident[id].begin[i] + digitCount] = digit + '0'; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1283 else |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1284 ident[id].newText[ident[id].begin[i] + digitCount] = 'x'; |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1285 } |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1286 |
38 | 1287 divider /= 10; |
1288 } | |
1289 i++; | |
1290 } | |
1291 } | |
1292 | |
1293 | |
1294 void write_content_without_Id(void) | |
1295 { | |
1296 write_content( ident[id].coord[0], ident[id].coord[1], ident[id].coord[2], ident[id].fontUsed, ident[id].newText, CLUT_MenuEditFieldRegular); | |
1297 } | |
1298 | |
1299 | |
1300 void write_content_of_actual_Id(void) | |
1301 { | |
1302 write_content( ident[id].coord[0], ident[id].coord[1], ident[id].coord[2], ident[id].fontUsed, ident[id].newText, (CLUT_MenuEditField0 + id)); | |
1303 } | |
1304 | |
1305 | |
1306 void clean_content_of_actual_Id(void) | |
1307 { | |
1308 clean_content( ident[id].coord[0], ident[id].coord[1], ident[id].coord[2], ident[id].fontUsed); | |
1309 } | |
1310 | |
1311 | |
1312 void write_field_udigit_and_2digit(uint8_t subtype, uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint32_t int1, uint32_t int2, uint32_t int3, uint32_t int4) | |
1313 { | |
1314 if(id >= 9) | |
1315 return; | |
1316 | |
1317 ident[id].maintype = FIELD_NUMBERS; | |
1318 ident[id].subtype = subtype; | |
1319 | |
1320 ident[id].coord[0] = XleftGimpStyle; | |
1321 ident[id].coord[1] = XrightGimpStyle; | |
1322 ident[id].coord[2] = YtopGimpStyle; | |
1323 ident[id].fontUsed = (tFont *)Font; | |
1324 ident[id].callerID = editID; | |
1325 | |
1326 strncpy(ident[id].orgText, text, 32); | |
1327 strncpy(ident[id].newText, text, 32); | |
1328 ident[id].orgText[31] = 0; | |
1329 ident[id].newText[31] = 0; | |
1330 | |
1331 /* uint32_t has max 10 digits */ | |
1332 | |
1333 int8_t beginTmp, sizeTmp; | |
1334 uint8_t i; | |
1335 | |
1336 ident[id].input[0] = int1; | |
1337 ident[id].input[1] = int2; | |
1338 ident[id].input[2] = int3; | |
1339 ident[id].input[3] = int4; | |
1340 | |
1341 for(i=0;i<4;i++) | |
1342 ident[id].size[i] = 0; | |
1343 | |
1344 beginTmp = 0; | |
1345 for(i=0;i<4;i++) | |
1346 { | |
1347 while((ident[id].orgText[beginTmp] != '#')&& ident[id].orgText[beginTmp]) | |
1348 beginTmp++; | |
1349 | |
1350 if(ident[id].orgText[beginTmp] == '#') | |
1351 { | |
1352 sizeTmp = 1; | |
1353 while(ident[id].orgText[beginTmp + sizeTmp] == '#') | |
1354 sizeTmp++; | |
1355 | |
1356 ident[id].begin[i] = beginTmp; | |
1357 ident[id].size[i] = sizeTmp; | |
1358 beginTmp = ident[id].begin[i] + ident[id].size[i]; | |
1359 } | |
1360 else | |
1361 break; | |
1362 } | |
1363 | |
1364 if(!tME_stop) | |
1365 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldRegular); | |
1366 else | |
1367 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditInfo); | |
1368 | |
1369 create_newText_for_actual_Id(); | |
1370 | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
1371 if(editID == 0) |
38 | 1372 write_content_without_Id(); |
1373 else | |
1374 { | |
1375 write_content_of_actual_Id(); | |
1376 if(!tME_stop) | |
1377 idLast = id; | |
1378 id++; | |
1379 } | |
1380 } | |
1381 | |
1382 void write_field_udigit(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint32_t int1, uint32_t int2, uint32_t int3, uint32_t int4) | |
1383 { | |
1384 write_field_udigit_and_2digit(FIELD_UDIGIT, editID,XleftGimpStyle,XrightGimpStyle,YtopGimpStyle,Font,text,int1,int2,int3,int4); | |
1385 } | |
1386 | |
1387 void write_field_2digit(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint32_t int1, uint32_t int2, uint32_t int3, uint32_t int4) | |
1388 { | |
1389 write_field_udigit_and_2digit(FIELD_2DIGIT, editID,XleftGimpStyle,XrightGimpStyle,YtopGimpStyle,Font,text,int1,int2,int3,int4); | |
1390 } | |
1391 | |
1392 void write_field_3digit(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint32_t int1, uint32_t int2, uint32_t int3, uint32_t int4) | |
1393 { | |
1394 write_field_udigit_and_2digit(FIELD_3DIGIT, editID,XleftGimpStyle,XrightGimpStyle,YtopGimpStyle,Font,text,int1,int2,int3,int4); | |
1395 } | |
1396 | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1397 |
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1398 void write_field_sdigit(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, int32_t int1, int32_t int2, int32_t int3, int32_t int4) |
38 | 1399 { |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1400 write_field_udigit_and_2digit(FIELD_SDIGIT, editID, XleftGimpStyle, XrightGimpStyle, YtopGimpStyle, Font, text, ((input_u)int1).uint32, ((input_u)int2).uint32, ((input_u)int3).uint32, ((input_u)int4).uint32); |
38 | 1401 } |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
1402 |
38 | 1403 |
1404 void write_field_select(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint8_t int1, uint8_t int2, uint8_t int3, uint8_t int4) | |
1405 { | |
1406 if(id >= 9) | |
1407 return; | |
1408 | |
1409 int8_t beginTmp; | |
1410 | |
1411 ident[id].maintype = FIELD_SELECT; | |
1412 ident[id].subtype = FIELD_SELECT; | |
1413 | |
1414 ident[id].coord[0] = XleftGimpStyle; | |
1415 ident[id].coord[1] = XrightGimpStyle; | |
1416 ident[id].coord[2] = YtopGimpStyle; | |
1417 ident[id].fontUsed = (tFont *)Font; | |
1418 ident[id].callerID = editID; | |
1419 | |
1420 strncpy(ident[id].orgText, text, 32); | |
1421 strncpy(ident[id].newText, text, 32); | |
1422 ident[id].orgText[31] = 0; | |
1423 ident[id].newText[31] = 0; | |
1424 | |
1425 ident[id].input[0] = int1; | |
1426 ident[id].input[1] = int2; | |
1427 ident[id].input[2] = int3; | |
1428 ident[id].input[3] = int4; | |
1429 | |
1430 for(int i=0;i<4;i++) | |
1431 ident[id].size[i] = 0; | |
1432 | |
1433 beginTmp = 0; | |
1434 for(int i=0;i<4;i++) | |
1435 { | |
1436 while((ident[id].orgText[beginTmp] != '#')&& ident[id].orgText[beginTmp]) | |
1437 beginTmp++; | |
1438 | |
1439 if(ident[id].orgText[beginTmp] == '#') | |
1440 { | |
1441 | |
1442 ident[id].begin[i] = beginTmp; | |
1443 ident[id].size[i] = 1; | |
1444 beginTmp = ident[id].begin[i] + ident[id].size[i]; | |
1445 } | |
1446 else | |
1447 break; | |
1448 } | |
1449 | |
1450 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldRegular); | |
1451 | |
1452 create_newText_for_actual_Id(); | |
1453 | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
1454 if(editID == 0) |
38 | 1455 write_content_without_Id(); |
1456 else | |
1457 { | |
1458 write_content_of_actual_Id(); | |
1459 if(!tME_stop) | |
1460 idLast = id; | |
1461 id++; | |
1462 } | |
1463 } | |
1464 | |
1465 void write_field_button(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text) | |
1466 { | |
1467 if(id >= 9) | |
1468 return; | |
1469 | |
1470 ident[id].maintype = FIELD_BUTTON; | |
1471 ident[id].subtype = FIELD_BUTTON; | |
1472 | |
1473 ident[id].coord[0] = XleftGimpStyle; | |
1474 ident[id].coord[1] = XrightGimpStyle; | |
1475 ident[id].coord[2] = YtopGimpStyle; | |
1476 ident[id].fontUsed = (tFont *)Font; | |
1477 ident[id].callerID = editID; | |
1478 | |
1479 strncpy(ident[id].orgText, text, 32); | |
1480 strncpy(ident[id].newText, text, 32); | |
1481 ident[id].orgText[31] = 0; | |
1482 ident[id].newText[31] = 0; | |
1483 | |
1484 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditButtonColor1); | |
1485 | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
1486 if(editID == 0) |
38 | 1487 write_content_without_Id(); |
1488 else | |
1489 { | |
1490 write_content_of_actual_Id(); | |
1491 if(!tME_stop) | |
1492 idLast = id; | |
1493 id++; | |
1494 } | |
1495 } | |
1496 | |
1497 | |
1498 void write_field_symbol(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint8_t int1) | |
1499 { | |
1500 if(id >= 9) | |
1501 return; | |
1502 | |
1503 ident[id].maintype = FIELD_SYMBOL; | |
1504 ident[id].subtype = FIELD_SYMBOL; | |
1505 | |
1506 ident[id].coord[0] = XleftGimpStyle; | |
1507 ident[id].coord[1] = XrightGimpStyle; | |
1508 ident[id].coord[2] = YtopGimpStyle; | |
1509 ident[id].fontUsed = (tFont *)Font; | |
1510 ident[id].callerID = editID; | |
1511 | |
1512 strncpy(ident[id].orgText, text, 32); | |
1513 strncpy(ident[id].newText, text, 32); | |
1514 ident[id].orgText[31] = 0; | |
1515 | |
1516 ident[id].newText[0] = text[0]; | |
1517 ident[id].newText[1] = 0; | |
1518 | |
1519 ident[id].input[0] = int1; | |
1520 ident[id].input[1] = strlen(ident[id].orgText); | |
1521 | |
1522 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditButtonColor1); | |
1523 | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
1524 if(editID == 0) |
38 | 1525 write_content_without_Id(); |
1526 else | |
1527 { | |
1528 write_content_of_actual_Id(); | |
1529 if(!tME_stop) | |
1530 idLast = id; | |
1531 id++; | |
1532 } | |
1533 } | |
584 | 1534 void write_field_toggle(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint8_t int1, uint8_t int2) |
1535 { | |
1536 if(id >= 9) return; | |
1537 ident[id].maintype = FIELD_TOGGLE; | |
1538 ident[id].subtype = FIELD_TOGGLE; | |
1539 ident[id].coord[0] = XleftGimpStyle; | |
1540 ident[id].coord[1] = XrightGimpStyle; | |
1541 ident[id].coord[2] = YtopGimpStyle; | |
1542 ident[id].fontUsed = (tFont *)Font; | |
1543 ident[id].callerID = editID; | |
1544 strncpy(ident[id].orgText, text, 32); | |
1545 strncpy(ident[id].newText, text, 32); | |
1546 ident[id].orgText[31] = 0; | |
1547 ident[id].newText[31] = 0; | |
1548 | |
1549 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditButtonColor1); | |
1550 | |
1551 if(editID == 0) write_content_without_Id(); | |
1552 else | |
1553 { | |
1554 write_content_of_actual_Id(); | |
1555 if(!tME_stop) idLast = id; | |
1556 id++; | |
1557 } | |
1558 } | |
1559 | |
38 | 1560 |
1561 | |
1562 /* was build for field_on_off | |
1563 * to be tested for other purposes first | |
1564 */ | |
1565 void tMenuEdit_refresh_field(uint32_t editID) | |
1566 { | |
1567 uint8_t temp_id; | |
1568 | |
1569 temp_id = get_id_of(editID); | |
1570 if(temp_id == 255) | |
1571 return; | |
1572 | |
1573 clean_content( ident[temp_id].coord[0], ident[temp_id].coord[1], ident[temp_id].coord[2], ident[temp_id].fontUsed); | |
1574 write_content( ident[temp_id].coord[0], ident[temp_id].coord[1], ident[temp_id].coord[2], ident[temp_id].fontUsed, ident[temp_id].newText, (CLUT_MenuEditField0 + temp_id)); | |
1575 } | |
1576 | |
1577 | |
1578 void write_field_on_off(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint8_t int1) | |
1579 { | |
1580 if(id >= 9) | |
1581 return; | |
1582 | |
1583 ident[id].maintype = FIELD_ON_OFF; | |
1584 ident[id].subtype = FIELD_ON_OFF; | |
1585 | |
1586 ident[id].coord[0] = XleftGimpStyle; | |
1587 ident[id].coord[1] = XrightGimpStyle; | |
1588 ident[id].coord[2] = YtopGimpStyle; | |
1589 ident[id].fontUsed = (tFont *)Font; | |
1590 ident[id].callerID = editID; | |
1591 | |
1592 if(int1) | |
1593 ident[id].orgText[0] = '\005'; | |
1594 else | |
1595 ident[id].orgText[0] = '\006'; | |
1596 | |
1597 ident[id].orgText[1] = ' '; | |
1598 | |
1599 strncpy(&ident[id].orgText[2], text, 30); | |
1600 strncpy(ident[id].newText, ident[id].orgText, 32); | |
1601 ident[id].orgText[31] = 0; | |
1602 ident[id].newText[31] = 0; | |
1603 | |
1604 if(!tME_stop) | |
1605 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldRegular); | |
1606 else | |
1607 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditInfo); | |
1608 | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
1609 if(editID == 0) |
38 | 1610 write_content_without_Id(); |
1611 else | |
1612 { | |
1613 write_content_of_actual_Id(); | |
1614 if(!tME_stop) | |
1615 idLast = id; | |
1616 id++; | |
1617 } | |
1618 } | |
1619 | |
1620 | |
1621 void write_field_fpoint(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, float input) | |
1622 { | |
1623 if(id >= 9) | |
1624 return; | |
1625 | |
1626 ident[id].maintype = FIELD_NUMBERS; | |
1627 ident[id].subtype = FIELD_FLOAT; | |
1628 | |
1629 ident[id].coord[0] = XleftGimpStyle; | |
1630 ident[id].coord[1] = XrightGimpStyle; | |
1631 ident[id].coord[2] = YtopGimpStyle; | |
1632 ident[id].fontUsed = (tFont *)Font; | |
1633 ident[id].callerID = editID; | |
1634 | |
1635 strncpy(ident[id].orgText, text, 32); | |
1636 strncpy(ident[id].newText, text, 32); | |
1637 ident[id].orgText[31] = 0; | |
1638 ident[id].newText[31] = 0; | |
1639 | |
1640 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldRegular); | |
1641 | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
1642 if(editID == 0) |
38 | 1643 write_content_without_Id(); |
1644 else | |
1645 { | |
1646 write_content_of_actual_Id(); | |
1647 if(!tME_stop) | |
1648 idLast = id; | |
1649 id++; | |
1650 } | |
1651 } | |
1652 | |
1653 | |
1654 void setBackMenu(uint32_t inputFunctionCall, uint8_t functionCallParameter, uint8_t gotoMenuEditField) | |
1655 { | |
1656 backmenu.pEventFunction = inputFunctionCall; | |
1657 backmenu.functionParameter = functionCallParameter; | |
1658 backmenu.line = gotoMenuEditField; | |
1659 } | |
1660 | |
1661 | |
1662 void setEvent(uint32_t inputEventID, uint32_t inputFunctionCall) | |
1663 { | |
1664 if(evidLast >= 9) | |
1665 return; | |
1666 | |
1667 /* set cursor to first field */ | |
1668 if(evidLast < 0) | |
1669 { | |
1670 startMenuEditFieldSelect(); | |
1671 } | |
1672 | |
1673 event[evid].callerID = inputEventID; | |
1674 event[evid].pEventFunction = inputFunctionCall; | |
1675 | |
1676 evidLast = evid; | |
1677 evid++; | |
1678 } | |
1679 | |
1680 void startEdit(void) | |
1681 { | |
1682 EnterPressed = 1; | |
1683 helperGotoMenuEditField(0); | |
1684 enterMenuEditField(); | |
1685 } | |
1686 | |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
786
diff
changeset
|
1687 |
38 | 1688 void exitEditWithUpdate(void) |
1689 { | |
1690 createDiveSettings(); | |
1691 EnterPressed = 1; | |
1692 exitMenuEdit(1); | |
1693 } | |
1694 | |
1695 /* | |
1696 void set_cursor(uint8_t forThisIdentID) | |
1697 { | |
1698 int16_t x0, x1, y0, y1; | |
1699 | |
1700 uint32_t xtra_left_right = 10; | |
1701 uint32_t xtra_top_bottom = 10; | |
1702 | |
1703 // y geht von 0 bis 799 | |
1704 // x geht von 0 bis 479 | |
1705 | |
1706 x0 = (int16_t)ident[forThisIdentID].coord[0]; | |
1707 x1 = (int16_t)ident[forThisIdentID].coord[1]; | |
1708 y0 = (int16_t)ident[forThisIdentID].coord[2]; | |
1709 y1 = y0 + (int16_t)ident[forThisIdentID].fontUsed->height; | |
1710 | |
1711 if(((int16_t)ident[forThisIdentID].fontUsed->height) > 70) | |
1712 { | |
1713 xtra_left_right = 10; | |
1714 xtra_top_bottom = 10; | |
1715 } | |
1716 else | |
1717 { | |
1718 xtra_left_right = 10; | |
1719 xtra_top_bottom = 0; | |
1720 } | |
1721 | |
1722 x0 -= xtra_left_right; | |
1723 x1 += xtra_left_right; | |
1724 y0 -= xtra_top_bottom; | |
1725 y1 += xtra_top_bottom; | |
1726 | |
1727 GFX_SetWindowLayer0(tMEcursor.FBStartAdress, x0, x1, y0, y1); | |
1728 } | |
1729 */ | |
1730 | |
1731 void set_cursorNew(uint8_t forThisIdentID) | |
1732 { | |
1733 int16_t y0; | |
1734 uint8_t lineMinusOne; | |
1735 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1736 if(!settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1737 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1738 y0 = (int16_t)ident[forThisIdentID].coord[2]; |
117 | 1739 y0 -= ME_Y_LINE1; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1740 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1741 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1742 { |
117 | 1743 y0 = 390 + 25 - (int16_t)ident[forThisIdentID].coord[2]; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1744 } |
117 | 1745 |
38 | 1746 y0 /= ME_Y_LINE_STEP; |
117 | 1747 if((y0 >= 0) && (y0 <=6)) |
38 | 1748 lineMinusOne = y0; |
1749 else | |
1750 lineMinusOne = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1751 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1752 if(!settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1753 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1754 GFX_SetFrameBottom((tMEcursorNew.FBStartAdress) + 65*2*(lineMinusOne), 0, 25, 800, 390); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1755 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1756 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1757 { |
117 | 1758 GFX_SetFrameBottom((tMEcursorNew.FBStartAdress)+ (390 - 65 *(6-lineMinusOne)) *2, 0, 480-390-25, 800, 390); |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1759 } |
38 | 1760 } |
1761 | |
1762 | |
1763 void write_topline( char *text) | |
1764 { | |
1765 GFX_DrawCfgWindow hgfx; | |
1766 const tFont *Font = &FontT48; | |
1767 | |
1768 hgfx.Image = &tMEscreen; | |
1769 hgfx.WindowNumberOfTextLines = 1; | |
1770 hgfx.WindowLineSpacing = 0; | |
1771 hgfx.WindowTab = 0; | |
1772 hgfx.WindowX0 = 20; | |
1773 hgfx.WindowX1 = 779; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1774 if(!settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1775 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1776 hgfx.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1777 hgfx.WindowY0 = hgfx.WindowY1 - Font->height; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1778 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1779 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1780 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1781 hgfx.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1782 hgfx.WindowY1 = hgfx.WindowY0 + Font->height; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1783 } |
38 | 1784 GFX_write_label(Font, &hgfx, text, menuColor); |
1785 } | |
1786 | |
1787 | |
1788 void write_buttonTextline( uint8_t left2ByteCode, char middle2ByteCode, char right2ByteCode) | |
1789 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1790 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1791 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1792 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1793 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1794 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1795 { |
117 | 1796 GFX_clean_area(&tMEscreen, 0, 800, 479-24,480); |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1797 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1798 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1799 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1800 GFX_clean_area(&tMEscreen, 0, 800, 0, 24); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1801 } |
38 | 1802 |
1803 char localtext[32]; | |
1804 | |
1805 if(left2ByteCode) | |
1806 { | |
1807 localtext[0] = TXT_2BYTE; | |
1808 localtext[1] = left2ByteCode; | |
1809 localtext[2] = 0; | |
117 | 1810 |
1811 write_content_simple(&tMEscreen, 0, 800, 479-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); | |
38 | 1812 } |
1813 | |
1814 if(middle2ByteCode) | |
1815 { | |
1816 localtext[0] = '\001'; | |
1817 localtext[1] = TXT_2BYTE; | |
1818 localtext[2] = middle2ByteCode; | |
1819 localtext[3] = 0; | |
117 | 1820 |
1821 write_content_simple(&tMEscreen, 0, 800, 479-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); | |
38 | 1822 } |
1823 | |
1824 if(right2ByteCode) | |
1825 { | |
1826 localtext[0] = '\002'; | |
1827 localtext[1] = TXT_2BYTE; | |
1828 localtext[2] = right2ByteCode; | |
1829 localtext[3] = 0; | |
117 | 1830 |
1831 write_content_simple(&tMEscreen, 0, 800, 479-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); | |
38 | 1832 } |
1833 } | |
1834 | |
1835 | |
1836 | |
1837 void write_label_var(uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text) | |
1838 { | |
1839 GFX_DrawCfgWindow hgfx; | |
1840 | |
1841 if(XrightGimpStyle > 799) | |
1842 XrightGimpStyle = 799; | |
1843 if(XleftGimpStyle >= XrightGimpStyle) | |
1844 XleftGimpStyle = 0; | |
1845 if(YtopGimpStyle > 479) | |
1846 YtopGimpStyle = 479; | |
1847 hgfx.Image = &tMEscreen; | |
1848 hgfx.WindowNumberOfTextLines = 1; | |
1849 hgfx.WindowLineSpacing = 0; | |
1850 hgfx.WindowTab = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1851 if(!settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1852 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1853 hgfx.WindowX0 = XleftGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1854 hgfx.WindowX1 = XrightGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1855 hgfx.WindowY1 = 479 - YtopGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1856 if(hgfx.WindowY1 < Font->height) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1857 hgfx.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1858 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1859 hgfx.WindowY0 = hgfx.WindowY1 - Font->height; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1860 } |
38 | 1861 else |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1862 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1863 hgfx.WindowX0 = 800 - XrightGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1864 hgfx.WindowX1 = 800 - XleftGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1865 hgfx.WindowY0 = YtopGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1866 if(hgfx.WindowY0 < Font->height) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1867 hgfx.WindowY1 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1868 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1869 hgfx.WindowY1 = hgfx.WindowY0 + Font->height; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1870 } |
38 | 1871 GFX_write_label(Font, &hgfx, text, 0);/*menuColor);*/ |
1872 } | |
1873 | |
1874 | |
1875 void write_content(uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint8_t color) | |
1876 { | |
1877 GFX_DrawCfgWindow hgfx; | |
1878 | |
1879 if(XrightGimpStyle > 799) | |
1880 XrightGimpStyle = 799; | |
1881 if(XleftGimpStyle >= XrightGimpStyle) | |
1882 XleftGimpStyle = 0; | |
1883 if(YtopGimpStyle > 479) | |
1884 YtopGimpStyle = 479; | |
1885 hgfx.Image = &tMEscreen; | |
1886 hgfx.WindowNumberOfTextLines = 1; | |
1887 hgfx.WindowLineSpacing = 0; | |
1888 hgfx.WindowTab = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1889 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1890 if(!settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1891 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1892 hgfx.WindowX0 = XleftGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1893 hgfx.WindowX1 = XrightGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1894 hgfx.WindowY1 = 479 - YtopGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1895 if(hgfx.WindowY1 < Font->height) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1896 hgfx.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1897 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1898 hgfx.WindowY0 = hgfx.WindowY1 - Font->height; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1899 } |
38 | 1900 else |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1901 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1902 hgfx.WindowX0 = 800 - XrightGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1903 hgfx.WindowX1 = 800 - XleftGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1904 hgfx.WindowY0 = YtopGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1905 if(hgfx.WindowY0 < Font->height) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1906 hgfx.WindowY1 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1907 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1908 hgfx.WindowY1 = hgfx.WindowY0 + Font->height; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1909 } |
38 | 1910 GFX_write_label(Font, &hgfx, text, color); |
1911 } | |
1912 | |
1913 | |
1914 void write_label_fix(uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char textId) | |
1915 { | |
1916 char text[2]; | |
1917 | |
1918 text[0] = textId; | |
1919 text[1] = 0; | |
1920 | |
1921 write_label_var(XleftGimpStyle, XrightGimpStyle, YtopGimpStyle, Font, text); | |
1922 } | |
1923 | |
1924 | |
1925 void clean_content(uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font) | |
1926 { | |
1927 GFX_DrawCfgWindow hgfx; | |
1928 | |
1929 if(XrightGimpStyle > 799) | |
1930 XrightGimpStyle = 799; | |
1931 if(XleftGimpStyle >= XrightGimpStyle) | |
1932 XleftGimpStyle = 0; | |
1933 if(YtopGimpStyle > 479) | |
1934 YtopGimpStyle = 479; | |
1935 hgfx.Image = &tMEscreen; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1936 if(!settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1937 { |
38 | 1938 hgfx.WindowX0 = XleftGimpStyle; |
1939 hgfx.WindowX1 = XrightGimpStyle; | |
1940 hgfx.WindowY1 = 479 - YtopGimpStyle; | |
1941 if(hgfx.WindowY1 < Font->height) | |
1942 hgfx.WindowY0 = 0; | |
1943 else | |
1944 hgfx.WindowY0 = hgfx.WindowY1 - Font->height; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1945 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1946 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1947 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1948 hgfx.WindowX0 = 800 - XrightGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1949 hgfx.WindowX1 = 800 - XleftGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1950 hgfx.WindowY0 = YtopGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1951 if(hgfx.WindowY0 < Font->height) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1952 hgfx.WindowY1 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1953 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1954 hgfx.WindowY1 = hgfx.WindowY0 + Font->height; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1955 } |
38 | 1956 GFX_clear_window_immediately(&hgfx); |
1957 } | |
1958 | |
1959 | |
1960 /* Private functions ---------------------------------------------------------*/ | |
1961 | |
1962 void draw_tMEdesign(void) | |
1963 { | |
1964 GFX_draw_header(&tMEscreen,menuColor); | |
1965 } | |
1966 | |
1967 void draw_tMEdesignSubUnselected(uint32_t *ppDestination) | |
1968 { | |
1969 union al88_u | |
1970 { | |
1971 uint8_t al8[2]; | |
1972 uint16_t al88; | |
1973 }; | |
1974 | |
1975 union al88_u color_seperator; | |
1976 union al88_u color_unselected; | |
1977 int i; | |
1978 | |
1979 color_seperator.al8[0] = CLUT_MenuLineUnselectedSeperator; | |
1980 color_unselected.al8[0] = CLUT_MenuLineUnselected; | |
1981 | |
1982 color_seperator.al8[1] = 0xFF; | |
1983 color_unselected.al8[1] = 0xFF; | |
1984 | |
1985 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
1986 *ppDestination += 2; | |
1987 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
1988 *ppDestination += 2; | |
1989 | |
1990 for(i = 61; i > 0; i--) | |
1991 { | |
1992 *(__IO uint16_t*)*ppDestination = color_unselected.al88; | |
1993 *ppDestination += 2; | |
1994 } | |
1995 | |
1996 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
1997 *ppDestination += 2; | |
1998 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
1999 *ppDestination += 2; | |
2000 } | |
2001 | |
2002 | |
2003 void draw_tMEdesignSubSelected(uint32_t *ppDestination) | |
2004 { | |
2005 union al88_u | |
2006 { | |
2007 uint8_t al8[2]; | |
2008 uint16_t al88; | |
2009 }; | |
2010 | |
2011 union al88_u color_selected; | |
2012 union al88_u color_seperator; | |
2013 int i; | |
2014 | |
2015 color_selected.al8[0] = CLUT_MenuEditLineSelected; | |
2016 color_selected.al8[1] = 0xFF; | |
2017 | |
2018 color_seperator.al8[0] = CLUT_MenuLineSelectedSeperator; | |
2019 color_seperator.al8[1] = 0xFF; | |
2020 | |
2021 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
2022 *ppDestination += 2; | |
2023 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
2024 *ppDestination += 2; | |
2025 | |
2026 for(i = 61; i > 0; i--) | |
2027 { | |
2028 *(__IO uint16_t*)*ppDestination = color_selected.al88; | |
2029 *ppDestination += 2; | |
2030 } | |
2031 | |
2032 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
2033 *ppDestination += 2; | |
2034 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
2035 *ppDestination += 2; | |
2036 } | |
2037 | |
2038 | |
2039 void draw_tMEdesignSubSelectedBorder(uint32_t *ppDestination) | |
2040 { | |
2041 union al88_u | |
2042 { | |
2043 uint8_t al8[2]; | |
2044 uint16_t al88; | |
2045 }; | |
2046 | |
2047 union al88_u color_selected_sides; | |
2048 | |
2049 int i; | |
2050 | |
2051 color_selected_sides.al8[0] = CLUT_MenuLineSelectedSides; | |
2052 color_selected_sides.al8[1] = 0xFF; | |
2053 | |
2054 for(i = 65; i > 0; i--) | |
2055 { | |
2056 *(__IO uint16_t*)*ppDestination = color_selected_sides.al88; | |
2057 *ppDestination += 2; | |
2058 } | |
2059 } | |
2060 | |
2061 | |
2062 void draw_tMEcursorNewDesign(void) | |
2063 { | |
2064 int i,j; | |
2065 uint32_t pDestination; | |
2066 | |
2067 pDestination = tMEcursorNew.FBStartAdress; | |
2068 | |
2069 for(j = 801; j > 0; j--) | |
2070 { | |
2071 for(i = 5; i > 0; i--) | |
2072 { | |
2073 draw_tMEdesignSubUnselected(&pDestination); | |
2074 } | |
2075 if((j > 787) || (j < 17)) | |
2076 draw_tMEdesignSubSelectedBorder(&pDestination); | |
2077 else | |
2078 draw_tMEdesignSubSelected(&pDestination); | |
2079 } | |
2080 } | |
552
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
531
diff
changeset
|
2081 |
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
531
diff
changeset
|
2082 GFX_DrawCfgScreen* getMenuEditScreen() |
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
531
diff
changeset
|
2083 { |
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
531
diff
changeset
|
2084 return &tMEscreen; |
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
531
diff
changeset
|
2085 } |
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
531
diff
changeset
|
2086 |
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
531
diff
changeset
|
2087 |