annotate Discovery/Src/tMenuEditDecoParameter.c @ 211:85bd5fea5e08 cv-persistent

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