38
|
1 ///////////////////////////////////////////////////////////////////////////////
|
|
2 /// -*- coding: UTF-8 -*-
|
|
3 ///
|
|
4 /// \file Discovery/Src/tMenuDecoParameter.c
|
|
5 /// \brief Deco Parameter
|
|
6 /// \author heinrichs weikamp gmbh
|
|
7 /// \date 02-Feb-2015
|
|
8 ///
|
|
9 /// \details
|
|
10 ///
|
|
11 /// $Id$
|
|
12 ///////////////////////////////////////////////////////////////////////////////
|
|
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
|
|
14 ///
|
|
15 /// This program is free software: you can redistribute it and/or modify
|
|
16 /// it under the terms of the GNU General Public License as published by
|
|
17 /// the Free Software Foundation, either version 3 of the License, or
|
|
18 /// (at your option) any later version.
|
|
19 ///
|
|
20 /// This program is distributed in the hope that it will be useful,
|
|
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
23 /// GNU General Public License for more details.
|
|
24 ///
|
|
25 /// You should have received a copy of the GNU General Public License
|
|
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
27 //////////////////////////////////////////////////////////////////////////////
|
|
28
|
|
29 /* Includes ------------------------------------------------------------------*/
|
|
30 #include <stdio.h>
|
|
31 #include <string.h>
|
|
32 #include "tMenu.h"
|
|
33 #include "tStructure.h"
|
|
34 #include "tMenuDecoParameter.h"
|
|
35 #include "text_multilanguage.h"
|
|
36 #include "settings.h"
|
|
37 #include "data_central.h"
|
|
38 #include "unit.h"
|
|
39
|
|
40 #define MDP_TAB (380)
|
|
41
|
|
42 /* Exported functions --------------------------------------------------------*/
|
|
43
|
|
44 uint32_t tMDecoParameters_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext)
|
|
45 {
|
|
46 uint8_t decoType, VpmConsveratism, GFlow, GFhigh, aGFlow, aGFhigh;
|
|
47 int8_t mode;
|
|
48 uint8_t textPointer;
|
|
49 uint8_t lastStop;
|
|
50 char decotypeTxtId;
|
|
51
|
|
52 textPointer = 0;
|
|
53 *tab = MDP_TAB;
|
|
54 *subtext = 0;
|
|
55
|
|
56 if(actual_menu_content != MENU_SURFACE)
|
|
57 {
|
|
58 const SDiveSettings * pDiveSettings;
|
|
59
|
|
60 if(actual_menu_content == MENU_DIVE_REAL)
|
|
61 {
|
|
62 const SDiveState * pState = stateRealGetPointer();
|
|
63 pDiveSettings = &pState->diveSettings;
|
|
64 }
|
|
65 else
|
|
66 {
|
|
67 const SDiveState * pState = stateSimGetPointer();
|
|
68 pDiveSettings = &pState->diveSettings;
|
|
69 }
|
|
70
|
|
71 if(pDiveSettings->deco_type.ub.standard == VPM_MODE)
|
|
72 mode = VPM_MODE;
|
|
73 else
|
|
74 if((pDiveSettings->gf_high == settingsGetPointer()->GF_high) && (pDiveSettings->gf_low == settingsGetPointer()->GF_low))
|
|
75 mode = GF_MODE;
|
|
76 else
|
|
77 mode = -1;
|
|
78
|
|
79
|
|
80 VpmConsveratism = pDiveSettings->vpm_conservatism;
|
|
81 GFlow = settingsGetPointer()->GF_low;
|
|
82 GFhigh = settingsGetPointer()->GF_high;
|
|
83 aGFlow = settingsGetPointer()->aGF_low;
|
|
84 aGFhigh = settingsGetPointer()->aGF_high;
|
|
85
|
|
86 text[textPointer++] = '\006' - (mode == VPM_MODE);
|
|
87 text[textPointer++] = ' ';
|
|
88 textPointer += snprintf(&text[textPointer], 60,\
|
|
89 "VPM"
|
|
90 "\t"
|
|
91 "+"
|
|
92 "%u"
|
|
93 "\n\r"
|
|
94 , VpmConsveratism
|
|
95 );
|
|
96
|
|
97 text[textPointer++] = '\006' - (mode == GF_MODE);
|
|
98 text[textPointer++] = ' ';
|
|
99 textPointer += snprintf(&text[textPointer], 60,\
|
|
100 "GF"
|
|
101 "\016\016"
|
|
102 "low/high"
|
|
103 "\017"
|
|
104 "\t"
|
|
105 "%u"
|
|
106 "/"
|
|
107 "%u"
|
|
108 "\n\r"
|
|
109 , GFlow, GFhigh
|
|
110 );
|
|
111
|
|
112 text[textPointer++] = '\006' - (mode == -1);
|
|
113 text[textPointer++] = ' ';
|
|
114 textPointer += snprintf(&text[textPointer], 60,\
|
|
115 "aGF"
|
|
116 "\016\016"
|
|
117 "low/high"
|
|
118 "\017"
|
|
119 "\t"
|
|
120 "%u"
|
|
121 "/"
|
|
122 "%u"
|
|
123 "\n\r"
|
|
124 , aGFlow, aGFhigh
|
|
125 );
|
|
126
|
|
127 text[textPointer++] = 0;
|
|
128 return StMDECOP;
|
|
129 }
|
|
130
|
|
131 SSettings *data = settingsGetPointer();
|
|
132
|
|
133 decoType = settingsGetPointer()->deco_type.ub.standard;
|
|
134 VpmConsveratism = data->VPM_conservatism.ub.standard;
|
|
135 GFlow = data->GF_low;
|
|
136 GFhigh = data->GF_high;
|
|
137 aGFlow = data->aGF_low;
|
|
138 aGFhigh = data->aGF_high;
|
|
139 lastStop = data->last_stop_depth_meter;
|
|
140
|
|
141 if((line == 0) || (line == 1))
|
|
142 {
|
|
143 if(decoType == VPM_MODE)
|
|
144 decotypeTxtId = TXT_VPM;
|
|
145 else
|
|
146 decotypeTxtId = TXT_ZHL16GF;
|
|
147
|
|
148 textPointer += snprintf(&text[textPointer], 60,\
|
|
149 "%c"
|
902
|
150 "\t "
|
38
|
151 "%c"
|
|
152 , TXT_DecoAlgorithm
|
|
153 , decotypeTxtId
|
|
154 );
|
|
155 }
|
|
156 strcpy(&text[textPointer],"\n\r");
|
|
157 textPointer += 2;
|
|
158
|
|
159 if((line == 0) || (line == 2))
|
|
160 {
|
|
161 textPointer += snprintf(&text[textPointer], 60,\
|
|
162 "VPM"
|
902
|
163 "\t "
|
38
|
164 "+"
|
|
165 "%u"
|
|
166 , VpmConsveratism
|
|
167 );
|
|
168 }
|
|
169 strcpy(&text[textPointer],"\n\r");
|
|
170 textPointer += 2;
|
|
171
|
|
172 if((line == 0) || (line == 3))
|
|
173 {
|
|
174 textPointer += snprintf(&text[textPointer], 60,\
|
|
175 "GF"
|
|
176 "\016\016"
|
|
177 "low/high"
|
|
178 "\017"
|
902
|
179 "\t "
|
38
|
180 "%u"
|
|
181 "/"
|
|
182 "%u"
|
|
183 , GFlow, GFhigh
|
|
184 );
|
|
185 }
|
|
186 strcpy(&text[textPointer],"\n\r");
|
|
187 textPointer += 2;
|
|
188
|
|
189 if((line == 0) || (line == 4))
|
|
190 {
|
|
191 textPointer += snprintf(&text[textPointer], 60,\
|
|
192 "aGF"
|
|
193 "\016\016"
|
|
194 "low/high"
|
|
195 "\017"
|
902
|
196 "\t "
|
38
|
197 "%u"
|
|
198 "/"
|
|
199 "%u"
|
|
200 , aGFlow, aGFhigh
|
|
201 );
|
|
202 }
|
|
203 strcpy(&text[textPointer],"\n\r");
|
|
204 textPointer += 2;
|
|
205
|
|
206 if((line == 0) || (line == 5))
|
|
207 {
|
|
208 textPointer += snprintf(&text[textPointer], 60,\
|
|
209 "%c"
|
902
|
210 "\t "
|
38
|
211 "%u"
|
|
212 "\016\016"
|
|
213 " %c%c"
|
|
214 "\017"
|
|
215 , TXT_LastDecostop
|
|
216 , unit_depth_integer(lastStop)
|
|
217 , unit_depth_char1()
|
|
218 , unit_depth_char2()
|
|
219 );
|
|
220 }
|
|
221 strcpy(&text[textPointer],"\n\r");
|
|
222 textPointer += 2;
|
902
|
223 if((line == 0) || (line == 6))
|
|
224 {
|
|
225 textPointer+= snprintf(&text[textPointer], 60, "%c%c\t ",TXT_2BYTE,TXT2BYTE_VpmTable);
|
|
226 if(settingsGetPointer()->VPM_conservatism.ub.alternative)
|
|
227 text[textPointer++] = '\005';
|
|
228 else
|
|
229 text[textPointer++] = '\006';
|
|
230 text[textPointer] = 0;
|
|
231 }
|
|
232 strcpy(&text[textPointer],"\n\r");
|
|
233 textPointer += 2;
|
38
|
234
|
|
235 return StMDECOP;
|
|
236 }
|