38
+ − 1 ///////////////////////////////////////////////////////////////////////////////
+ − 2 /// -*- coding: UTF-8 -*-
+ − 3 ///
+ − 4 /// \file Discovery/Src/tMenuEditDecoParameter.c
+ − 5 /// \brief Main Template file for Menu Edit Deco Parameters
+ − 6 /// \author heinrichs weikamp gmbh
+ − 7 /// \date 31-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 ------------------------------------------------------------------*/
+ − 30 #include "tMenuEditDecoParameter.h"
+ − 31
+ − 32 #include "gfx_fonts.h"
+ − 33 #include "tMenuEdit.h"
+ − 34 #include "unit.h" // last stop in meter and feet
+ − 35
+ − 36 #define MEDP_TAB (380)
+ − 37
+ − 38 /* Private function prototypes -----------------------------------------------*/
+ − 39 void openEdit_DecoAlgorithm(void);
+ − 40 void openEdit_DecoGF(void);
+ − 41 void openEdit_DecoAltGF(void);
+ − 42 void openEdit_DecoVPM(void);
+ − 43 void openEdit_DecoLastStop(void);
+ − 44 void openEdit_DM_SwitchAlgorithm(uint8_t line);
+ − 45
+ − 46 //void openEdit_DecoGasUsage(void);
+ − 47
+ − 48 /* Announced function prototypes -----------------------------------------------*/
+ − 49 uint8_t OnAction_GF (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 50 uint8_t OnAction_VPM (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 51 uint8_t OnAction_AltGF (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 52 uint8_t OnAction_LastStop (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 53
+ − 54 uint8_t OnAction_GasAMV (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 55 uint8_t OnAction_DefaultAMV (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 56 uint8_t OnAction_GasReserve (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 57
+ − 58 uint8_t OnAction_DM_ActiveGF (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 59 uint8_t OnAction_DM_ActiveVPM (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 60 uint8_t OnAction_DM_AltActiveGF (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 61 /* Exported functions --------------------------------------------------------*/
+ − 62
+ − 63 void openEdit_DecoParameter(uint8_t line)
+ − 64 {
+ − 65 set_globalState_Menu_Line(line);
+ − 66 resetMenuEdit(CLUT_MenuPageDecoParameter);
+ − 67
+ − 68 if(actual_menu_content == MENU_SURFACE)
+ − 69 {
+ − 70 switch(line)
+ − 71 {
+ − 72 case 1:
+ − 73 default:
+ − 74 openEdit_DecoAlgorithm();
+ − 75 break;
+ − 76 case 2:
+ − 77 openEdit_DecoVPM();
+ − 78 break;
+ − 79 case 3:
+ − 80 openEdit_DecoGF();
+ − 81 break;
+ − 82 case 4:
+ − 83 openEdit_DecoAltGF();
+ − 84 break;
+ − 85 case 5:
+ − 86 openEdit_DecoLastStop();
+ − 87 break;
+ − 88 case 6:
+ − 89 break;
+ − 90 }
+ − 91 }
+ − 92 else
+ − 93 openEdit_DM_SwitchAlgorithm(line);
+ − 94 }
+ − 95
+ − 96 /* Private functions ---------------------------------------------------------*/
+ − 97
+ − 98 void openEdit_DM_SwitchAlgorithm(uint8_t line)
+ − 99 {
+ − 100 SDiveState * pState;
+ − 101
+ − 102 if(actual_menu_content == MENU_DIVE_REAL)
+ − 103 {
+ − 104 pState = stateRealGetPointerWrite();
+ − 105 }
+ − 106 else
+ − 107 {
+ − 108 pState = stateSimGetPointerWrite();
+ − 109 }
+ − 110
+ − 111 switch(line)
+ − 112 {
+ − 113 case 1:
+ − 114 default:
+ − 115 pState->diveSettings.deco_type.ub.standard = VPM_MODE;
+ − 116 break;
+ − 117 case 2:
+ − 118
+ − 119 pState->diveSettings.gf_high = settingsGetPointer()->GF_high;
+ − 120 pState->diveSettings.gf_low = settingsGetPointer()->GF_low;
+ − 121 pState->diveSettings.deco_type.ub.standard = GF_MODE;
+ − 122 break;
+ − 123 case 3:
+ − 124 pState->diveSettings.gf_high = settingsGetPointer()->aGF_high;
+ − 125 pState->diveSettings.gf_low = settingsGetPointer()->aGF_low;
+ − 126 pState->diveSettings.deco_type.ub.standard = GF_MODE;
+ − 127 break;
+ − 128 }
+ − 129 exitMenuEdit_to_Home_with_Menu_Update();
+ − 130 }
+ − 131
+ − 132
+ − 133 void openEdit_DecoAlgorithm(void)
+ − 134 {
+ − 135 SSettings *pSettings = settingsGetPointer();
+ − 136
+ − 137 if(pSettings->deco_type.ub.standard == VPM_MODE)
+ − 138 pSettings->deco_type.ub.standard = GF_MODE;
+ − 139 else
+ − 140 pSettings->deco_type.ub.standard = VPM_MODE;
+ − 141
+ − 142 exitEditWithUpdate();
+ − 143 }
+ − 144
+ − 145
+ − 146 void openEdit_DecoVPM(void)
+ − 147 {
+ − 148 uint8_t vpm;
+ − 149 char text[32];
+ − 150 SSettings *pSettings = settingsGetPointer();
+ − 151
+ − 152 vpm = pSettings->VPM_conservatism.ub.standard;
+ − 153
+ − 154 text[0] = '\001';
+ − 155 text[1] = TXT_Decoparameters;
+ − 156 text[2] = 0;
+ − 157 write_topline(text);
+ − 158
+ − 159 write_label_var( 20, 800, ME_Y_LINE2, &FontT48, "VPM");
+ − 160
+ − 161 write_field_udigit(StMDECOP2_VPM, MEDP_TAB, 800, ME_Y_LINE2, &FontT48, "+#", (uint32_t)vpm, 0, 0, 0);
+ − 162
+ − 163 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
+ − 164
+ − 165 setEvent(StMDECOP2_VPM, (uint32_t)OnAction_VPM);
+ − 166 startEdit();
+ − 167 }
+ − 168
+ − 169
+ − 170 void openEdit_DecoGF(void)
+ − 171 {
+ − 172 uint8_t gfLow,gfHigh;
+ − 173 char text[32];
+ − 174 SSettings *pSettings = settingsGetPointer();
+ − 175
+ − 176 gfLow = pSettings->GF_low;
+ − 177 gfHigh = pSettings->GF_high;
+ − 178
+ − 179 text[0] = '\001';
+ − 180 text[1] = TXT_Decoparameters;
+ − 181 text[2] = 0;
+ − 182 write_topline(text);
+ − 183
+ − 184 write_label_var( 20, 800, ME_Y_LINE3, &FontT48, "GF\016\016low/high\017");
+ − 185
+ − 186 write_field_udigit(StMDECOP3_GF, MEDP_TAB, 800, ME_Y_LINE3, &FontT48, "##/##", (uint32_t)gfLow, (uint32_t)gfHigh, 0, 0);
+ − 187
+ − 188 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
+ − 189
+ − 190 setEvent(StMDECOP3_GF, (uint32_t)OnAction_GF);
+ − 191 startEdit();
+ − 192 }
+ − 193
+ − 194
+ − 195 void openEdit_DecoAltGF(void)
+ − 196 {
+ − 197 uint8_t aGfLow,aGfHigh;
+ − 198 char text[32];
+ − 199 SSettings *pSettings = settingsGetPointer();
+ − 200
+ − 201 aGfLow = pSettings->aGF_low;
+ − 202 aGfHigh = pSettings->aGF_high;
+ − 203
+ − 204 text[0] = '\001';
+ − 205 text[1] = TXT_Decoparameters;
+ − 206 text[2] = 0;
+ − 207 write_topline(text);
+ − 208
+ − 209 write_label_var( 20, 800, ME_Y_LINE4, &FontT48, "aGF\016\016low/high\017");
+ − 210 write_field_udigit(StMDECOP4_AltGF, MEDP_TAB, 800, ME_Y_LINE4, &FontT48, "##/##", (uint32_t)aGfLow, (uint32_t)aGfHigh, 0, 0);
+ − 211
+ − 212 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
+ − 213
+ − 214 setEvent(StMDECOP4_AltGF, (uint32_t)OnAction_AltGF);
+ − 215 startEdit();
+ − 216 }
+ − 217
+ − 218
+ − 219 void openEdit_DecoLastStop(void)
+ − 220 {
+ − 221 uint8_t lastStop;
+ − 222 char text[32];
+ − 223 SSettings *pSettings = settingsGetPointer();
+ − 224
+ − 225 lastStop = pSettings->last_stop_depth_meter;
+ − 226
+ − 227 text[0] = '\001';
+ − 228 text[1] = TXT_LastDecostop;
+ − 229 text[2] = 0;
+ − 230 write_topline(text);
+ − 231
+ − 232 write_label_fix( 20, 800, ME_Y_LINE5, &FontT48, TXT_LastDecostop);
+ − 233
+ − 234 if(settingsGetPointer()->nonMetricalSystem)
+ − 235 {
+ − 236 write_label_var( MEDP_TAB + 40, 800, ME_Y_LINE5, &FontT48, "\016\016 ft\017");
+ − 237 write_field_2digit(StMDECOP5_LASTSTOP, MEDP_TAB, 800, ME_Y_LINE5, &FontT48, "##", (uint32_t)unit_depth_integer(lastStop), 0, 0, 0);
+ − 238 }
+ − 239 else
+ − 240 {
+ − 241 write_label_var( MEDP_TAB + 20, 800, ME_Y_LINE5, &FontT48, "\016\016 meter\017");
+ − 242 write_field_udigit(StMDECOP5_LASTSTOP, MEDP_TAB, 800, ME_Y_LINE5, &FontT48, "#", (uint32_t)lastStop, 0, 0, 0);
+ − 243 }
+ − 244 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
+ − 245
+ − 246 setEvent(StMDECOP5_LASTSTOP, (uint32_t)OnAction_LastStop);
+ − 247 startEdit();
+ − 248 }
+ − 249
+ − 250 /*
+ − 251 void openEdit_DecoGF_DM(void)
+ − 252 {
+ − 253 const SDiveSettings * pDiveSettings;
+ − 254 uint8_t activeGF, activeVPM, aActiveGF;
+ − 255 SSettings *pSettings = settingsGetPointer();
+ − 256
+ − 257 if(actual_menu_content == MENU_DIVE_REAL)
+ − 258 {
+ − 259 const SDiveState * pState = stateRealGetPointer();
+ − 260 pDiveSettings = &pState->diveSettings;
+ − 261 }
+ − 262 else
+ − 263 {
+ − 264 const SDiveState * pState = stateSimGetPointer();
+ − 265 pDiveSettings = &pState->diveSettings;
+ − 266 }
+ − 267 if(pDiveSettings->deco_type.ub.standard == VPM_MODE)
+ − 268 {
+ − 269 aActiveGF = 0;
+ − 270 activeGF = 0;
+ − 271 activeVPM = 1;
+ − 272 }
+ − 273 else
+ − 274 if((pDiveSettings->gf_high == pSettings->GF_high) && (pDiveSettings->gf_low == pSettings->GF_low))
+ − 275 {
+ − 276 aActiveGF = 0;
+ − 277 activeGF = 1;
+ − 278 activeVPM = 0;
+ − 279 }
+ − 280 else
+ − 281 {
+ − 282 aActiveGF = 1;
+ − 283 activeGF = 0;
+ − 284 activeVPM = 0;
+ − 285 }
+ − 286
+ − 287 write_label_fix( 30, 340, 90, &FontT42, TXT_ZHL16GF);
+ − 288 write_label_fix( 30, 340, 140, &FontT42, TXT_low_high);
+ − 289 write_label_fix( 400, 600, 90, &FontT42, TXT_VPM);
+ − 290 write_label_fix( 400, 600, 140, &FontT42, TXT_Conservatism);
+ − 291 write_label_fix( 660, 799, 90, &FontT42, TXT_aGF);
+ − 292
+ − 293 write_field_on_off(StMDECOP7_ActiveGF, 30, 170, 405, &FontT48, "Active", activeGF);
+ − 294
+ − 295 write_field_on_off(StMDECOP8_ActiveVPM, 400, 600, 405, &FontT48, "Active", activeVPM);
+ − 296
+ − 297 write_field_on_off(StMDECOP9_ActiveAltGF, 660, 799, 405, &FontT48, "Active", aActiveGF);
+ − 298
+ − 299
+ − 300 setEvent(StMDECOP7_ActiveGF, (uint32_t)OnAction_DM_ActiveGF);
+ − 301 setEvent(StMDECOP8_ActiveVPM, (uint32_t)OnAction_DM_ActiveVPM);
+ − 302 setEvent(StMDECOP9_ActiveAltGF, (uint32_t)OnAction_DM_AltActiveGF);
+ − 303 }
+ − 304 */
+ − 305
+ − 306 uint8_t OnAction_VPM(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 307 {
+ − 308 SSettings *pSettings;
+ − 309 uint8_t digitContentNew;
+ − 310 uint32_t newConservatism;
+ − 311
+ − 312 if(action == ACTION_BUTTON_ENTER)
+ − 313 {
+ − 314 return digitContent;
+ − 315 }
+ − 316 if(action == ACTION_BUTTON_ENTER_FINAL)
+ − 317 {
+ − 318 evaluateNewString(editId, &newConservatism, 0, 0, 0);
+ − 319 if(newConservatism > 5)
+ − 320 newConservatism = 5;
+ − 321
+ − 322 pSettings = settingsGetPointer();
+ − 323 pSettings->VPM_conservatism.ub.standard = newConservatism;
+ − 324
+ − 325 tMenuEdit_newInput(editId, newConservatism, 0, 0, 0);
+ − 326 return UPDATE_AND_EXIT_TO_MENU;
+ − 327 }
+ − 328 if(action == ACTION_BUTTON_NEXT)
+ − 329 {
+ − 330 digitContentNew = digitContent + 1;
+ − 331 if(digitContentNew > '5')
+ − 332 digitContentNew = '0';
+ − 333 return digitContentNew;
+ − 334 }
+ − 335 if(action == ACTION_BUTTON_BACK)
+ − 336 {
+ − 337 digitContentNew = digitContent - 1;
+ − 338 if(digitContentNew < '0')
+ − 339 digitContentNew = '5';
+ − 340 return digitContentNew;
+ − 341 }
+ − 342
+ − 343 return EXIT_TO_MENU;
+ − 344 }
+ − 345
+ − 346
+ − 347 uint8_t OnAction_GF(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 348 {
+ − 349 SSettings *pSettings;
+ − 350 uint8_t digitContentNew;
+ − 351 uint32_t newGFlow, newGFhigh;
+ − 352
+ − 353 if(action == ACTION_BUTTON_ENTER)
+ − 354 {
+ − 355 return digitContent;
+ − 356 }
+ − 357 if(action == ACTION_BUTTON_ENTER_FINAL)
+ − 358 {
+ − 359 evaluateNewString(editId, &newGFlow, &newGFhigh, 0, 0);
+ − 360 if(newGFlow < 10)
+ − 361 newGFlow = 10;
+ − 362 if(newGFhigh < 45)
+ − 363 newGFhigh = 45;
+ − 364 if(newGFlow > 99)
+ − 365 newGFlow = 99;
+ − 366 if(newGFhigh > 99)
+ − 367 newGFhigh = 99;
+ − 368
+ − 369 pSettings = settingsGetPointer();
+ − 370 pSettings->GF_low = newGFlow;
+ − 371 pSettings->GF_high= newGFhigh;
+ − 372
+ − 373 tMenuEdit_newInput(editId, newGFlow, newGFhigh, 0, 0);
+ − 374 return UPDATE_AND_EXIT_TO_MENU;
+ − 375 }
+ − 376 if(action == ACTION_BUTTON_NEXT)
+ − 377 {
+ − 378 digitContentNew = digitContent + 1;
+ − 379 if(digitContentNew > '9')
+ − 380 digitContentNew = '0';
+ − 381 return digitContentNew;
+ − 382 }
+ − 383 if(action == ACTION_BUTTON_BACK)
+ − 384 {
+ − 385 digitContentNew = digitContent - 1;
+ − 386 if(digitContentNew < '0')
+ − 387 digitContentNew = '9';
+ − 388 return digitContentNew;
+ − 389 }
+ − 390 return EXIT_TO_MENU;
+ − 391 }
+ − 392
+ − 393 uint8_t OnAction_AltGF(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 394 {
+ − 395 SSettings *pSettings;
+ − 396 uint8_t digitContentNew;
+ − 397 uint32_t newGFlow, newGFhigh;
+ − 398
+ − 399 if(action == ACTION_BUTTON_ENTER)
+ − 400 {
+ − 401 return digitContent;
+ − 402 }
+ − 403 if(action == ACTION_BUTTON_ENTER_FINAL)
+ − 404 {
+ − 405 evaluateNewString(editId, &newGFlow, &newGFhigh, 0, 0);
+ − 406 if(newGFlow < 10)
+ − 407 newGFlow = 10;
+ − 408 if(newGFhigh < 45)
+ − 409 newGFhigh = 45;
+ − 410 if(newGFlow > 99)
+ − 411 newGFlow = 99;
+ − 412 if(newGFhigh > 99)
+ − 413 newGFhigh = 99;
+ − 414
+ − 415 pSettings = settingsGetPointer();
+ − 416 pSettings->aGF_low = newGFlow;
+ − 417 pSettings->aGF_high= newGFhigh;
+ − 418
+ − 419 tMenuEdit_newInput(editId, newGFlow, newGFhigh, 0, 0);
+ − 420 return UPDATE_AND_EXIT_TO_MENU;
+ − 421 }
+ − 422 if(action == ACTION_BUTTON_NEXT)
+ − 423 {
+ − 424 digitContentNew = digitContent + 1;
+ − 425 if(digitContentNew > '9')
+ − 426 digitContentNew = '0';
+ − 427 return digitContentNew;
+ − 428 }
+ − 429 if(action == ACTION_BUTTON_BACK)
+ − 430 {
+ − 431 digitContentNew = digitContent - 1;
+ − 432 if(digitContentNew < '0')
+ − 433 digitContentNew = '9';
+ − 434 return digitContentNew;
+ − 435 }
+ − 436
+ − 437 return EXIT_TO_MENU;
+ − 438 }
+ − 439
+ − 440
+ − 441 uint8_t OnAction_LastStop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 442 {
+ − 443 SSettings *pSettings;
+ − 444 uint8_t digitContentNew;
+ − 445 uint32_t lastStop;
+ − 446
+ − 447 if(action == ACTION_BUTTON_ENTER)
+ − 448 {
+ − 449 return digitContent;
+ − 450 }
+ − 451 if(action == ACTION_BUTTON_ENTER_FINAL)
+ − 452 {
+ − 453 evaluateNewString(editId, &lastStop, 0, 0, 0);
+ − 454
+ − 455 if(settingsGetPointer()->nonMetricalSystem != 0) // new hw 170718
+ − 456 {
+ − 457 lastStop += 2; // f�r rundung
+ − 458 lastStop = (lastStop * 3) / 10;
+ − 459 }
+ − 460
+ − 461 pSettings = settingsGetPointer();
+ − 462
+ − 463 pSettings->last_stop_depth_meter = lastStop;
+ − 464
+ − 465 tMenuEdit_newInput(editId, lastStop, 0, 0, 0);
+ − 466 return UPDATE_AND_EXIT_TO_MENU;
+ − 467 }
+ − 468
+ − 469 if(settingsGetPointer()->nonMetricalSystem)
+ − 470 {
+ − 471 // 10, 13, 17, 20
+ − 472 if(action == ACTION_BUTTON_NEXT)
+ − 473 {
+ − 474 if(digitContent < 13 + '0')
+ − 475 digitContentNew = 13 + '0';
+ − 476 else if(digitContent < 16 + '0')
+ − 477 digitContentNew = 16 + '0';
+ − 478 else if(digitContent < 20 + '0')
+ − 479 digitContentNew = 20 + '0';
+ − 480 else
+ − 481 digitContentNew = 10 + '0';
+ − 482
+ − 483
+ − 484 return digitContentNew;
+ − 485 }
+ − 486 if(action == ACTION_BUTTON_BACK)
+ − 487 {
+ − 488 if(digitContent >= 20 + '0')
+ − 489 digitContentNew = 16 + '0';
+ − 490 else if(digitContent >= 16 + '0')
+ − 491 digitContentNew = 13 + '0';
+ − 492 else if(digitContent >= 13 + '0')
+ − 493 digitContentNew = 10 + '0';
+ − 494 else
+ − 495 digitContentNew = 20 + '0';
+ − 496
+ − 497 return digitContentNew;
+ − 498 }
+ − 499 }
+ − 500 else
+ − 501 {
+ − 502 if(action == ACTION_BUTTON_NEXT)
+ − 503 {
+ − 504 digitContentNew = digitContent + 1;
+ − 505 if(digitContentNew > '6')
+ − 506 digitContentNew = '3';
+ − 507 return digitContentNew;
+ − 508 }
+ − 509 if(action == ACTION_BUTTON_BACK)
+ − 510 {
+ − 511 digitContentNew = digitContent - 1;
+ − 512 if(digitContentNew < '3')
+ − 513 digitContentNew = '6';
+ − 514 return digitContentNew;
+ − 515 }
+ − 516 }
+ − 517
+ − 518 return EXIT_TO_MENU;
+ − 519 }
+ − 520
+ − 521
+ − 522 uint8_t OnAction_ActiveGF(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 523 {
+ − 524 SSettings *pSettings;
+ − 525 pSettings = settingsGetPointer();
+ − 526
+ − 527 if(pSettings->deco_type.ub.standard == GF_MODE)
+ − 528 return 255;
+ − 529
+ − 530 pSettings->deco_type.ub.standard = GF_MODE;
+ − 531 tMenuEdit_set_on_off(editId, 1);
+ − 532 tMenuEdit_set_on_off(StMDECOP8_ActiveVPM, 0);
+ − 533
+ − 534 return UPDATE_DIVESETTINGS;
+ − 535 }
+ − 536
+ − 537
+ − 538 uint8_t OnAction_ActiveVPM(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 539 {
+ − 540 SSettings *pSettings;
+ − 541 pSettings = settingsGetPointer();
+ − 542
+ − 543 if(pSettings->deco_type.ub.standard == VPM_MODE)
+ − 544 return 255;
+ − 545
+ − 546 pSettings->deco_type.ub.standard = VPM_MODE;
+ − 547 tMenuEdit_set_on_off(editId, 1);
+ − 548 tMenuEdit_set_on_off(StMDECOP7_ActiveGF, 0);
+ − 549
+ − 550 return UPDATE_DIVESETTINGS;
+ − 551 }
+ − 552
+ − 553
+ − 554 uint8_t OnAction_DM_ActiveVPM(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 555 {
+ − 556 SDiveSettings * pDiveSettings;
+ − 557 if(actual_menu_content == MENU_DIVE_REAL)
+ − 558 {
+ − 559 SDiveState * pState = stateRealGetPointerWrite();
+ − 560 pDiveSettings = &pState->diveSettings;
+ − 561 }
+ − 562 else
+ − 563 {
+ − 564 SDiveState * pState = stateSimGetPointerWrite();
+ − 565 pDiveSettings = &pState->diveSettings;
+ − 566 }
+ − 567 pDiveSettings->deco_type.ub.standard = VPM_MODE;
+ − 568 return EXIT_TO_HOME;
+ − 569 }
+ − 570
+ − 571
+ − 572 uint8_t OnAction_DM_ActiveGF(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 573 {
+ − 574 SSettings *pSettings = settingsGetPointer();
+ − 575 SDiveSettings * pDiveSettings;
+ − 576 if(actual_menu_content == MENU_DIVE_REAL)
+ − 577 {
+ − 578 SDiveState * pState = stateRealGetPointerWrite();
+ − 579 pDiveSettings = &pState->diveSettings;
+ − 580 }
+ − 581 else
+ − 582 {
+ − 583 SDiveState * pState = stateSimGetPointerWrite();
+ − 584 pDiveSettings = &pState->diveSettings;
+ − 585 }
+ − 586 pDiveSettings->gf_high = pSettings->GF_high;
+ − 587 pDiveSettings->gf_low = pSettings->GF_low;
+ − 588 pDiveSettings->deco_type.ub.standard = GF_MODE;
+ − 589 return EXIT_TO_HOME;
+ − 590 }
+ − 591
+ − 592
+ − 593 uint8_t OnAction_DM_AltActiveGF(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 594 {
+ − 595 SSettings *pSettings = settingsGetPointer();
+ − 596 SDiveSettings * pDiveSettings;
+ − 597 if(actual_menu_content == MENU_DIVE_REAL)
+ − 598 {
+ − 599 SDiveState * pState = stateRealGetPointerWrite();
+ − 600 pDiveSettings = &pState->diveSettings;
+ − 601 }
+ − 602 else
+ − 603 {
+ − 604 SDiveState * pState = stateSimGetPointerWrite();
+ − 605 pDiveSettings = &pState->diveSettings;
+ − 606 }
+ − 607 pDiveSettings->gf_high = pSettings->aGF_high;
+ − 608 pDiveSettings->gf_low = pSettings->aGF_low;
+ − 609 pDiveSettings->deco_type.ub.standard = GF_MODE;
+ − 610 return EXIT_TO_HOME;
+ − 611 }
+ − 612
+ − 613
+ − 614 /*
+ − 615 void openEdit_DecoGasUsage(void)
+ − 616 {
+ − 617 uint8_t amv, reserve;
+ − 618 char text[32];
+ − 619 SSettings *pSettings;
+ − 620
+ − 621 pSettings = settingsGetPointer();
+ − 622
+ − 623 amv = pSettings->AtemMinutenVolumenLiter;
+ − 624 reserve = pSettings->ReserveFractionDenominator;
+ − 625
+ − 626 text[0] = '\a';
+ − 627 text[1] = TXT_AtemGasVorrat;
+ − 628 text[2] = 0;
+ − 629
+ − 630 write_topline(text);
+ − 631
+ − 632 write_label_fix( 30, 340, 90, &FontT42, TXT_LiterproMinute);
+ − 633 write_label_fix( 30, 340, 250, &FontT42, TXT_Default);
+ − 634 write_label_fix( 430, 740, 90, &FontT42, TXT_Reserve);
+ − 635
+ − 636 strcpy(text, "1/0");
+ − 637 text[2] += reserve;
+ − 638 write_field_udigit(StMDECOP5_AMV, 30, 320, 150, &FontT105, "###", (uint32_t)amv, 0, 0, 0);
+ − 639 write_field_button(StMDECOP5_DefaultAMV, 30, 170, 290, &FontT48, "25");
+ − 640 write_field_button(StMDECOP5_RESERVE, 430, 640, 150, &FontT105, text);
+ − 641
+ − 642 setEvent(StMDECOP5_AMV, (uint32_t)OnAction_GasAMV);
+ − 643 setEvent(StMDECOP5_DefaultAMV, (uint32_t)OnAction_DefaultAMV);
+ − 644 setEvent(StMDECOP5_RESERVE, (uint32_t)OnAction_GasReserve);
+ − 645 }
+ − 646
+ − 647
+ − 648 uint8_t OnAction_GasAMV (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 649 {
+ − 650 uint8_t digitContentNew;
+ − 651 uint32_t newAMV;
+ − 652 SSettings *pSettings;
+ − 653
+ − 654 if(action == ACTION_BUTTON_ENTER)
+ − 655 {
+ − 656 return digitContent;
+ − 657 }
+ − 658 if(action == ACTION_BUTTON_ENTER_FINAL)
+ − 659 {
+ − 660 evaluateNewString(editId, &newAMV, 0, 0, 0);
+ − 661
+ − 662 if(newAMV < 5)
+ − 663 newAMV = 5;
+ − 664 if(newAMV > 190)
+ − 665 newAMV = 190;
+ − 666
+ − 667 pSettings = settingsGetPointer();
+ − 668 pSettings->AtemMinutenVolumenLiter = newAMV;
+ − 669
+ − 670 tMenuEdit_newInput(editId, newAMV, 0, 0, 0);
+ − 671
+ − 672 return 255;
+ − 673 }
+ − 674 if(action == ACTION_BUTTON_NEXT)
+ − 675 {
+ − 676 if((digitNumber == 0) && (digitContentNew >= '1'))
+ − 677 digitContentNew = '0';
+ − 678 else
+ − 679 digitContentNew = digitContent + 1;
+ − 680 if(digitContentNew > '9')
+ − 681 digitContentNew = '0';
+ − 682 return digitContentNew;
+ − 683 }
+ − 684 if(action == ACTION_BUTTON_BACK)
+ − 685 {
+ − 686 if((digitNumber == 0) && (digitContentNew == '0'))
+ − 687 digitContentNew = '1';
+ − 688 else
+ − 689 digitContentNew = digitContent - 1;
+ − 690 if(digitContentNew < '0')
+ − 691 digitContentNew = '9';
+ − 692 return digitContentNew;
+ − 693 }
+ − 694
+ − 695 return UNSPECIFIC_RETURN;
+ − 696 }
+ − 697
+ − 698
+ − 699 uint8_t OnAction_DefaultAMV (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 700 {
+ − 701 uint32_t newAMV;
+ − 702 SSettings *pSettings;
+ − 703
+ − 704 newAMV = 25;
+ − 705
+ − 706 pSettings = settingsGetPointer();
+ − 707 pSettings->AtemMinutenVolumenLiter = newAMV;
+ − 708 tMenuEdit_newInput(StMDECOP5_AMV, newAMV, 0, 0, 0);
+ − 709
+ − 710 return UNSPECIFIC_RETURN;
+ − 711 }
+ − 712
+ − 713
+ − 714 uint8_t OnAction_GasReserve (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 715 {
+ − 716 uint32_t reserve;
+ − 717 SSettings *pSettings;
+ − 718 char text[32];
+ − 719
+ − 720 pSettings = settingsGetPointer();
+ − 721 reserve = pSettings->ReserveFractionDenominator;
+ − 722 if(reserve <= 3)
+ − 723 reserve = 4;
+ − 724 else
+ − 725 reserve = 3;
+ − 726
+ − 727 pSettings->ReserveFractionDenominator = reserve;
+ − 728
+ − 729 strcpy(text, "1/0");
+ − 730 text[2] += reserve;
+ − 731 tMenuEdit_newButtonText(editId, text);
+ − 732
+ − 733 return UNSPECIFIC_RETURN;
+ − 734 }
+ − 735 */