38
|
1 ///////////////////////////////////////////////////////////////////////////////
|
|
2 /// -*- coding: UTF-8 -*-
|
|
3 ///
|
|
4 /// \file Discovery/Src/tMenuSystem.c
|
|
5 /// \brief Main Template file for Menu Page System settings
|
|
6 /// \author heinrichs weikamp gmbh
|
|
7 /// \date 05-Aug-2014
|
|
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 "tMenu.h"
|
|
31 #include "tMenuSystem.h"
|
|
32 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass()
|
|
33
|
|
34 /* Private function prototypes -----------------------------------------------*/
|
|
35 char customview_TXT2BYTE_helper(uint8_t customViewId);
|
|
36
|
|
37 /* Exported functions --------------------------------------------------------*/
|
|
38
|
|
39 uint32_t tMSystem_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext)
|
|
40 {
|
|
41 SSettings *data;
|
|
42 uint8_t textPointer;
|
|
43 uint8_t dateFormat;
|
|
44 uint8_t RTEhigh, RTElow;
|
|
45 RTC_DateTypeDef Sdate;
|
|
46 RTC_TimeTypeDef Stime;
|
|
47 const SDiveState * pStateReal = stateRealGetPointer();
|
|
48 extern SDataExchangeSlaveToMaster dataIn;
|
|
49
|
|
50 data = settingsGetPointer();
|
|
51 textPointer = 0;
|
|
52 *tab = 300;
|
|
53 *subtext = 0;
|
|
54
|
|
55 // dive mode
|
|
56 if(actual_menu_content != MENU_SURFACE)
|
|
57 {
|
|
58 uint8_t id;
|
|
59
|
|
60 for(int i=0; i<6;i++)
|
|
61 {
|
|
62 id = cv_changelist[i];
|
|
63 text[textPointer++] = '\006' - CHECK_BIT_THOME(cv_configuration,id);
|
|
64 text[textPointer++] = ' ';
|
|
65 textPointer += snprintf(&text[textPointer], 60,
|
|
66 "%c%c\n\r",
|
|
67 TXT_2BYTE, customview_TXT2BYTE_helper(id)
|
|
68 );
|
|
69 }
|
|
70 text[textPointer] = 0;
|
|
71
|
|
72 return StMSYS;
|
|
73 }
|
|
74
|
|
75 // surface mode
|
|
76 RTEhigh = dataIn.RTE_VERSION_high;
|
|
77 RTElow = dataIn.RTE_VERSION_low;
|
|
78
|
|
79 if((RTEhigh == 0xFF) || (RTElow == 0xFF))
|
|
80 {
|
|
81 RTEhigh = 0;
|
|
82 RTElow = 0;
|
|
83 }
|
|
84
|
|
85 if((line == 0) || (line == 1))
|
|
86 {
|
|
87 translateDate(pStateReal->lifeData.dateBinaryFormat, &Sdate);
|
|
88 translateTime(pStateReal->lifeData.timeBinaryFormat, &Stime);
|
|
89
|
|
90 dateFormat = data->date_format;
|
|
91
|
|
92 textPointer += snprintf(&text[textPointer], 40,
|
|
93 "Date"
|
|
94 "\016\016"
|
|
95 " "
|
|
96 );
|
|
97
|
|
98 if(dateFormat == DDMMYY)
|
|
99 {
|
|
100 textPointer += snprintf(&text[textPointer], 40,
|
|
101 "DDMMYY"
|
|
102 "\017"
|
|
103 "\t"
|
|
104 "%02d-%02d-%02d"
|
|
105 " "
|
|
106 , Sdate.Date, Sdate.Month, 2000 + Sdate.Year
|
|
107 );
|
|
108 }
|
|
109 else
|
|
110 if(dateFormat == MMDDYY)
|
|
111 {
|
|
112 textPointer += snprintf(&text[textPointer], 40,
|
|
113 "MMDDYY"
|
|
114 "\017"
|
|
115 "\t"
|
|
116 "%02d-%02d-%02d"
|
|
117 " "
|
|
118 ,Sdate.Month, Sdate.Date, 2000 + Sdate.Year
|
|
119 );
|
|
120 }
|
|
121 else
|
|
122 if(dateFormat == YYMMDD)
|
|
123 {
|
|
124 textPointer += snprintf(&text[textPointer], 40,
|
|
125 "YYMMDD"
|
|
126 "\017"
|
|
127 "\t"
|
|
128 "%02d-%02d-%02d"
|
|
129 " "
|
|
130 , 2000 + Sdate.Year, Sdate.Month, Sdate.Date
|
|
131 );
|
|
132 }
|
|
133
|
|
134 textPointer += snprintf(&text[textPointer], 60,
|
|
135 "%02d:%02d:%02d"
|
|
136 "\n\r"
|
|
137 ,Stime.Hours, Stime.Minutes, Stime.Seconds
|
|
138 );
|
|
139 }
|
|
140 else
|
|
141 {
|
|
142 strcpy(&text[textPointer],"\n\r");
|
|
143 textPointer += 2;
|
|
144 }
|
|
145
|
|
146 if((line == 0) || (line == 2))
|
|
147 {
|
|
148 text[textPointer++] = TXT_Language;
|
|
149 text[textPointer++] = '\t';
|
|
150 text[textPointer++] = TXT_LanguageName;
|
|
151 text[textPointer++] = '\n';
|
|
152 text[textPointer++] = '\r';
|
|
153 text[textPointer] = 0;
|
|
154 }
|
|
155 else
|
|
156 {
|
|
157 strcpy(&text[textPointer],"\n\r");
|
|
158 textPointer += 2;
|
|
159 }
|
|
160
|
|
161 if((line == 0) || (line == 3))
|
|
162 {
|
|
163 text[textPointer++] = TXT_2BYTE;
|
|
164 text[textPointer++] = TXT2BYTE_Layout;
|
|
165 text[textPointer++] = '\t';
|
|
166
|
|
167 if(!data->showDebugInfo)
|
|
168 {
|
|
169 text[textPointer++] = TXT_2BYTE;
|
|
170 if(data->nonMetricalSystem == 0)
|
|
171 text[textPointer++] = TXT2BYTE_Units_metric;
|
|
172 else
|
|
173 text[textPointer++] = TXT2BYTE_Units_feet;
|
|
174
|
|
175 if(data->tX_colorscheme != 0)
|
|
176 {
|
|
177 text[textPointer++] = ' ';
|
|
178 text[textPointer++] = ' ';
|
|
179 text[textPointer++] = ' ';
|
|
180 text[textPointer++] = ' ';
|
|
181 text[textPointer++] = '\027';
|
|
182 text[textPointer++] = '/';
|
|
183 text[textPointer++] = ' ';
|
|
184 text[textPointer++] = '0' + data->tX_colorscheme;
|
|
185 text[textPointer++] = '\020';
|
|
186 }
|
|
187 }
|
|
188 else
|
|
189 {
|
|
190 if(data->nonMetricalSystem == 0)
|
|
191 {
|
|
192 text[textPointer++] = 'm';
|
|
193 text[textPointer++] = '/';
|
|
194 text[textPointer++] = 'C';
|
|
195 }
|
|
196 else
|
|
197 {
|
|
198 text[textPointer++] = 'f';
|
|
199 text[textPointer++] = 't';
|
|
200 text[textPointer++] = '/';
|
|
201 text[textPointer++] = 'F';
|
|
202 }
|
|
203
|
|
204 text[textPointer++] = ' ';
|
|
205 text[textPointer++] = ' ';
|
|
206 text[textPointer++] = ' ';
|
|
207 text[textPointer++] = ' ';
|
|
208 text[textPointer++] = '\027';
|
|
209 text[textPointer++] = '/';
|
|
210 text[textPointer++] = ' ';
|
|
211 text[textPointer++] = '0' + data->tX_colorscheme;
|
|
212 text[textPointer++] = '\020';
|
|
213 text[textPointer++] = ' ';
|
|
214 text[textPointer++] = ' ';
|
|
215 text[textPointer++] = 'd';
|
|
216 text[textPointer++] = 'e';
|
|
217 text[textPointer++] = 'b';
|
|
218 text[textPointer++] = 'u';
|
|
219 text[textPointer++] = 'g';
|
|
220 }
|
|
221
|
|
222 text[textPointer++] = '\n';
|
|
223 text[textPointer++] = '\r';
|
|
224 text[textPointer] = 0;
|
|
225 }
|
|
226 else
|
|
227 {
|
|
228 strcpy(&text[textPointer],"\n\r");
|
|
229 textPointer += 2;
|
|
230 }
|
|
231
|
|
232 if((line == 0) || (line == 4))
|
|
233 {
|
|
234 text[textPointer++] = TXT_2BYTE;
|
|
235 text[textPointer++] = TXT2BYTE_Customviews;//TXT2BYTE_ShowDebug;
|
|
236 }
|
|
237 text[textPointer++] = '\n';
|
|
238 text[textPointer++] = '\r';
|
|
239 text[textPointer] = 0;
|
|
240
|
|
241 if((line == 0) || (line == 5))
|
|
242 {
|
|
243 text[textPointer++] = TXT_Information;
|
|
244 text[textPointer++] = '\t';
|
|
245 textPointer += snprintf(&text[textPointer],29,"RTE %u.%u OS %i.%i.%i"
|
|
246 ,RTEhigh
|
|
247 ,RTElow
|
|
248 ,firmwareDataGetPointer()->versionFirst
|
|
249 ,firmwareDataGetPointer()->versionSecond
|
|
250 ,firmwareDataGetPointer()->versionThird
|
|
251 );
|
|
252 }
|
|
253 strcpy(&text[textPointer],"\n\r");
|
|
254 textPointer += 2;
|
|
255
|
|
256 if((line == 0) || (line == 6))
|
|
257 {
|
|
258 text[textPointer++] = TXT_2BYTE;
|
|
259 text[textPointer++] = TXT2BYTE_ResetMenu;
|
|
260 text[textPointer] = 0;
|
|
261 }
|
|
262 strcpy(&text[textPointer],"\n\r");
|
|
263 textPointer += 2;
|
|
264
|
|
265 return StMSYS;
|
|
266 }
|
|
267
|
|
268
|
|
269 /* Private functions ---------------------------------------------------------*/
|
|
270
|
|
271 char customview_TXT2BYTE_helper(uint8_t customViewId)
|
|
272 {
|
|
273 char text = 0;
|
|
274
|
|
275 switch(customViewId)
|
|
276 {
|
|
277 case CVIEW_sensors:
|
|
278 text = TXT2BYTE_O2monitor;
|
|
279 break;
|
|
280 case CVIEW_sensors_mV:
|
|
281 text = TXT2BYTE_O2voltage;
|
|
282 break;
|
|
283 case CVIEW_Compass:
|
|
284 text = TXT2BYTE_Compass;
|
|
285 break;
|
|
286 case CVIEW_Decolist:
|
|
287 text = TXT2BYTE_Decolist;
|
|
288 break;
|
|
289 case CVIEW_Tissues:
|
|
290 text = TXT2BYTE_Tissues;
|
|
291 break;
|
|
292 case CVIEW_Profile:
|
|
293 text = TXT2BYTE_Profile;
|
|
294 break;
|
|
295 case CVIEW_Gaslist:
|
|
296 text = TXT2BYTE_Gaslist;
|
|
297 break;
|
|
298 case CVIEW_EADTime:
|
|
299 text = TXT2BYTE_Info;
|
|
300 break;
|
|
301 case CVIEW_SummaryOfLeftCorner:
|
|
302 text = TXT2BYTE_Summary;
|
|
303 break;
|
|
304 case CVIEW_noneOrDebug:
|
|
305 break;
|
|
306 default:
|
|
307 break;
|
|
308 }
|
|
309 return text;
|
|
310 }
|