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