annotate Discovery/Src/tMenuEditGasOC.c @ 980:7149f372b0ba Evo_2_23

Fix a couple of bugs in the scrubber timer: - double speed scrubber countdown in simulator mode - unwanted updating of last scrubber use date in simulator mode - invalid remaining scrubber display in surface mode (mikeller)
author heinrichsweikamp
date Tue, 04 Feb 2025 13:49:43 +0100 (6 weeks ago)
parents 79b522fbabe6
children 22d5b477c903
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 /// -*- coding: UTF-8 -*-
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 /// \file Discovery/Src/tMenuEditGasOC.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Main Template file for editing Open Circuit Gas Settings
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 09-July-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /// \details
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /// $Id$
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /// This program is free software: you can redistribute it and/or modify
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /// it under the terms of the GNU General Public License as published by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 /// the Free Software Foundation, either version 3 of the License, or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /// (at your option) any later version.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /// This program is distributed in the hope that it will be useful,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /// GNU General Public License for more details.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 /// You should have received a copy of the GNU General Public License
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 #include "tMenuEditGasOC.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "check_warning.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 #include "gfx_fonts.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 #include "tMenuEdit.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 #include "unit.h"
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
36 #include "configuration.h"
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 /* Private types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 uint8_t gasID;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 SGasLine * pGasLine;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 uint8_t mod;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 uint8_t ccr;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 uint8_t setpoint;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 } SEditGasPage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 SEditGasPage editGasPage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 void create_text_with_u8(char *text, const char *text1, uint8_t inputU8, const char *text2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 void openEdit_Gas(uint8_t line, uint8_t ccr);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 void openEdit_GasType(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 void openEdit_DiveGasSelect(uint8_t line, uint8_t ccr);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 void openEdit_SpecialDiveGasMenu(uint8_t ccr);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 void openEdit_DiveGasSelect_Subroutine(uint8_t line, uint8_t ccr);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 void tMEGas_check_switch_to_bailout(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 /* Announced function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 uint8_t OnAction_Mix (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 uint8_t OnAction_GasType (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 uint8_t OnAction_ChangeDepth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 uint8_t OnAction_SetToMOD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
973
79b522fbabe6 Deactivate deco gas calculation option:
Ideenmodellierer
parents: 830
diff changeset
69 #ifdef ENABLE_DECOCALC_OPTION
830
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
70 uint8_t OnAction_CalcDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
973
79b522fbabe6 Deactivate deco gas calculation option:
Ideenmodellierer
parents: 830
diff changeset
71 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 uint8_t OnAction_BottleSize (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 uint8_t OnAction_First (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 uint8_t OnAction_Deco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 uint8_t OnAction_Travel (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 uint8_t OnAction_Inactive (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
78 uint8_t OnAction_Off (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 uint8_t OnAction_DM_Active (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 uint8_t OnAction_DM_Mix (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 uint8_t OnAction_DefaultMix (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 uint8_t OnAction_ToggleDepth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 uint8_t OnAction_ToggleDefault (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 uint8_t OnAction_DefaultDepth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 void openEdit_GasCC(uint8_t line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 if(actual_menu_content == MENU_SURFACE)
647
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
95 {
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
96 if(line == 6)
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
97 {
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 647
diff changeset
98 if(isLoopMode(settingsGetPointer()->dive_mode) || (stateUsed->diveSettings.ccrOption == 1))
647
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
99 {
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
100 selectPage(StMOG);
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
101 }
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
102 }
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
103 else
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
104 {
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
105 openEdit_Gas(line , 1);
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
106 }
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
107 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 else
647
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
109 {
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
110 if(line == 6)
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
111 {
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
112 openEdit_SpecialDiveGasMenu(1);
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
113 }
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
114 else
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
115 {
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
116 openEdit_DiveGasSelect(line, 1);
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
117 }
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
118 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 void openEdit_GasOC(uint8_t line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 if(actual_menu_content == MENU_SURFACE)
647
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
125 {
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
126 if(line == 6)
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
127 {
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 647
diff changeset
128 if(isLoopMode(settingsGetPointer()->dive_mode) || (stateUsed->diveSettings.ccrOption == 1))
647
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
129 {
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
130 selectPage(StMCG);
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
131 }
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
132 }
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
133 else
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
134 {
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
135 openEdit_Gas(line, 0);
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
136 }
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
137 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 if(line == 6)
647
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
140 {
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 openEdit_SpecialDiveGasMenu(0);
647
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
142 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 else
647
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
144 {
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 openEdit_DiveGasSelect(line, 0);
647
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
146 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 /* dive mode */
773
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 735
diff changeset
151 void openEdit_DiveSelectBetterGas(bool doBailout)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 {
773
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 735
diff changeset
153 uint8_t gasId;
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 735
diff changeset
154 if (doBailout) {
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 735
diff changeset
155 gasId = actualBetterBailoutGasId();
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 735
diff changeset
156 } else {
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 735
diff changeset
157 gasId = actualBetterGasId();
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 735
diff changeset
158 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159
773
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 735
diff changeset
160 uint8_t ccr = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 if(gasId>5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 gasId -= 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 ccr = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 openEdit_DiveGasSelect_Subroutine(gasId,ccr);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 updateSpecificMenu(StMCG); // is this necessary? openEdit_DiveGasSelect_Subroutine has update. hw 151209
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 updateSpecificMenu(StMOG); // is this necessary? openEdit_DiveGasSelect_Subroutine has update. hw 151209
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 /* select gas in divemode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 void openEdit_DiveGasSelect(uint8_t line, uint8_t ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 {
682
8775d3dc6325 Bugfix low ppO2 warning in bailout mode:
Ideenmodellierer
parents: 662
diff changeset
177 if(!ccr)
8775d3dc6325 Bugfix low ppO2 warning in bailout mode:
Ideenmodellierer
parents: 662
diff changeset
178 {
8775d3dc6325 Bugfix low ppO2 warning in bailout mode:
Ideenmodellierer
parents: 662
diff changeset
179 tMEGas_check_switch_to_bailout();
8775d3dc6325 Bugfix low ppO2 warning in bailout mode:
Ideenmodellierer
parents: 662
diff changeset
180 }
8775d3dc6325 Bugfix low ppO2 warning in bailout mode:
Ideenmodellierer
parents: 662
diff changeset
181 openEdit_DiveGasSelect_Subroutine(line, ccr);
8775d3dc6325 Bugfix low ppO2 warning in bailout mode:
Ideenmodellierer
parents: 662
diff changeset
182
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 exitMenuEdit_to_Home_with_Menu_Update();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 void openEdit_DiveGasSelect_Subroutine(uint8_t line, uint8_t ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 uint8_t setpoint;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190
699
01f40cb1057e Cleanup warnings:
Ideenmodellierer
parents: 682
diff changeset
191 editGasPage.pGasLine = (SGasLine *)stateUsed->diveSettings.gas;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 editGasPage.gasID = line + NUM_OFFSET_DILUENT;
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 149
diff changeset
196 setpoint = stateUsed->lifeData.actualGas.setPoint_cbar;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 editGasPage.gasID = line;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 setpoint = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
204 #ifdef ENABLE_UNUSED_GAS_HIDING
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
205 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.off) /* disable selection of switched off gases */
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
206 {
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
207 return;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
208 }
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
209 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1;
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 149
diff changeset
212 setActualGas_DM(&stateUsedWrite->lifeData,editGasPage.gasID,setpoint);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 /* extra gas and gas on/off option */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 void openEdit_SpecialDiveGasMenu(uint8_t ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 uint8_t oxygen, helium, gasOffset, textpointer, lineCount, ptrGas;
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 149
diff changeset
220 //SDiveState * pState;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221
699
01f40cb1057e Cleanup warnings:
Ideenmodellierer
parents: 682
diff changeset
222 editGasPage.pGasLine = (SGasLine *)stateUsed->diveSettings.gas;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 149
diff changeset
225 editGasPage.setpoint = stateUsed->lifeData.actualGas.setPoint_cbar;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 editGasPage.ccr = ccr;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 set_globalState_Menu_Line(6);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 resetMenuEdit(CLUT_MenuPageGasCC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 resetMenuEdit(CLUT_MenuPageGasOC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 gasOffset = NUM_OFFSET_DILUENT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 gasOffset = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 text[1] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 text[2] = TXT2BYTE_SpecialDiveGasMenuCCR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 text[2] = TXT2BYTE_SpecialDiveGasMenu;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 text[3] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 lineCount = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 for(int i=1; i<=5; i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 ptrGas = i + gasOffset;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 oxygen = stateUsed->diveSettings.gas[ptrGas].oxygen_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 helium = stateUsed->diveSettings.gas[ptrGas].helium_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 if(oxygen == 100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 textpointer = snprintf(text,10,"Oxy");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 if((oxygen == 21) && (helium == 0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 textpointer = snprintf(text,10,"Air");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 textpointer = snprintf(text,10,"%02i/%02i",oxygen,helium);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 if(editGasPage.pGasLine[ptrGas].note.ub.first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 strcpy(&text[textpointer]," *");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 write_field_on_off(StMOG_DM_ActiveBase+i, 30, 500, ME_Y_LINE_BASE + (lineCount * ME_Y_LINE_STEP), &FontT48, text, stateUsed->diveSettings.gas[ptrGas].note.ub.active);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 lineCount++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 if(!ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 if(stateUsed->diveSettings.gas[0].note.ub.first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 oxygen = stateUsed->diveSettings.gas[0].oxygen_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280 helium = stateUsed->diveSettings.gas[0].helium_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 write_field_udigit(StMOG_DM_ExtraMix, 30, 800, ME_Y_LINE6, &FontT48, "##/## Extra Gas *", oxygen, helium, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 write_field_udigit(StMOG_DM_ExtraMix, 30, 800, ME_Y_LINE6, &FontT48, "##/## Extra Gas", 0, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 for(int i=1; i<=5; i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 setEvent(StMOG_DM_ActiveBase + i,(uint32_t)OnAction_DM_Active);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 if(!ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 setEvent(StMOG_DM_ExtraMix,(uint32_t)OnAction_DM_Mix);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 uint8_t OnAction_DM_Active (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 uint8_t gasOffset, newActive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 if(editGasPage.ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304 gasOffset = NUM_OFFSET_DILUENT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 gasOffset = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 editGasPage.gasID = editId + gasOffset - StMOG_DM_ActiveBase;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.active)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 newActive = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 newActive = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 tMenuEdit_set_on_off(editId, newActive);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = newActive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324 /* only for OC */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 uint8_t OnAction_DM_Mix(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 uint32_t newOxygen, newHelium;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 evaluateNewString(editId, &newOxygen, &newHelium, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 if(newOxygen < 5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 newOxygen = 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 if(newOxygen == 99)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 newOxygen = 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 if(newHelium > 95)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 newHelium = 95;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 if((newOxygen + newHelium) > 100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 newOxygen = 100 - newHelium;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 149
diff changeset
347 //SDiveState * pDiveState = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 for(int i=1;i<=(2*NUM_GASES);i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 editGasPage.pGasLine[i].note.ub.first = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351
735
39f48356049b Fixed invalid setpoint (0.0) used after switch from CCR to extra (OC) gas
heinrichsweikamp
parents: 699
diff changeset
352 tMEGas_check_switch_to_bailout();
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 149
diff changeset
353 setActualGas_ExtraGas(&stateUsedWrite->lifeData, newOxygen, newHelium, 0);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 return EXIT_TO_HOME;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 if(digitContentNew > '9')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 digitContentNew = '9';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 void tMEGas_check_switch_to_bailout(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 {
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 647
diff changeset
377 if(isLoopMode(stateUsed->diveSettings.diveMode))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 149
diff changeset
379 stateUsedWrite->diveSettings.diveMode = DIVEMODE_OC;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 block_diluent_page();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385 /* surface mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 void openEdit_Gas(uint8_t line, uint8_t ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 {
973
79b522fbabe6 Deactivate deco gas calculation option:
Ideenmodellierer
parents: 830
diff changeset
388 uint8_t gasID, oxygen, helium, depthDeco, active, first, depthMOD, deco, travel, inactive, off ;//, bottleSizeLiter;
79b522fbabe6 Deactivate deco gas calculation option:
Ideenmodellierer
parents: 830
diff changeset
389
79b522fbabe6 Deactivate deco gas calculation option:
Ideenmodellierer
parents: 830
diff changeset
390 #ifdef ENABLE_DECOCALC_OPTION
79b522fbabe6 Deactivate deco gas calculation option:
Ideenmodellierer
parents: 830
diff changeset
391 uint8_t decocalc;
79b522fbabe6 Deactivate deco gas calculation option:
Ideenmodellierer
parents: 830
diff changeset
392 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395 char textMOD[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396 uint8_t txtptr;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 if(line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 set_globalState_Menu_Line(line);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 set_globalState_Menu_Line(NUM_GASES + 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 resetMenuEdit(CLUT_MenuPageGasCC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406 resetMenuEdit(CLUT_MenuPageGasOC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409 gasID = line + NUM_OFFSET_DILUENT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411 gasID = line;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413 editGasPage.ccr = ccr;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414 editGasPage.gasID = gasID;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415 editGasPage.mod = calc_MOD(gasID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417 SSettings *data = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418 editGasPage.pGasLine = data->gas;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420 oxygen = editGasPage.pGasLine[gasID].oxygen_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 if(oxygen > 99)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422 oxygen = 99;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423 helium = editGasPage.pGasLine[gasID].helium_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424 depthDeco = editGasPage.pGasLine[gasID].depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 //depthTravel = editGasPage.pGasLine[gasID].depth_meter_travel;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426 active = editGasPage.pGasLine[gasID].note.ub.active;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427 first = editGasPage.pGasLine[gasID].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428 deco = editGasPage.pGasLine[gasID].note.ub.deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429 travel = editGasPage.pGasLine[gasID].note.ub.travel;
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
430 off = editGasPage.pGasLine[gasID].note.ub.off;
973
79b522fbabe6 Deactivate deco gas calculation option:
Ideenmodellierer
parents: 830
diff changeset
431 #ifdef ENABLE_DECOCALC_OPTION
830
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
432 decocalc = editGasPage.pGasLine[gasID].note.ub.decocalc;
973
79b522fbabe6 Deactivate deco gas calculation option:
Ideenmodellierer
parents: 830
diff changeset
433 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434 //bottleSizeLiter = editGasPage.pGasLine[gasID].bottle_size_liter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436 if(active)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 inactive = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439 inactive = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 depthMOD = editGasPage.mod;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443 int i = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 if(gasID >= 10)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446 i = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447 strcpy(text, "\001" "Gas #10 X");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450 strcpy(text, "\001" "Gas #0 X");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453 text[8+i] = TXT_Diluent_Gas_Edit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
454 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455 text[8+i] = TXT_OC_Gas_Edit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457 if(gasID >= 10)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458 text[6+i] += gasID - 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
459 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460 text[6+i] += gasID;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463 if(actual_menu_content == MENU_SURFACE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465 write_label_fix( 20, 800, ME_Y_LINE1, &FontT48, TXT_Mix);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466 write_field_udigit(StMOG_Mix, 210, 400, ME_Y_LINE1, &FontT48, "##/##", (uint32_t)oxygen, (uint32_t)helium, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 text[1] = 0;
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
470 if(off)
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
471 text[0] = TXT_Off;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
472 else
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 if(inactive)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 text[0] = TXT_Inactive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476 if(first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477 text[0] = TXT_First;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479 if(deco)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480 text[0] = TXT_Deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 if(travel)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483 text[0] = TXT_Travel;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484 else
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
485 text[0] = TXT_Inactive;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487 write_field_button(StMOG_GasType, 20, 710, ME_Y_LINE2, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
489
830
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
490 if((deco) || (travel && ccr))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
491 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
492 text[0] = TXT_ChangeDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493 text[1] = ' ';
830
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
494
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
495 if(deco)
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
496 {
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
497 text[2] = TXT_Deco;
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
498 }
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
499 else
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
500 {
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
501 text[2] = TXT_Travel;
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
502 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
503 text[3] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
504 write_label_var( 20 ,800, ME_Y_LINE3, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
505
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
506 textMOD[0] = '#';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
507 textMOD[1] = '#';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
508 textMOD[2] = '#';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
509 textMOD[3] = unit_depth_char1();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
510 textMOD[4] = unit_depth_char2();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
511 textMOD[5] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
512 write_field_udigit(StMOG_ChangeDepth, 600, 710, ME_Y_LINE3, &FontT48,textMOD, (uint32_t)unit_depth_integer(depthDeco), 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
513
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
514 txtptr = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
515 text[txtptr++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
516 text[txtptr++] = TXT2BYTE_SetToMOD;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
517 text[txtptr++] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
518 write_field_button(StMOG_SetToMOD, 20, 710, ME_Y_LINE4, &FontT48,text);
973
79b522fbabe6 Deactivate deco gas calculation option:
Ideenmodellierer
parents: 830
diff changeset
519 #ifdef ENABLE_DECOCALC_OPTION
830
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
520 if(deco)
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
521 {
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
522 txtptr = 0;
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
523 text[txtptr++] = TXT_2BYTE;
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
524 text[txtptr++] = TXT2BYTE_CalculateDeco;
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
525 text[txtptr++] = 0;
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
526
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
527 write_field_on_off(StMOG_CalcDeco, 20, 710, ME_Y_LINE5, &FontT48, text, decocalc);
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
528 }
973
79b522fbabe6 Deactivate deco gas calculation option:
Ideenmodellierer
parents: 830
diff changeset
529 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
530 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
531 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
532 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
533 txtptr = 0;
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
534 text[txtptr++] = '\031';
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
535 text[txtptr++] = TXT_ChangeDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
536 text[txtptr++] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
537 text[txtptr++] = TXT_Deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
538 text[txtptr++] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
539 write_label_var( 20 ,800, ME_Y_LINE3, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
540
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
541 txtptr = 0;
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
542 text[txtptr++] = '\031';
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
543 text[txtptr++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
544 text[txtptr++] = TXT2BYTE_SetToMOD;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
545 text[txtptr++] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
546 write_label_var( 20 ,800, ME_Y_LINE4, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
547 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
548 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
549 txtptr = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
550 text[txtptr++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
551 text[txtptr++] = TXT2BYTE_Bottle;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
552 text[txtptr++] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
553 write_label_var( 20 ,800, ME_Y_LINE5, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
554 write_field_2digit(StMOG_Bottle, 600, 710, ME_Y_LINE5, &FontT48,"## ltr", (uint32_t)bottleSizeLiter, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
555
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
556 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
557 stop_cursor_fields();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
558
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
559 textMOD[0] = '#';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
560 textMOD[1] = '#';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
561 textMOD[2] = '#';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
562 textMOD[3] = unit_depth_char1();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
563 textMOD[4] = unit_depth_char2();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
564 textMOD[5] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
565 textMOD[6] = 'M';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
566 textMOD[7] = 'O';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
567 textMOD[8] = 'D';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
568 textMOD[9] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
569
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
570 write_field_udigit(StMOG_MOD, 401, 780, ME_Y_LINE1, &FontT48, textMOD, (uint32_t)unit_depth_integer(depthMOD), 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
571 // write_field_udigit(StMOG_MOD, 401, 780, ME_Y_LINE1, &FontT48, "###m MOD", (uint32_t)depthMOD, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
572
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
573 setEvent(StMOG_Mix, (uint32_t)OnAction_Mix);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
574 setEvent(StMOG_GasType, (uint32_t)OnAction_GasType);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
575
830
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
576 if((deco) || (travel && ccr))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
577 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
578 setEvent(StMOG_ChangeDepth, (uint32_t)OnAction_ChangeDepth);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
579 setEvent(StMOG_SetToMOD, (uint32_t)OnAction_SetToMOD);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
580 }
973
79b522fbabe6 Deactivate deco gas calculation option:
Ideenmodellierer
parents: 830
diff changeset
581 #ifdef ENABLE_DECOCALC_OPTION
830
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
582 if(deco)
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
583 {
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
584 setEvent(StMOG_CalcDeco, (uint32_t)OnAction_CalcDeco);
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
585 }
973
79b522fbabe6 Deactivate deco gas calculation option:
Ideenmodellierer
parents: 830
diff changeset
586 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
587 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
588 setEvent(StMOG_Bottle, (uint32_t)OnAction_BottleSize);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
589 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
590 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
591 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
592 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
593
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
594 /* surface mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
595 void openEdit_GasType(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
596 {
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
597 uint8_t gasID, active, first, deco, travel, inactive, off;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
598 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
599
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
600
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
601 if(editGasPage.ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
602 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
603 resetMenuEdit(CLUT_MenuPageGasCC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
604 setBackMenu((uint32_t)openEdit_GasCC, editGasPage.gasID - NUM_OFFSET_DILUENT, 2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
605 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
606 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
607 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
608 resetMenuEdit(CLUT_MenuPageGasOC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
609 setBackMenu((uint32_t)openEdit_GasOC, editGasPage.gasID, 2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
610 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
611
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
612 gasID = editGasPage.gasID;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
613 active = editGasPage.pGasLine[gasID].note.ub.active;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
614 first = editGasPage.pGasLine[gasID].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
615 deco = editGasPage.pGasLine[gasID].note.ub.deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
616 travel = editGasPage.pGasLine[gasID].note.ub.travel;
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
617 off = editGasPage.pGasLine[gasID].note.ub.off;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
618
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
619 if((active) || (off))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
620 inactive = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
621 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
622 inactive = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
623
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
624
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
625 /* header */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
626 int i = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
627 if(gasID >= 10)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
628 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
629 i = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
630 strcpy(text, "\001" "Gas #10 X");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
631 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
632 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
633 strcpy(text, "\001" "Gas #0 X");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
634
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
635 if(editGasPage.ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
636 text[8+i] = TXT_Diluent_Gas_Edit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
637 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
638 text[8+i] = TXT_OC_Gas_Edit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
639
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
640 if(gasID >= 10)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
641 text[6+i] += gasID - 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
642 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
643 text[6+i] += gasID;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
644 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
645
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
646 text[1] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
647 text[0] = TXT_First;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
648 write_field_on_off(StMOG_First, 30, 400, ME_Y_LINE1, &FontT48, text, first);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
649
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
650 text[0] = TXT_Deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
651 write_field_on_off(StMOG_Deco, 30, 400, ME_Y_LINE2, &FontT48, text, deco);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
652
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
653 text[0] = TXT_Travel;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
654 write_field_on_off(StMOG_Travel, 30, 400, ME_Y_LINE3, &FontT48, text, travel);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
655
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
656 text[0] = TXT_Inactive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
657 write_field_on_off(StMOG_Inactive, 30, 400, ME_Y_LINE4, &FontT48, text, inactive);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
658
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
659 #ifdef ENABLE_UNUSED_GAS_HIDING
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
660 text[0] = TXT_Off;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
661 write_field_on_off(StMOG_Off, 30, 400, ME_Y_LINE5, &FontT48, text, off);
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
662 #endif
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
663
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
664 setEvent(StMOG_First, (uint32_t)OnAction_First);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
665 setEvent(StMOG_Deco, (uint32_t)OnAction_Deco);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
666 setEvent(StMOG_Travel, (uint32_t)OnAction_Travel);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
667 setEvent(StMOG_Inactive, (uint32_t)OnAction_Inactive);
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
668 #ifdef ENABLE_UNUSED_GAS_HIDING
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
669 setEvent(StMOG_Off, (uint32_t)OnAction_Off);
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
670 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
671
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
672 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
673 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
674
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
675 uint8_t OnAction_GasType(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
676 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
677 openEdit_GasType();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
678 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
679 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
680
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
681 uint8_t OnAction_Mix(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
682 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
683 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
684 uint32_t newOxygen, newHelium;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
685
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
686 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
687 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
688 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
689 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
690 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
691 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
692 evaluateNewString(editId, &newOxygen, &newHelium, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
693
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
694 if(newOxygen < 5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
695 newOxygen = 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
696 if(newOxygen == 99)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
697 newOxygen = 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
698 if(newHelium > 95)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
699 newHelium = 95;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
700 if((newOxygen + newHelium) > 100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
701 newOxygen = 100 - newHelium;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
702
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
703 editGasPage.pGasLine[editGasPage.gasID].oxygen_percentage = newOxygen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
704 editGasPage.pGasLine[editGasPage.gasID].helium_percentage = newHelium;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
705 editGasPage.mod = calc_MOD(editGasPage.gasID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
706
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
707 if(newOxygen == 100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
708 newOxygen = 99;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
709
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
710 tMenuEdit_newInput(editId, newOxygen, newHelium, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
711 tMenuEdit_newInput(StMOG_MOD, (uint32_t)unit_depth_integer(editGasPage.mod), 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
712
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
713 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
714 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
715 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
716 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
717 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
718 if(digitContentNew > '9')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
719 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
720 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
721 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
722 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
723 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
724 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
725 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
726 digitContentNew = '9';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
727 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
728 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
729
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
730 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
731 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
732
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
733 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
734 uint8_t OnAction_DefaultMix(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
735 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
736 uint32_t newOxygen, newHelium;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
737 uint8_t depthDEFAULT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
738 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
739
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
740 newOxygen = 21;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
741 newHelium = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
742
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
743 editGasPage.pGasLine[editGasPage.gasID].oxygen_percentage = newOxygen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
744 editGasPage.pGasLine[editGasPage.gasID].helium_percentage = newHelium;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
745
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
746 tMenuEdit_newInput(StMOG_Mix, newOxygen, newHelium, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
747
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
748 depthDEFAULT = calc_MOD(editGasPage.gasID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
749 create_text_with_u8(text, "", depthDEFAULT, "m MOD");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
750 tMenuEdit_newButtonText(StMOG_DefaultDepth, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
751
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
752 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
753 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
754
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
755 uint8_t OnAction_ToggleDepth(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
756 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
757 uint8_t depth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
758 uint32_t newDefaultDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
759 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
760
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
761 if(editGasPage.depth_mode == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
762 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
763 editGasPage.depth_mode = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
764 depth = editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
765 newDefaultDepth = calc_MinOD(editGasPage.gasID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
766 create_text_with_u8(text, "", newDefaultDepth, "m Min");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
767 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
768 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
769 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
770 editGasPage.depth_mode = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
771 depth = editGasPage.pGasLine[editGasPage.gasID].depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
772 newDefaultDepth = calc_MOD(editGasPage.gasID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
773 create_text_with_u8(text, "", newDefaultDepth, "m MOD");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
774 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
775 tMenuEdit_newInput(StMOG_Depth, (uint32_t)depth, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
776 tMenuEdit_newButtonText(StMOG_DefaultDepth, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
777
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
778 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
779 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
780
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
781
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
782 uint8_t OnAction_Depth(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
783 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
784 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
785 uint32_t newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
786
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
787 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
788 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
789 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
790 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
791 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
792 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
793 evaluateNewString(editId, &newDepth, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
794 if(newDepth > 255)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
795 newDepth = 255;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
796 if(editGasPage.depth_mode == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
797 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
798 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
799 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
800 tMenuEdit_newInput(editId, newDepth, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
801 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
802 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
803 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
804 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
805 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
806 if(digitContentNew > '9')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
807 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
808 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
809 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
810 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
811 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
812 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
813 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
814 digitContentNew = '9';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
815 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
816 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
817
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
818 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
819 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
820
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
821
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
822 uint8_t OnAction_DefaultDepth(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
823 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
824 uint32_t newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
825
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
826 if(editGasPage.depth_mode == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
827 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
828 newDepth = calc_MOD(editGasPage.gasID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
829 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
830 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
831 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
832 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
833 newDepth = calc_MinOD(editGasPage.gasID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
834 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
835 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
836
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
837 tMenuEdit_newInput(StMOG_Depth, newDepth, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
838
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
839 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
840 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
841
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
842
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
843 uint8_t OnAction_Active(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
844 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
845 uint8_t active, first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
846
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
847 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
848
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
849 if(first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
850 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
851
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
852 active = editGasPage.pGasLine[editGasPage.gasID].note.ub.active;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
853
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
854 if(active)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
855 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
856 active = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
857 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
858 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
859 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
860 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
861 active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
862 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
863 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
864 tMenuEdit_set_on_off(editId, active);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
865
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
866 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
867 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
868 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
869
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
870
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
871 uint8_t OnAction_First(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
872 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
873 uint8_t first, i, gasOne;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
874
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
875 if(editGasPage.ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
876 gasOne = 1 + NUM_OFFSET_DILUENT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
877 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
878 gasOne = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
879
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
880 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
881
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
882 if(!first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
883 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
884 for(i=gasOne;i<NUM_GASES + gasOne;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
885 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
886 if(editGasPage.pGasLine[i].note.ub.first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
887 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
888 editGasPage.pGasLine[i].note.ub.first = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
889 editGasPage.pGasLine[i].note.ub.active = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
890 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
891 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
892 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
893
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
894 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
895 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
896 editGasPage.pGasLine[editGasPage.gasID].note.ub.deco = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
897 editGasPage.pGasLine[editGasPage.gasID].note.ub.travel = 0;
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
898 editGasPage.pGasLine[editGasPage.gasID].note.ub.off = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
899 editGasPage.pGasLine[editGasPage.gasID].depth_meter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
900 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
901
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
902 tMenuEdit_set_on_off(StMOG_First, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
903 tMenuEdit_set_on_off(StMOG_Deco, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
904 tMenuEdit_set_on_off(StMOG_Travel, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
905 tMenuEdit_set_on_off(StMOG_Inactive, 0);
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
906 #ifdef ENABLE_UNUSED_GAS_HIDING
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
907 tMenuEdit_set_on_off(StMOG_Off, 0);
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
908 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
909
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
910 if(!first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
911 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
912 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
913 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
914 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
915
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
916
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
917 uint8_t OnAction_Deco(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
918 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
919 uint8_t first, deco, gasOne;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
920
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
921 if(editGasPage.ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
922 gasOne = 1 + NUM_OFFSET_DILUENT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
923 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
924 gasOne = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
925
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
926 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
927 deco = editGasPage.pGasLine[editGasPage.gasID].note.ub.deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
928
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
929 if(first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
930 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
931 if(editGasPage.gasID == gasOne)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
932 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
933 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
934 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
935 editGasPage.pGasLine[gasOne].note.ub.first = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
936 editGasPage.pGasLine[gasOne].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
937 editGasPage.pGasLine[gasOne].note.ub.deco = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
938 editGasPage.pGasLine[gasOne].note.ub.travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
939 editGasPage.pGasLine[gasOne].depth_meter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
940 editGasPage.pGasLine[gasOne].depth_meter_travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
941 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
942 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
943
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
944 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
945 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
946 editGasPage.pGasLine[editGasPage.gasID].note.ub.deco = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
947 editGasPage.pGasLine[editGasPage.gasID].note.ub.travel = 0;
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
948 editGasPage.pGasLine[editGasPage.gasID].note.ub.off = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
949 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
950 editGasPage.mod = calc_MOD(editGasPage.gasID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
951 editGasPage.pGasLine[editGasPage.gasID].depth_meter = editGasPage.mod;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
952
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
953 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
954 if(deco)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
955 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
956 editGasPage.pGasLine[editGasPage.gasID].depth_meter = editGasPage.mod;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
957 tMenuEdit_newInput(StMOG_ChangeDepth, editGasPage.pGasLine[editGasPage.gasID].depth_meter, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
958 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
959 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
960
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
961 tMenuEdit_set_on_off(StMOG_First, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
962 tMenuEdit_set_on_off(StMOG_Deco, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
963 tMenuEdit_set_on_off(StMOG_Travel, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
964 tMenuEdit_set_on_off(StMOG_Inactive, 0);
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
965 #ifdef ENABLE_UNUSED_GAS_HIDING
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
966 tMenuEdit_set_on_off(StMOG_Off, 0);
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
967 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
968
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
969 if(!deco)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
970 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
971 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
972 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
973 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
974
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
975
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
976 uint8_t OnAction_Travel(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
977 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
978 uint8_t first, travel, gasOne;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
979
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
980 if(editGasPage.ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
981 gasOne = 1 + NUM_OFFSET_DILUENT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
982 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
983 gasOne = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
984
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
985 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
986 travel = editGasPage.pGasLine[editGasPage.gasID].note.ub.travel;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
987
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
988 if(first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
989 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
990 if(editGasPage.gasID == gasOne)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
991 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
992 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
993 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
994 editGasPage.pGasLine[gasOne].note.ub.first = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
995 editGasPage.pGasLine[gasOne].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
996 editGasPage.pGasLine[gasOne].note.ub.deco = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
997 editGasPage.pGasLine[gasOne].note.ub.travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
998 editGasPage.pGasLine[gasOne].depth_meter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
999 editGasPage.pGasLine[gasOne].depth_meter_travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1000 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1001 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1002
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1003 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1004 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1005 editGasPage.pGasLine[editGasPage.gasID].note.ub.deco = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1006 editGasPage.pGasLine[editGasPage.gasID].note.ub.travel = 1;
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1007 editGasPage.pGasLine[editGasPage.gasID].note.ub.off = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1008 editGasPage.pGasLine[editGasPage.gasID].depth_meter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1009 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1010
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1011 tMenuEdit_set_on_off(StMOG_First, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1012 tMenuEdit_set_on_off(StMOG_Deco, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1013 tMenuEdit_set_on_off(StMOG_Travel, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1014 tMenuEdit_set_on_off(StMOG_Inactive, 0);
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1015 #ifdef ENABLE_UNUSED_GAS_HIDING
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1016 tMenuEdit_set_on_off(StMOG_Off, 0);
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1017 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1018
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1019 if(!travel)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1020 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1021 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1022 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1023 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1024
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1025
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1026 uint8_t OnAction_Inactive(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1027 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1028 uint8_t first, inactive, gasOne;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1029
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1030 if(editGasPage.ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1031 gasOne = 1 + NUM_OFFSET_DILUENT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1032 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1033 gasOne = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1034
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1035 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1036
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1037 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.active)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1038 inactive = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1039 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1040 inactive = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1041
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1042 if(first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1043 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1044 if(editGasPage.gasID == gasOne)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1045 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1046 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1047 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1048 editGasPage.pGasLine[gasOne].note.ub.first = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1049 editGasPage.pGasLine[gasOne].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1050 editGasPage.pGasLine[gasOne].note.ub.deco = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1051 editGasPage.pGasLine[gasOne].note.ub.travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1052 editGasPage.pGasLine[gasOne].depth_meter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1053 editGasPage.pGasLine[gasOne].depth_meter_travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1054 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1055 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1056
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1057 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1058 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1059 editGasPage.pGasLine[editGasPage.gasID].note.ub.deco = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1060 editGasPage.pGasLine[editGasPage.gasID].note.ub.travel = 0;
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1061 editGasPage.pGasLine[editGasPage.gasID].note.ub.off = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1062
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1063 tMenuEdit_set_on_off(StMOG_First, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1064 tMenuEdit_set_on_off(StMOG_Deco, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1065 tMenuEdit_set_on_off(StMOG_Travel, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1066 tMenuEdit_set_on_off(StMOG_Inactive, 1);
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1067 #ifdef ENABLE_UNUSED_GAS_HIDING
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1068 tMenuEdit_set_on_off(StMOG_Off, 0);
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1069 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1070 if(!inactive)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1071 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1072 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1073 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1074 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1075
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1076 uint8_t OnAction_Off (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1077 {
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1078 uint8_t first, off, gasOne;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1079
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1080 if(editGasPage.ccr)
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1081 gasOne = 1 + NUM_OFFSET_DILUENT;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1082 else
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1083 gasOne = 1;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1084
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1085 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1086 off =editGasPage.pGasLine[editGasPage.gasID].note.ub.off;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1087
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1088 if(first)
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1089 {
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1090 if(editGasPage.gasID == gasOne)
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1091 return UNSPECIFIC_RETURN;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1092 else
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1093 {
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1094 editGasPage.pGasLine[gasOne].note.ub.first = 1;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1095 editGasPage.pGasLine[gasOne].note.ub.active = 1;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1096 editGasPage.pGasLine[gasOne].note.ub.deco = 0;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1097 editGasPage.pGasLine[gasOne].note.ub.travel = 0;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1098 editGasPage.pGasLine[gasOne].depth_meter = 0;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1099 editGasPage.pGasLine[gasOne].depth_meter_travel = 0;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1100 }
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1101 }
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1102
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1103 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 0;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1104 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 0;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1105 editGasPage.pGasLine[editGasPage.gasID].note.ub.deco = 0;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1106 editGasPage.pGasLine[editGasPage.gasID].note.ub.travel = 0;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1107 editGasPage.pGasLine[editGasPage.gasID].note.ub.off = 1;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1108
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1109 tMenuEdit_set_on_off(StMOG_First, 0);
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1110 tMenuEdit_set_on_off(StMOG_Deco, 0);
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1111 tMenuEdit_set_on_off(StMOG_Travel, 0);
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1112 tMenuEdit_set_on_off(StMOG_Inactive, 0);
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1113 #ifdef ENABLE_UNUSED_GAS_HIDING
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1114 tMenuEdit_set_on_off(StMOG_Off, 1);
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1115 #endif
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1116 if(!off)
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1117 return UPDATE_DIVESETTINGS;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1118 else
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1119 return UPDATE_AND_EXIT_TO_MENU;
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
1120 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1121
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1122 uint8_t OnAction_SetToMOD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1123 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1124 uint8_t newChangeDepth = editGasPage.mod;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1125
830
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1126 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.travel)
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1127 {
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1128 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel= newChangeDepth;
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1129 }
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1130 else
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1131 {
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1132 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newChangeDepth;
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1133 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1134 tMenuEdit_newInput(StMOG_ChangeDepth, unit_depth_integer(newChangeDepth), 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1135
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1136 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1137 }
973
79b522fbabe6 Deactivate deco gas calculation option:
Ideenmodellierer
parents: 830
diff changeset
1138 #ifdef ENABLE_DECOCALC_OPTION
830
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1139 uint8_t OnAction_CalcDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1140 {
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1141 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.decocalc)
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1142 {
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1143 editGasPage.pGasLine[editGasPage.gasID].note.ub.decocalc = 0;
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1144 }
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1145 else
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1146 {
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1147 editGasPage.pGasLine[editGasPage.gasID].note.ub.decocalc = 1;
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1148 }
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1149 tMenuEdit_set_on_off(editId, editGasPage.pGasLine[editGasPage.gasID].note.ub.decocalc);
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1150
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1151 return UPDATE_DIVESETTINGS;
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1152 }
973
79b522fbabe6 Deactivate deco gas calculation option:
Ideenmodellierer
parents: 830
diff changeset
1153 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1154 uint8_t OnAction_ChangeDepth(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1155 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1156 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1157 uint32_t newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1158
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1159 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1160 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1161 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1162 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1163 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1164 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1165 evaluateNewString(editId, &newDepth, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1166 if(settingsGetPointer()->nonMetricalSystem != 0) // new hw 170703
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1167 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1168 newDepth += 2; // f�r rundung
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1169 newDepth = (newDepth * 3) / 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1170 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1171 if(newDepth > 255)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1172 newDepth = 255;
830
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1173
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1174 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.travel)
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1175 {
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1176 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = newDepth;
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1177 }
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1178 else
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1179 {
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1180 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newDepth;
b7d93ff6b3b2 Added selection if an active gas shall be used for deco calculation or not:
Ideenmodellierer
parents: 773
diff changeset
1181 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1182 tMenuEdit_newInput(editId, unit_depth_integer(newDepth), 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1183 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1184 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1185 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1186 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1187 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1188 if(digitContentNew > '9')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1189 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1190 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1191 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1192 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1193 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1194 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1195 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1196 digitContentNew = '9';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1197 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1198 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1199
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1200 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1201 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1202
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1203
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1204 uint8_t OnAction_BottleSize (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1205 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1206 int8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1207 uint32_t newBottleSize;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1208 // const uint8_t validSize = {4,7,8,10,12,15,16,17,20,24,30,40,255};
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1209 const uint8_t validSize[] = {40,30,24,20,17,16,15,12,10,8,7,4,0};
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1210
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1211 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1212 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1213 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1214 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1215 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1216 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1217 evaluateNewString(editId, &newBottleSize, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1218
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1219 if(newBottleSize > validSize[0])
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1220 newBottleSize = validSize[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1221
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1222 editGasPage.pGasLine[editGasPage.gasID].bottle_size_liter = newBottleSize;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1223
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1224 tMenuEdit_newInput(editId, newBottleSize, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1225 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1226 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1227 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1228 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1229 // new here for ease of comparison
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1230 digitContentNew = digitContent - '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1231
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1232 if(digitContentNew > 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1233 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1234 int i = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1235 while(digitContentNew < validSize[i])
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1236 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1237 i++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1238 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1239 if(i == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1240 digitContentNew = 0; // off
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1241 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1242 digitContentNew = validSize[i-1];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1243 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1244 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1245 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1246 int i = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1247 while(validSize[i] != 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1248 i++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1249 digitContentNew = validSize[i-1]; // smallest tank
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1250 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1251 digitContentNew += '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1252 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1253 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1254 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1255 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1256 // new here for ease of comparison
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1257 digitContentNew = digitContent - '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1258 if(digitContentNew > 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1259 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1260 int i = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1261 while(digitContentNew < validSize[i])
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1262 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1263 i++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1264 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1265 if(validSize[i] == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1266 digitContentNew = 0; // off
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1267 else if(validSize[i+1] == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1268 digitContentNew = 0; // off
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1269 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1270 digitContentNew = validSize[i+1];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1271 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1272 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1273 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1274 digitContentNew = validSize[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1275 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1276 digitContentNew += '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1277
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1278 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1279 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1280 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1281 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1282
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1283
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1284 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1285
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1286
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1287 void create_text_with_u8(char *text, const char *text1, uint8_t inputU8, const char *text2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1288 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1289 uint8_t digit1, digit2, digit3, count;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1290
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1291 count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1292
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1293 if(*text1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1294 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1295 strcpy(&text[count], text1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1296 count = strlen(text1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1297 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1298
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1299 digit1 = inputU8 / 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1300 inputU8 -= digit1 * 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1301 digit2 = inputU8 / 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1302 inputU8 -= digit2 * 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1303 digit3 = inputU8;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1304 if(digit1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1305 text[count++] = '0' + digit1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1306 if(count || digit2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1307 text[count++] = '0' + digit2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1308 text[count++] = '0' + digit3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1309
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1310 if(*text2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1311 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1312 strcpy(&text[count], text2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1313 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1314 }