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