annotate Discovery/Src/tMenuEditDecoParameter.c @ 417:54a480c43e97 v1.5.2.beta release

1.5.2 beta with RTE 2.02
author heinrichsweikamp
date Wed, 15 Jan 2020 13:41:01 +0100
parents ba229a012ac7
children d4622533271d
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 -----------------------------------------------*/
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
39 static void openEdit_DecoAlgorithm(void);
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
40 static void openEdit_DecoGF(void);
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
41 static void openEdit_DecoAltGF(void);
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
42 static void openEdit_DecoVPM(void);
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
43 static void openEdit_DecoLastStop(void);
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
44 static void openEdit_DM_SwitchAlgorithm(uint8_t line);
38
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 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
54 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
55 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
56 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 void openEdit_DecoParameter(uint8_t line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 set_globalState_Menu_Line(line);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 resetMenuEdit(CLUT_MenuPageDecoParameter);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 if(actual_menu_content == MENU_SURFACE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 switch(line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 case 1:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 default:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 openEdit_DecoAlgorithm();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 case 2:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 openEdit_DecoVPM();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 case 3:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 openEdit_DecoGF();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 case 4:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 openEdit_DecoAltGF();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 case 5:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 openEdit_DecoLastStop();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 case 6:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 break;
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 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 openEdit_DM_SwitchAlgorithm(line);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
93 static void openEdit_DM_SwitchAlgorithm(uint8_t line)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 switch(line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 case 1:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 default:
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
99 stateUsedWrite->diveSettings.deco_type.ub.standard = VPM_MODE;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 case 2:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
103 stateUsedWrite->diveSettings.gf_high = settingsGetPointer()->GF_high;
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
104 stateUsedWrite->diveSettings.gf_low = settingsGetPointer()->GF_low;
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
105 stateUsedWrite->diveSettings.deco_type.ub.standard = GF_MODE;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 case 3:
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
108 stateUsedWrite->diveSettings.gf_high = settingsGetPointer()->aGF_high;
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
109 stateUsedWrite->diveSettings.gf_low = settingsGetPointer()->aGF_low;
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
110 stateUsedWrite->diveSettings.deco_type.ub.standard = GF_MODE;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 exitMenuEdit_to_Home_with_Menu_Update();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
117 static void openEdit_DecoAlgorithm(void)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 SSettings *pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 if(pSettings->deco_type.ub.standard == VPM_MODE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 pSettings->deco_type.ub.standard = GF_MODE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 pSettings->deco_type.ub.standard = VPM_MODE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 exitEditWithUpdate();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
130 static void openEdit_DecoVPM(void)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 uint8_t vpm;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 SSettings *pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 vpm = pSettings->VPM_conservatism.ub.standard;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 text[1] = TXT_Decoparameters;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 text[2] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 write_label_var( 20, 800, ME_Y_LINE2, &FontT48, "VPM");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 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
146
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 setEvent(StMDECOP2_VPM, (uint32_t)OnAction_VPM);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 startEdit();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
154 static void openEdit_DecoGF(void)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 uint8_t gfLow,gfHigh;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 SSettings *pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 gfLow = pSettings->GF_low;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 gfHigh = pSettings->GF_high;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 text[1] = TXT_Decoparameters;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 text[2] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 write_label_var( 20, 800, ME_Y_LINE3, &FontT48, "GF\016\016low/high\017");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 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
171
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 setEvent(StMDECOP3_GF, (uint32_t)OnAction_GF);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 startEdit();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
179 static void openEdit_DecoAltGF(void)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 uint8_t aGfLow,aGfHigh;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 SSettings *pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 aGfLow = pSettings->aGF_low;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 aGfHigh = pSettings->aGF_high;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 text[1] = TXT_Decoparameters;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 text[2] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 write_label_var( 20, 800, ME_Y_LINE4, &FontT48, "aGF\016\016low/high\017");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 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
195
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 setEvent(StMDECOP4_AltGF, (uint32_t)OnAction_AltGF);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 startEdit();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
203 static void openEdit_DecoLastStop(void)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 uint8_t lastStop;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 SSettings *pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 lastStop = pSettings->last_stop_depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 text[1] = TXT_LastDecostop;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 text[2] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 write_label_fix( 20, 800, ME_Y_LINE5, &FontT48, TXT_LastDecostop);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 if(settingsGetPointer()->nonMetricalSystem)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 write_label_var( MEDP_TAB + 40, 800, ME_Y_LINE5, &FontT48, "\016\016 ft\017");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 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
222 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 write_label_var( MEDP_TAB + 20, 800, ME_Y_LINE5, &FontT48, "\016\016 meter\017");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 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
227 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 setEvent(StMDECOP5_LASTSTOP, (uint32_t)OnAction_LastStop);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 startEdit();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 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
235 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 SSettings *pSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 uint32_t newConservatism;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 evaluateNewString(editId, &newConservatism, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 if(newConservatism > 5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 newConservatism = 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 pSettings->VPM_conservatism.ub.standard = newConservatism;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 tMenuEdit_newInput(editId, newConservatism, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 if(digitContentNew > '5')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 digitContentNew = '5';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 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
276 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 SSettings *pSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 uint32_t newGFlow, newGFhigh;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 evaluateNewString(editId, &newGFlow, &newGFhigh, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 if(newGFlow < 10)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 newGFlow = 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 if(newGFhigh < 45)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 newGFhigh = 45;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 if(newGFlow > 99)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 newGFlow = 99;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 if(newGFhigh > 99)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 newGFhigh = 99;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297 pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298 pSettings->GF_low = newGFlow;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 pSettings->GF_high= newGFhigh;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 tMenuEdit_newInput(editId, newGFlow, newGFhigh, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 if(digitContentNew > '9')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 digitContentNew = '9';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 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
322 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 SSettings *pSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 uint32_t newGFlow, newGFhigh;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 evaluateNewString(editId, &newGFlow, &newGFhigh, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 if(newGFlow < 10)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 newGFlow = 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 if(newGFhigh < 45)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 newGFhigh = 45;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 if(newGFlow > 99)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 newGFlow = 99;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 if(newGFhigh > 99)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 newGFhigh = 99;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 pSettings->aGF_low = newGFlow;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 pSettings->aGF_high= newGFhigh;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347 tMenuEdit_newInput(editId, newGFlow, newGFhigh, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353 if(digitContentNew > '9')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 digitContentNew = '9';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 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
370 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 SSettings *pSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373 uint32_t lastStop;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 evaluateNewString(editId, &lastStop, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383 if(settingsGetPointer()->nonMetricalSystem != 0) // new hw 170718
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385 lastStop += 2; // f�r rundung
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 lastStop = (lastStop * 3) / 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389 pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391 pSettings->last_stop_depth_meter = lastStop;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393 tMenuEdit_newInput(editId, lastStop, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397 if(settingsGetPointer()->nonMetricalSystem)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 // 10, 13, 17, 20
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402 if(digitContent < 13 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403 digitContentNew = 13 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 else if(digitContent < 16 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405 digitContentNew = 16 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406 else if(digitContent < 20 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407 digitContentNew = 20 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409 digitContentNew = 10 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416 if(digitContent >= 20 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417 digitContentNew = 16 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418 else if(digitContent >= 16 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 digitContentNew = 13 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420 else if(digitContent >= 13 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 digitContentNew = 10 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423 digitContentNew = 20 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
430 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
431 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
432 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433 if(digitContentNew > '6')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434 digitContentNew = '3';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440 if(digitContentNew < '3')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 digitContentNew = '6';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 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
450 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
451 stateUsedWrite->diveSettings.deco_type.ub.standard = VPM_MODE;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452 return EXIT_TO_HOME;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453 }
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 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
457 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458 SSettings *pSettings = settingsGetPointer();
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
459
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
460 stateUsedWrite->diveSettings.gf_high = pSettings->GF_high;
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
461 stateUsedWrite->diveSettings.gf_low = pSettings->GF_low;
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
462 stateUsedWrite->diveSettings.deco_type.ub.standard = GF_MODE;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463 return EXIT_TO_HOME;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467 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
468 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
469 SSettings *pSettings = settingsGetPointer();
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
470
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
471 stateUsedWrite->diveSettings.gf_high = pSettings->aGF_high;
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
472 stateUsedWrite->diveSettings.gf_low = pSettings->aGF_low;
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
473 stateUsedWrite->diveSettings.deco_type.ub.standard = GF_MODE;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 return EXIT_TO_HOME;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475 }