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