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