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