annotate Discovery/Src/tMenuEditGasOC.c @ 167:5e41365ff0d8 cleanup-1

cleanup: local data and functions can be static (tMenu) Most of the changes in this commit are making code that is only used in this file (compilation unit) static. Careful reading the changes show a little more. Like, removing commented code (as any code change can be found the repository, so nothing is really lost), or removing obvious looking useless code (callerID). Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author Jan Mulder <jlmulder@xs4all.nl>
date Fri, 08 Mar 2019 13:47:52 +0100
parents e1d66bc78f9a
children ba229a012ac7
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"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 /* Private types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 uint8_t gasID;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 SGasLine * pGasLine;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 uint8_t mod;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 uint8_t ccr;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 uint8_t setpoint;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 } SEditGasPage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 #define MAX_SENDER_AT_ONCE 5
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 uint16_t wirelessSender[MAX_SENDER_AT_ONCE];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 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
56
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 void openEdit_Gas(uint8_t line, uint8_t ccr);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 void openEdit_GasType(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 void openEdit_Wireless(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 void openEdit_DiveGasSelect(uint8_t line, uint8_t ccr);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 void openEdit_SpecialDiveGasMenu(uint8_t ccr);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 void openEdit_DiveGasSelect_Subroutine(uint8_t line, uint8_t ccr);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 void tMEGas_check_switch_to_bailout(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 /* Announced function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 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
69 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
70 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
71 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
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 uint8_t OnAction_Wireless (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 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
76 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
77 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
78 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
79
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 uint8_t OnAction_WirelessID (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_NoWireless (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 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
84 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
85
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 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
88 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
89 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
90 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
91 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 void openEdit_GasCC(uint8_t line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 if(actual_menu_content == MENU_SURFACE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 openEdit_Gas(line , 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 if(line == 6)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 openEdit_SpecialDiveGasMenu(1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 openEdit_DiveGasSelect(line, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 void openEdit_GasOC(uint8_t line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 if(actual_menu_content == MENU_SURFACE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 openEdit_Gas(line, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 if(line == 6)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 openEdit_SpecialDiveGasMenu(0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 openEdit_DiveGasSelect(line, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 /* dive mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 void openEdit_DiveSelectBetterGas(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 uint8_t gasId, ccr;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 gasId = actualBetterGasId();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 ccr = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 if(gasId>5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 gasId -= 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 ccr = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 openEdit_DiveGasSelect_Subroutine(gasId,ccr);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 updateSpecificMenu(StMCG); // is this necessary? openEdit_DiveGasSelect_Subroutine has update. hw 151209
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 updateSpecificMenu(StMOG); // is this necessary? openEdit_DiveGasSelect_Subroutine has update. hw 151209
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 /* select gas in divemode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 void openEdit_DiveGasSelect(uint8_t line, uint8_t ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 openEdit_DiveGasSelect_Subroutine(line, ccr);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 if(!ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 tMEGas_check_switch_to_bailout();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 exitMenuEdit_to_Home_with_Menu_Update();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 }
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 void openEdit_DiveGasSelect_Subroutine(uint8_t line, uint8_t ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 SDiveState * pState;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 uint8_t setpoint;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 if(actual_menu_content == MENU_DIVE_REAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 pState = stateRealGetPointerWrite();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 editGasPage.pGasLine = pState->diveSettings.gas;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 pState = stateSimGetPointerWrite();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 editGasPage.pGasLine = pState->diveSettings.gas;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 editGasPage.gasID = line + NUM_OFFSET_DILUENT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 setpoint = pState->lifeData.actualGas.setPoint_cbar;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 editGasPage.gasID = line;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 setpoint = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 for(int i=0;i<(1+ (2*NUM_GASES));i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 editGasPage.pGasLine[i].note.ub.first = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 setActualGas_DM(&pState->lifeData,editGasPage.gasID,setpoint);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 /* extra gas and gas on/off option */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 void openEdit_SpecialDiveGasMenu(uint8_t ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 uint8_t oxygen, helium, gasOffset, textpointer, lineCount, ptrGas;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 SDiveState * pState;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 if(actual_menu_content == MENU_DIVE_REAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 pState = stateRealGetPointerWrite();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 editGasPage.pGasLine = pState->diveSettings.gas;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 pState = stateSimGetPointerWrite();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 editGasPage.pGasLine = pState->diveSettings.gas;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 editGasPage.setpoint = pState->lifeData.actualGas.setPoint_cbar;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 editGasPage.ccr = ccr;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 set_globalState_Menu_Line(6);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 resetMenuEdit(CLUT_MenuPageGasCC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 resetMenuEdit(CLUT_MenuPageGasOC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 gasOffset = NUM_OFFSET_DILUENT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 gasOffset = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 text[1] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 text[2] = TXT2BYTE_SpecialDiveGasMenuCCR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 text[2] = TXT2BYTE_SpecialDiveGasMenu;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 text[3] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 lineCount = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 for(int i=1; i<=5; i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 ptrGas = i + gasOffset;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 oxygen = stateUsed->diveSettings.gas[ptrGas].oxygen_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 helium = stateUsed->diveSettings.gas[ptrGas].helium_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 if(oxygen == 100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 textpointer = snprintf(text,10,"Oxy");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 if((oxygen == 21) && (helium == 0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 textpointer = snprintf(text,10,"Air");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 textpointer = snprintf(text,10,"%02i/%02i",oxygen,helium);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 if(editGasPage.pGasLine[ptrGas].note.ub.first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 strcpy(&text[textpointer]," *");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 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
250 lineCount++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 if(!ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 if(stateUsed->diveSettings.gas[0].note.ub.first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 oxygen = stateUsed->diveSettings.gas[0].oxygen_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 helium = stateUsed->diveSettings.gas[0].helium_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 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
260 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 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
264 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 for(int i=1; i<=5; i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 setEvent(StMOG_DM_ActiveBase + i,(uint32_t)OnAction_DM_Active);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 if(!ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 setEvent(StMOG_DM_ExtraMix,(uint32_t)OnAction_DM_Mix);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 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
278 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 uint8_t gasOffset, newActive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 if(editGasPage.ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 gasOffset = NUM_OFFSET_DILUENT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 gasOffset = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 editGasPage.gasID = editId + gasOffset - StMOG_DM_ActiveBase;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.active)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 newActive = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 newActive = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 tMenuEdit_set_on_off(editId, newActive);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = newActive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 /* only for OC */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 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
304 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 uint32_t newOxygen, newHelium;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 evaluateNewString(editId, &newOxygen, &newHelium, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 if(newOxygen < 5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 newOxygen = 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 if(newOxygen == 99)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 newOxygen = 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 if(newHelium > 95)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 newHelium = 95;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 if((newOxygen + newHelium) > 100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 newOxygen = 100 - newHelium;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 SDiveState * pDiveState = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 for(int i=1;i<=(2*NUM_GASES);i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 editGasPage.pGasLine[i].note.ub.first = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 if(actual_menu_content == MENU_DIVE_REAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 pDiveState = stateRealGetPointerWrite();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 pDiveState = stateSimGetPointerWrite();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 setActualGas_ExtraGas(&pDiveState->lifeData, newOxygen, newHelium, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 tMEGas_check_switch_to_bailout();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 return EXIT_TO_HOME;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 if(digitContentNew > '9')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 digitContentNew = '9';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 void tMEGas_check_switch_to_bailout(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 SDiveState *pState;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 if(actual_menu_content == MENU_DIVE_REAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 pState = stateRealGetPointerWrite();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 pState = stateSimGetPointerWrite();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 if(pState->diveSettings.diveMode == DIVEMODE_CCR)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 pState->diveSettings.diveMode = DIVEMODE_OC;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370 block_diluent_page();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 }
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 /* surface mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 void openEdit_Gas(uint8_t line, uint8_t ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 uint8_t gasID, oxygen, helium, depthDeco, active, first, depthMOD, deco, travel, inactive;//, bottleSizeLiter;, bottleWirelessStatus;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 //uint16_t bottleWirelessId;//, bottleWirelessIdSmall;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 char textMOD[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383 uint8_t txtptr;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385 if(line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 set_globalState_Menu_Line(line);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388 set_globalState_Menu_Line(NUM_GASES + 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391 resetMenuEdit(CLUT_MenuPageGasCC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393 resetMenuEdit(CLUT_MenuPageGasOC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396 gasID = line + NUM_OFFSET_DILUENT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 gasID = line;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400 editGasPage.ccr = ccr;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 editGasPage.gasID = gasID;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402 editGasPage.mod = calc_MOD(gasID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 SSettings *data = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405 editGasPage.pGasLine = data->gas;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407 oxygen = editGasPage.pGasLine[gasID].oxygen_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408 if(oxygen > 99)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409 oxygen = 99;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410 helium = editGasPage.pGasLine[gasID].helium_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411 depthDeco = editGasPage.pGasLine[gasID].depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412 //depthTravel = editGasPage.pGasLine[gasID].depth_meter_travel;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413 active = editGasPage.pGasLine[gasID].note.ub.active;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414 first = editGasPage.pGasLine[gasID].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415 deco = editGasPage.pGasLine[gasID].note.ub.deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416 travel = editGasPage.pGasLine[gasID].note.ub.travel;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418 //bottleSizeLiter = editGasPage.pGasLine[gasID].bottle_size_liter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 // bottleWirelessStatus = editGasPage.pGasLine[gasID].bottle_wireless_status;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420 //bottleWirelessId = editGasPage.pGasLine[gasID].bottle_wireless_id;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 //bottleWirelessIdSmall = bottleWirelessId & 0x0F;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423 if(active)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424 inactive = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426 inactive = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428 depthMOD = editGasPage.mod;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
430 int i = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
431 if(gasID >= 10)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
432 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433 i = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434 strcpy(text, "\001" "Gas #10 X");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 strcpy(text, "\001" "Gas #0 X");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439 if(ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440 text[8+i] = TXT_Diluent_Gas_Edit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442 text[8+i] = TXT_OC_Gas_Edit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 if(gasID >= 10)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445 text[6+i] += gasID - 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447 text[6+i] += gasID;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450 if(actual_menu_content == MENU_SURFACE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452 write_label_fix( 20, 800, ME_Y_LINE1, &FontT48, TXT_Mix);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453 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
454
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456 text[1] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457 if(inactive)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458 text[0] = TXT_Inactive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
459 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460 if(first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461 text[0] = TXT_First;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463 if(deco)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464 text[0] = TXT_Deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466 if(travel)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467 text[0] = TXT_Travel;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 text[0] = TXT_Inactive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471 write_field_button(StMOG_GasType, 20, 710, ME_Y_LINE2, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 if(deco)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476 text[0] = TXT_ChangeDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477 text[1] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478 text[2] = TXT_Deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479 text[3] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480 write_label_var( 20 ,800, ME_Y_LINE3, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 textMOD[0] = '#';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483 textMOD[1] = '#';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484 textMOD[2] = '#';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
485 textMOD[3] = unit_depth_char1();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486 textMOD[4] = unit_depth_char2();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487 textMOD[5] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488 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
489
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
490 txtptr = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
491 text[txtptr++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
492 text[txtptr++] = TXT2BYTE_SetToMOD;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493 text[txtptr++] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
494 write_field_button(StMOG_SetToMOD, 20, 710, ME_Y_LINE4, &FontT48,text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
495 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
496 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
497 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
498 txtptr = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
499 text[txtptr++] = '\021';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
500 text[txtptr++] = TXT_ChangeDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
501 text[txtptr++] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
502 text[txtptr++] = TXT_Deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
503 text[txtptr++] = 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 txtptr = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
507 text[txtptr++] = '\021';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
508 text[txtptr++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
509 text[txtptr++] = TXT2BYTE_SetToMOD;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
510 text[txtptr++] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
511 write_label_var( 20 ,800, ME_Y_LINE4, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
512 }
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_Bottle;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
517 text[txtptr++] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
518 write_label_var( 20 ,800, ME_Y_LINE5, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
519 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
520
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
521 txtptr = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
522 text[txtptr++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
523 text[txtptr++] = TXT2BYTE_WirelessSender;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524 text[txtptr++] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
525 if(!bottleWirelessId)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
526 text[txtptr++] = '\021';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
527 txtptr += snprintf(&text[txtptr],20,"%u (%04X)",bottleWirelessIdSmall, bottleWirelessId);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
528 write_field_button(StMOG_Wireless, 20, 710, ME_Y_LINE6, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
529 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
530 stop_cursor_fields();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
531
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
532 textMOD[0] = '#';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
533 textMOD[1] = '#';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
534 textMOD[2] = '#';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
535 textMOD[3] = unit_depth_char1();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
536 textMOD[4] = unit_depth_char2();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
537 textMOD[5] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
538 textMOD[6] = 'M';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
539 textMOD[7] = 'O';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
540 textMOD[8] = 'D';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
541 textMOD[9] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
542
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
543 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
544 // 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
545
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
546 setEvent(StMOG_Mix, (uint32_t)OnAction_Mix);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
547 setEvent(StMOG_GasType, (uint32_t)OnAction_GasType);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
548
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
549 if(deco)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
550 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
551 setEvent(StMOG_ChangeDepth, (uint32_t)OnAction_ChangeDepth);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
552 setEvent(StMOG_SetToMOD, (uint32_t)OnAction_SetToMOD);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
553 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
554 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
555 setEvent(StMOG_Bottle, (uint32_t)OnAction_BottleSize);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
556 setEvent(StMOG_Wireless, (uint32_t)OnAction_Wireless);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
557 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
558 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
559 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
560 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
561
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
562 /* surface mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
563 void openEdit_GasType(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
564 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
565 uint8_t gasID, active, first, deco, travel, inactive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
566 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
567
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
568
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
569 if(editGasPage.ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
570 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
571 resetMenuEdit(CLUT_MenuPageGasCC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
572 setBackMenu((uint32_t)openEdit_GasCC, editGasPage.gasID - NUM_OFFSET_DILUENT, 2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
573 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
574 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
575 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
576 resetMenuEdit(CLUT_MenuPageGasOC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
577 setBackMenu((uint32_t)openEdit_GasOC, editGasPage.gasID, 2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
578 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
579
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
580 gasID = editGasPage.gasID;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
581 active = editGasPage.pGasLine[gasID].note.ub.active;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
582 first = editGasPage.pGasLine[gasID].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
583 deco = editGasPage.pGasLine[gasID].note.ub.deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
584 travel = editGasPage.pGasLine[gasID].note.ub.travel;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
585
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
586 if(active)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
587 inactive = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
588 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
589 inactive = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
590
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
591
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
592 /* header */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
593 int i = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
594 if(gasID >= 10)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
595 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
596 i = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
597 strcpy(text, "\001" "Gas #10 X");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
598 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
599 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
600 strcpy(text, "\001" "Gas #0 X");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
601
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
602 if(editGasPage.ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
603 text[8+i] = TXT_Diluent_Gas_Edit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
604 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
605 text[8+i] = TXT_OC_Gas_Edit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
606
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
607 if(gasID >= 10)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
608 text[6+i] += gasID - 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
609 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
610 text[6+i] += gasID;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
611 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
612
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
613 text[1] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
614 text[0] = TXT_First;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
615 write_field_on_off(StMOG_First, 30, 400, ME_Y_LINE1, &FontT48, text, first);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
616
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
617 text[0] = TXT_Deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
618 write_field_on_off(StMOG_Deco, 30, 400, ME_Y_LINE2, &FontT48, text, deco);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
619
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
620 text[0] = TXT_Travel;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
621 write_field_on_off(StMOG_Travel, 30, 400, ME_Y_LINE3, &FontT48, text, travel);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
622
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
623 text[0] = TXT_Inactive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
624 write_field_on_off(StMOG_Inactive, 30, 400, ME_Y_LINE4, &FontT48, text, inactive);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
625
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
626 setEvent(StMOG_First, (uint32_t)OnAction_First);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
627 setEvent(StMOG_Deco, (uint32_t)OnAction_Deco);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
628 setEvent(StMOG_Travel, (uint32_t)OnAction_Travel);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
629 setEvent(StMOG_Inactive, (uint32_t)OnAction_Inactive);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
630
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
631 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
632 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
633
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
634 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
635 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
636 openEdit_GasType();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
637 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
638 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
639
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
640 void openEdit_Wireless(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
641 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
642 uint8_t gasID, wirelessSenderAvailable, isNotMatched, isMatchedWithThis, wirelessSenderActive[MAX_SENDER_AT_ONCE], senderCount, isInList; //, wirelessStatus;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
643 uint16_t wirelessId, wirelessSenderIdSmall, wirelessIdTemp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
644 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
645 uint8_t txtptr;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
646
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
647 if(editGasPage.ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
648 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
649 resetMenuEdit(CLUT_MenuPageGasCC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
650 setBackMenu((uint32_t)openEdit_GasCC, editGasPage.gasID - NUM_OFFSET_DILUENT, 5);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
651 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
652 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
653 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
654 resetMenuEdit(CLUT_MenuPageGasOC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
655 setBackMenu((uint32_t)openEdit_GasOC, editGasPage.gasID, 5);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
656 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
657
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
658 gasID = editGasPage.gasID;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
659 wirelessId = editGasPage.pGasLine[gasID].bottle_wireless_id;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
660 // wirelessStatus = editGasPage.pGasLine[gasID].bottle_wireless_status;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
661
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
662
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
663 /* header */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
664 int i = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
665 if(gasID >= 10)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
666 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
667 i = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
668 strcpy(text, "\001" "Gas #10 X");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
669 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
670 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
671 strcpy(text, "\001" "Gas #0 X");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
672
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
673 if(editGasPage.ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
674 text[8+i] = TXT_Diluent_Gas_Edit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
675 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
676 text[8+i] = TXT_OC_Gas_Edit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
677
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
678 if(gasID >= 10)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
679 text[6+i] += gasID - 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
680 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
681 text[6+i] += gasID;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
682 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
683
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
684 senderCount = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
685 wirelessSenderAvailable = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
686 if(wirelessId)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
687 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
688 wirelessSender[senderCount] = wirelessId;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
689 wirelessSenderActive[senderCount] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
690 wirelessSenderAvailable++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
691 senderCount++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
692 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
693
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
694 for(int i=0;i<4;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
695 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
696 if((stateUsed->lifeData.wireless_data[i].ageInMilliSeconds) && (stateUsed->lifeData.wireless_data[i].ageInMilliSeconds <= 60000) && ((stateUsed->lifeData.wireless_data[i].data[1] & 0x0F) != 0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
697 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
698 wirelessIdTemp = stateUsed->lifeData.wireless_data[i].data[0] * 256;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
699 wirelessIdTemp += stateUsed->lifeData.wireless_data[i].data[1];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
700 if(wirelessId && (wirelessId == wirelessIdTemp))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
701 wirelessSenderActive[0] = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
702 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
703 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
704 isInList = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
705 for(int j=0;j<wirelessSenderAvailable;j++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
706 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
707 if(wirelessSender[j] == wirelessIdTemp)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
708 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
709 isInList = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
710 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
711 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
712 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
713 if(!isInList)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
714 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
715 wirelessSender[senderCount] = wirelessIdTemp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
716 wirelessSenderActive[senderCount] = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
717 wirelessSenderAvailable++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
718 senderCount++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
719 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
720 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
721 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
722 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
723
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
724 if(wirelessSenderAvailable > MAX_SENDER_AT_ONCE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
725 wirelessSenderAvailable = MAX_SENDER_AT_ONCE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
726
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
727 isNotMatched = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
728
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
729 for(int i=0;i<wirelessSenderAvailable;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
730 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
731 wirelessSenderIdSmall = wirelessSender[i] & 0x0F;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
732
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
733 txtptr = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
734 if(!wirelessSenderActive[i])
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
735 text[txtptr++] = '\021';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
736 txtptr += snprintf(&text[txtptr],10,"%u (%04X)",wirelessSenderIdSmall, wirelessSender[i]);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
737
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
738 if(wirelessId == wirelessSender[i])
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
739 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
740 isMatchedWithThis = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
741 isNotMatched = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
742 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
743 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
744 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
745 isMatchedWithThis = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
746 for(int j=1; j <= 2*NUM_GASES; j++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
747 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
748 if((gasID != j) && (settingsGetPointer()->gas[j].bottle_wireless_id == wirelessSender[i]))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
749 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
750 txtptr += snprintf(&text[txtptr],20," used by Gas #%i",i);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
751 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
752 }
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 write_field_on_off(StMOG_Transmitter1 + i, 30, 710, ME_Y_LINE1 + (i * ME_Y_LINE_STEP), &FontT48, text, isMatchedWithThis);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
756 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
757
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
758
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
759 txtptr = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
760 text[txtptr++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
761 text[txtptr++] = TXT2BYTE_WirelessDisconnect;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
762 text[txtptr++] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
763 write_field_on_off(StMOG_NoTransmitter, 30, 400, ME_Y_LINE6, &FontT48, text, isNotMatched);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
764
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
765 // setEvent has to be _after_ all fields are written
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
766 for(int i=0;i<wirelessSenderAvailable;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
767 setEvent(StMOG_Transmitter1 + i, (uint32_t)OnAction_WirelessID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
768
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
769 setEvent(StMOG_NoTransmitter, (uint32_t)OnAction_NoWireless);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
770 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
771
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
772
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
773 uint8_t OnAction_Wireless(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
774 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
775 openEdit_Wireless();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
776 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
777 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
778
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
779
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
780 uint8_t OnAction_WirelessID (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
781 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
782 if((editId < StMOG_Transmitter1) || (editId > StMOG_Transmitter5))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
783 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
784
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
785 uint8_t line, isMatched;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
786
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
787 line = editId - StMOG_Transmitter1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
788
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
789
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
790 if(editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_id == wirelessSender[line])
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
791 isMatched = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
792 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
793 isMatched = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
794
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
795 editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_id = wirelessSender[line];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
796 // editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_status = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
797
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
798 for(int i=0;i<5;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
799 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
800 if((StMOG_Transmitter1 + i) != editId)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
801 tMenuEdit_set_on_off(StMOG_Transmitter1 + i, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
802 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
803 tMenuEdit_set_on_off(editId, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
804 tMenuEdit_set_on_off(StMOG_NoTransmitter, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
805
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
806 if(!isMatched)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
807 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
808 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
809 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
810 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
811
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
812
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
813 uint8_t OnAction_NoWireless (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
814 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
815 uint8_t isNotMatched;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
816
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
817 if(editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_id == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
818 isNotMatched = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
819 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
820 isNotMatched = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
821
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
822 editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_id = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
823 // editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_status = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
824
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
825 tMenuEdit_set_on_off(StMOG_Transmitter1, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
826 tMenuEdit_set_on_off(StMOG_Transmitter2, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
827 tMenuEdit_set_on_off(StMOG_Transmitter3, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
828 tMenuEdit_set_on_off(StMOG_Transmitter4, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
829 tMenuEdit_set_on_off(StMOG_Transmitter5, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
830 tMenuEdit_set_on_off(StMOG_NoTransmitter, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
831
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
832 if(!isNotMatched)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
833 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
834 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
835 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
836 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
837
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
838
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
839 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
840 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
841 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
842 uint32_t newOxygen, newHelium;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
843
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
844 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
845 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
846 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
847 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
848 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
849 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
850 evaluateNewString(editId, &newOxygen, &newHelium, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
851
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
852 if(newOxygen < 5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
853 newOxygen = 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
854 if(newOxygen == 99)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
855 newOxygen = 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
856 if(newHelium > 95)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
857 newHelium = 95;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
858 if((newOxygen + newHelium) > 100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
859 newOxygen = 100 - newHelium;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
860
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
861 editGasPage.pGasLine[editGasPage.gasID].oxygen_percentage = newOxygen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
862 editGasPage.pGasLine[editGasPage.gasID].helium_percentage = newHelium;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
863 editGasPage.mod = calc_MOD(editGasPage.gasID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
864
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
865 if(newOxygen == 100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
866 newOxygen = 99;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
867
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
868 tMenuEdit_newInput(editId, newOxygen, newHelium, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
869 tMenuEdit_newInput(StMOG_MOD, (uint32_t)unit_depth_integer(editGasPage.mod), 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
870
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
871 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
872 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
873 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
874 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
875 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
876 if(digitContentNew > '9')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
877 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
878 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
879 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
880 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
881 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
882 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
883 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
884 digitContentNew = '9';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
885 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
886 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
887
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
888 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
889 }
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 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
893 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
894 uint32_t newOxygen, newHelium;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
895 uint8_t depthDEFAULT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
896 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
897
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
898 newOxygen = 21;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
899 newHelium = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
900
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
901 editGasPage.pGasLine[editGasPage.gasID].oxygen_percentage = newOxygen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
902 editGasPage.pGasLine[editGasPage.gasID].helium_percentage = newHelium;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
903
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
904 tMenuEdit_newInput(StMOG_Mix, newOxygen, newHelium, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
905
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
906 depthDEFAULT = calc_MOD(editGasPage.gasID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
907 create_text_with_u8(text, "", depthDEFAULT, "m MOD");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
908 tMenuEdit_newButtonText(StMOG_DefaultDepth, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
909
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
910 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
911 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
912
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
913 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
914 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
915 uint8_t depth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
916 uint32_t newDefaultDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
917 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
918
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
919 if(editGasPage.depth_mode == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
920 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
921 editGasPage.depth_mode = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
922 depth = editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
923 newDefaultDepth = calc_MinOD(editGasPage.gasID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
924 create_text_with_u8(text, "", newDefaultDepth, "m Min");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
925 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
926 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
927 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
928 editGasPage.depth_mode = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
929 depth = editGasPage.pGasLine[editGasPage.gasID].depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
930 newDefaultDepth = calc_MOD(editGasPage.gasID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
931 create_text_with_u8(text, "", newDefaultDepth, "m MOD");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
932 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
933 tMenuEdit_newInput(StMOG_Depth, (uint32_t)depth, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
934 tMenuEdit_newButtonText(StMOG_DefaultDepth, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
935
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
936 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
937 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
938
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
939
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
940 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
941 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
942 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
943 uint32_t newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
944
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
945 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
946 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
947 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
948 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
949 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
950 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
951 evaluateNewString(editId, &newDepth, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
952 if(newDepth > 255)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
953 newDepth = 255;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
954 if(editGasPage.depth_mode == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
955 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
956 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
957 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
958 tMenuEdit_newInput(editId, newDepth, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
959 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
960 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
961 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
962 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
963 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
964 if(digitContentNew > '9')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
965 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
966 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
967 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
968 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
969 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
970 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
971 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
972 digitContentNew = '9';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
973 return digitContentNew;
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 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
977 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
978
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
979
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
980 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
981 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
982 uint32_t newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
983
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
984 if(editGasPage.depth_mode == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
985 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
986 newDepth = calc_MOD(editGasPage.gasID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
987 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
988 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
989 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
990 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
991 newDepth = calc_MinOD(editGasPage.gasID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
992 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
993 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
994
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
995 tMenuEdit_newInput(StMOG_Depth, newDepth, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
996
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
997 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
998 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
999
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1000
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1001 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
1002 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1003 uint8_t active, first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1004
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1005 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1006
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1007 if(first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1008 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1009
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1010 active = editGasPage.pGasLine[editGasPage.gasID].note.ub.active;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1011
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1012 if(active)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1013 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1014 active = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1015 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1016 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1017 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1018 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1019 active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1020 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1021 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1022 tMenuEdit_set_on_off(editId, active);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1023
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1024 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1025 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1026 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1027
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1028
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1029 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
1030 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1031 uint8_t first, i, gasOne;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1032
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1033 if(editGasPage.ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1034 gasOne = 1 + NUM_OFFSET_DILUENT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1035 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1036 gasOne = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1037
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1038 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1039
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1040 if(!first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1041 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1042 for(i=gasOne;i<NUM_GASES + gasOne;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1043 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1044 if(editGasPage.pGasLine[i].note.ub.first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1045 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1046 editGasPage.pGasLine[i].note.ub.first = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1047 editGasPage.pGasLine[i].note.ub.active = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1048 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1049 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1050 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1051
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1052 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1053 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1054 editGasPage.pGasLine[editGasPage.gasID].note.ub.deco = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1055 editGasPage.pGasLine[editGasPage.gasID].note.ub.travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1056 editGasPage.pGasLine[editGasPage.gasID].depth_meter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1057 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1058
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1059 tMenuEdit_set_on_off(StMOG_First, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1060 tMenuEdit_set_on_off(StMOG_Deco, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1061 tMenuEdit_set_on_off(StMOG_Travel, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1062 tMenuEdit_set_on_off(StMOG_Inactive, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1063
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1064 if(!first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1065 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1066 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1067 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1068 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1069
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1070
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1071 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
1072 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1073 uint8_t first, deco, gasOne;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1074
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1075 if(editGasPage.ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1076 gasOne = 1 + NUM_OFFSET_DILUENT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1077 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1078 gasOne = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1079
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1080 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1081 deco = editGasPage.pGasLine[editGasPage.gasID].note.ub.deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1082
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1083 if(first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1084 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1085 if(editGasPage.gasID == gasOne)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1086 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1087 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1088 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1089 editGasPage.pGasLine[gasOne].note.ub.first = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1090 editGasPage.pGasLine[gasOne].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1091 editGasPage.pGasLine[gasOne].note.ub.deco = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1092 editGasPage.pGasLine[gasOne].note.ub.travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1093 editGasPage.pGasLine[gasOne].depth_meter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1094 editGasPage.pGasLine[gasOne].depth_meter_travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1095 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1096 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1097
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1098 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1099 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1100 editGasPage.pGasLine[editGasPage.gasID].note.ub.deco = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1101 editGasPage.pGasLine[editGasPage.gasID].note.ub.travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1102 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1103 editGasPage.mod = calc_MOD(editGasPage.gasID);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1104 editGasPage.pGasLine[editGasPage.gasID].depth_meter = editGasPage.mod;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1105
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1106 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1107 if(deco)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1108 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1109 editGasPage.pGasLine[editGasPage.gasID].depth_meter = editGasPage.mod;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1110 tMenuEdit_newInput(StMOG_ChangeDepth, editGasPage.pGasLine[editGasPage.gasID].depth_meter, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1111 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1112 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1113
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1114 tMenuEdit_set_on_off(StMOG_First, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1115 tMenuEdit_set_on_off(StMOG_Deco, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1116 tMenuEdit_set_on_off(StMOG_Travel, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1117 tMenuEdit_set_on_off(StMOG_Inactive, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1118
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1119 if(!deco)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1120 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1121 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1122 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1123 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1124
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1125
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1126 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
1127 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1128 uint8_t first, travel, gasOne;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1129
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1130 if(editGasPage.ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1131 gasOne = 1 + NUM_OFFSET_DILUENT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1132 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1133 gasOne = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1134
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1135 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1136 travel = editGasPage.pGasLine[editGasPage.gasID].note.ub.travel;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1137
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1138 if(first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1139 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1140 if(editGasPage.gasID == gasOne)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1141 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1142 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1143 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1144 editGasPage.pGasLine[gasOne].note.ub.first = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1145 editGasPage.pGasLine[gasOne].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1146 editGasPage.pGasLine[gasOne].note.ub.deco = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1147 editGasPage.pGasLine[gasOne].note.ub.travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1148 editGasPage.pGasLine[gasOne].depth_meter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1149 editGasPage.pGasLine[gasOne].depth_meter_travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1150 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1151 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1152
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1153 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1154 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1155 editGasPage.pGasLine[editGasPage.gasID].note.ub.deco = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1156 editGasPage.pGasLine[editGasPage.gasID].note.ub.travel = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1157 editGasPage.pGasLine[editGasPage.gasID].depth_meter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1158 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1159
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1160 tMenuEdit_set_on_off(StMOG_First, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1161 tMenuEdit_set_on_off(StMOG_Deco, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1162 tMenuEdit_set_on_off(StMOG_Travel, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1163 tMenuEdit_set_on_off(StMOG_Inactive, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1164
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1165 if(!travel)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1166 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1167 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1168 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1169 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1170
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1171
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1172 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
1173 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1174 uint8_t first, inactive, gasOne;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1175
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1176 if(editGasPage.ccr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1177 gasOne = 1 + NUM_OFFSET_DILUENT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1178 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1179 gasOne = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1180
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1181 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1182
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1183 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.active)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1184 inactive = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1185 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1186 inactive = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1187
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1188 if(first)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1189 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1190 if(editGasPage.gasID == gasOne)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1191 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1192 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1193 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1194 editGasPage.pGasLine[gasOne].note.ub.first = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1195 editGasPage.pGasLine[gasOne].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1196 editGasPage.pGasLine[gasOne].note.ub.deco = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1197 editGasPage.pGasLine[gasOne].note.ub.travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1198 editGasPage.pGasLine[gasOne].depth_meter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1199 editGasPage.pGasLine[gasOne].depth_meter_travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1200 }
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 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1204 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1205 editGasPage.pGasLine[editGasPage.gasID].note.ub.deco = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1206 editGasPage.pGasLine[editGasPage.gasID].note.ub.travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1207
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1208 tMenuEdit_set_on_off(StMOG_First, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1209 tMenuEdit_set_on_off(StMOG_Deco, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1210 tMenuEdit_set_on_off(StMOG_Travel, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1211 tMenuEdit_set_on_off(StMOG_Inactive, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1212
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1213 if(!inactive)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1214 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1215 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1216 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1217 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1218
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1219
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1220 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
1221 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1222 uint8_t newChangeDepth = editGasPage.mod;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1223
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1224 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newChangeDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1225 tMenuEdit_newInput(StMOG_ChangeDepth, unit_depth_integer(newChangeDepth), 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1226
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1227 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1228 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1229
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1230
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1231 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
1232 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1233 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1234 uint32_t newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1235
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1236 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1237 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1238 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1239 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1240 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1241 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1242 evaluateNewString(editId, &newDepth, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1243 if(settingsGetPointer()->nonMetricalSystem != 0) // new hw 170703
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1244 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1245 newDepth += 2; // f�r rundung
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1246 newDepth = (newDepth * 3) / 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1247 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1248 if(newDepth > 255)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1249 newDepth = 255;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1250 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1251 tMenuEdit_newInput(editId, unit_depth_integer(newDepth), 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1252 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1253 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1254 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1255 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1256 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1257 if(digitContentNew > '9')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1258 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1259 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1260 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1261 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1262 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1263 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1264 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1265 digitContentNew = '9';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1266 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1267 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1268
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1269 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1270 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1271
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1272
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1273 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
1274 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1275 int8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1276 uint32_t newBottleSize;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1277 // 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
1278 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
1279
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1280 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1281 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1282 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1283 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1284 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1285 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1286 evaluateNewString(editId, &newBottleSize, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1287
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1288 if(newBottleSize > validSize[0])
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1289 newBottleSize = validSize[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1290
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1291 editGasPage.pGasLine[editGasPage.gasID].bottle_size_liter = newBottleSize;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1292
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1293 tMenuEdit_newInput(editId, newBottleSize, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1294 return UPDATE_DIVESETTINGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1295 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1296 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1297 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1298 // new here for ease of comparison
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1299 digitContentNew = digitContent - '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1300
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1301 if(digitContentNew > 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1302 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1303 int i = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1304 while(digitContentNew < validSize[i])
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1305 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1306 i++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1307 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1308 if(i == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1309 digitContentNew = 0; // off
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1310 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1311 digitContentNew = validSize[i-1];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1312 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1313 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1314 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1315 int i = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1316 while(validSize[i] != 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1317 i++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1318 digitContentNew = validSize[i-1]; // smallest tank
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1319 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1320 digitContentNew += '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1321 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1322 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1323 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1324 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1325 // new here for ease of comparison
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1326 digitContentNew = digitContent - '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1327 if(digitContentNew > 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1328 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1329 int i = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1330 while(digitContentNew < validSize[i])
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1331 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1332 i++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1333 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1334 if(validSize[i] == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1335 digitContentNew = 0; // off
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1336 else if(validSize[i+1] == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1337 digitContentNew = 0; // off
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1338 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1339 digitContentNew = validSize[i+1];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1340 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1341 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1342 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1343 digitContentNew = validSize[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1344 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1345 digitContentNew += '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1346
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1347 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1348 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1349 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1350 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1351
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1352
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1353 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1354
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1355
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1356 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
1357 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1358 uint8_t digit1, digit2, digit3, count;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1359
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1360 count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1361
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1362 if(*text1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1363 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1364 strcpy(&text[count], text1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1365 count = strlen(text1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1366 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1367
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1368 digit1 = inputU8 / 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1369 inputU8 -= digit1 * 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1370 digit2 = inputU8 / 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1371 inputU8 -= digit2 * 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1372 digit3 = inputU8;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1373 if(digit1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1374 text[count++] = '0' + digit1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1375 if(count || digit2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1376 text[count++] = '0' + digit2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1377 text[count++] = '0' + digit3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1378
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1379 if(*text2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1380 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1381 strcpy(&text[count], text2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1382 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1383 }