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()
|
851
|
33 #include "t7.h"
|
38
|
34
|
379
|
35 static uint8_t customviewsSubpage = 0;
|
|
36
|
38
|
37 /* Private function prototypes -----------------------------------------------*/
|
|
38 char customview_TXT2BYTE_helper(uint8_t customViewId);
|
|
39
|
379
|
40 void set_CustomsviewsSubpage(uint8_t page)
|
|
41 {
|
|
42 customviewsSubpage = page;
|
|
43 }
|
|
44
|
38
|
45 /* Exported functions --------------------------------------------------------*/
|
|
46
|
|
47 uint32_t tMSystem_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext)
|
|
48 {
|
|
49 SSettings *data;
|
379
|
50 int i;
|
38
|
51 uint8_t textPointer;
|
|
52 uint8_t RTEhigh, RTElow;
|
|
53 RTC_DateTypeDef Sdate;
|
|
54 RTC_TimeTypeDef Stime;
|
|
55 const SDiveState * pStateReal = stateRealGetPointer();
|
|
56
|
|
57 data = settingsGetPointer();
|
|
58 textPointer = 0;
|
|
59 *tab = 300;
|
|
60 *subtext = 0;
|
944
|
61 char tmpString[15];
|
38
|
62
|
815
|
63 resetLineMask(StMSYS);
|
|
64
|
38
|
65 // dive mode
|
|
66 if(actual_menu_content != MENU_SURFACE)
|
|
67 {
|
|
68 uint8_t id;
|
|
69
|
379
|
70 for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */
|
38
|
71 {
|
379
|
72 id = cv_changelist[customviewsSubpage * 5 + i];
|
|
73 if(id == CVIEW_END) /* last list item? */
|
|
74 {
|
|
75 break;
|
|
76 }
|
|
77 else
|
|
78 {
|
|
79 text[textPointer++] = '\006' - CHECK_BIT_THOME(data->cv_configuration,id);
|
|
80 text[textPointer++] = ' ';
|
|
81 textPointer += snprintf(&text[textPointer], 60,
|
|
82 "%c%c\n\r",
|
|
83 TXT_2BYTE, customview_TXT2BYTE_helper(id));
|
|
84 }
|
38
|
85 }
|
|
86
|
379
|
87 for(;i<5;i++) /* clear empty lines in case menu shows less than 5 entries */
|
|
88 {
|
|
89 text[textPointer++]='\n';
|
|
90 text[textPointer++]='\r';
|
|
91 text[textPointer] = 0;
|
815
|
92 switch(i)
|
|
93 {
|
|
94 case 0: disableLine(StMSYS_Custom0);
|
|
95 break;
|
|
96 case 1: disableLine(StMSYS_Custom1);
|
|
97 break;
|
|
98 case 2: disableLine(StMSYS_Custom2);
|
|
99 break;
|
|
100 case 3: disableLine(StMSYS_Custom3);
|
|
101 break;
|
|
102 case 4: disableLine(StMSYS_Custom4);
|
|
103 break;
|
|
104 default:
|
|
105 case 5: disableLine(StMSYS_Custom5);
|
|
106 break;
|
|
107 }
|
379
|
108 }
|
|
109
|
815
|
110 text[textPointer++] = TXT_2BYTE;
|
|
111 text[textPointer++] = TXT2BYTE_ButtonNext;
|
|
112 text[textPointer] = 0;
|
|
113
|
38
|
114 return StMSYS;
|
|
115 }
|
|
116
|
|
117 // surface mode
|
139
|
118 getActualRTEandFONTversion(&RTEhigh,&RTElow,NULL,NULL);
|
38
|
119
|
|
120 if((RTEhigh == 0xFF) || (RTElow == 0xFF))
|
|
121 {
|
|
122 RTEhigh = 0;
|
|
123 RTElow = 0;
|
|
124 }
|
|
125
|
|
126 if((line == 0) || (line == 1))
|
|
127 {
|
|
128 translateDate(pStateReal->lifeData.dateBinaryFormat, &Sdate);
|
|
129 translateTime(pStateReal->lifeData.timeBinaryFormat, &Stime);
|
|
130
|
944
|
131 text[textPointer++] = TXT_Date;
|
|
132 getStringOfFormat_DDMMYY(tmpString,15);
|
|
133 textPointer += snprintf(&text[textPointer], 40,"\016\016 %s ",tmpString);
|
|
134 convertStringOfDate_DDMMYY(tmpString,15,Sdate.Date, Sdate.Month, Sdate.Year);
|
|
135 textPointer += snprintf(&text[textPointer], 40,"\017\t%s ",tmpString);
|
38
|
136
|
|
137 textPointer += snprintf(&text[textPointer], 60,
|
|
138 "%02d:%02d:%02d"
|
|
139 "\n\r"
|
|
140 ,Stime.Hours, Stime.Minutes, Stime.Seconds
|
|
141 );
|
|
142 }
|
|
143 else
|
|
144 {
|
|
145 strcpy(&text[textPointer],"\n\r");
|
|
146 textPointer += 2;
|
|
147 }
|
|
148
|
851
|
149 if (line == 0 || line == 2)
|
|
150 {
|
|
151 if(t7_customview_disabled(CVIEW_Timer))
|
|
152 {
|
|
153 text[textPointer++] = '\031'; /* change text color */
|
|
154 textPointer += snprintf(&text[textPointer], 21, "%c%c\t%u:%02u \016\016[m:ss]\017\n\r", TXT_2BYTE, TXT2BYTE_Timer, data->timerDurationS / 60, data->timerDurationS % 60);
|
|
155 disableLine(StMSYS_Timer);
|
|
156 text[textPointer++] = '\020'; /* restore text color */
|
|
157 }
|
|
158 else
|
|
159 {
|
|
160 textPointer += snprintf(&text[textPointer], 21, "%c%c\t%u:%02u \016\016[m:ss]\017\n\r", TXT_2BYTE, TXT2BYTE_Timer, data->timerDurationS / 60, data->timerDurationS % 60);
|
|
161 }
|
|
162 } else
|
|
163 {
|
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
|
164 textPointer += snprintf(&text[textPointer], 3, "\n\r");
|
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
|
165 }
|
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
|
166
|
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
|
167 if((line == 0) || (line == 3))
|
38
|
168 {
|
|
169 text[textPointer++] = TXT_Language;
|
|
170 text[textPointer++] = '\t';
|
|
171 text[textPointer++] = TXT_LanguageName;
|
|
172 text[textPointer++] = '\n';
|
|
173 text[textPointer++] = '\r';
|
|
174 text[textPointer] = 0;
|
|
175 }
|
|
176 else
|
|
177 {
|
|
178 strcpy(&text[textPointer],"\n\r");
|
|
179 textPointer += 2;
|
|
180 }
|
|
181
|
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
|
182 if((line == 0) || (line == 4))
|
38
|
183 {
|
|
184 text[textPointer++] = TXT_2BYTE;
|
|
185 text[textPointer++] = TXT2BYTE_Layout;
|
|
186 text[textPointer++] = '\t';
|
|
187
|
|
188 if(!data->showDebugInfo)
|
|
189 {
|
|
190 text[textPointer++] = TXT_2BYTE;
|
|
191 if(data->nonMetricalSystem == 0)
|
|
192 text[textPointer++] = TXT2BYTE_Units_metric;
|
|
193 else
|
|
194 text[textPointer++] = TXT2BYTE_Units_feet;
|
|
195
|
|
196 if(data->tX_colorscheme != 0)
|
|
197 {
|
536
|
198 text[textPointer++] = ' ';
|
|
199 text[textPointer++] = '/';
|
38
|
200 text[textPointer++] = '\027';
|
|
201 text[textPointer++] = ' ';
|
|
202 text[textPointer++] = '0' + data->tX_colorscheme;
|
|
203 text[textPointer++] = '\020';
|
|
204 }
|
|
205 }
|
|
206 else
|
|
207 {
|
|
208 if(data->nonMetricalSystem == 0)
|
|
209 {
|
|
210 text[textPointer++] = 'm';
|
536
|
211 text[textPointer++] = ' ';
|
38
|
212 text[textPointer++] = '/';
|
536
|
213 text[textPointer++] = ' ';
|
38
|
214 text[textPointer++] = 'C';
|
536
|
215 text[textPointer++] = ' ';
|
38
|
216 }
|
|
217 else
|
|
218 {
|
|
219 text[textPointer++] = 'f';
|
|
220 text[textPointer++] = 't';
|
|
221 text[textPointer++] = ' ';
|
|
222 text[textPointer++] = '/';
|
|
223 text[textPointer++] = ' ';
|
536
|
224 text[textPointer++] = 'F';
|
38
|
225 text[textPointer++] = ' ';
|
536
|
226 }
|
|
227 if(data->tX_colorscheme != 0)
|
|
228 {
|
|
229 text[textPointer++] = '/';
|
|
230 text[textPointer++] = '\027';
|
|
231 text[textPointer++] = ' ';
|
|
232 text[textPointer++] = '0' + data->tX_colorscheme;
|
|
233 text[textPointer++] = ' ';
|
|
234 text[textPointer++] = '\020';
|
|
235 }
|
|
236 text[textPointer++] = '/';
|
38
|
237 text[textPointer++] = ' ';
|
|
238 text[textPointer++] = 'd';
|
|
239 text[textPointer++] = 'e';
|
|
240 text[textPointer++] = 'b';
|
|
241 text[textPointer++] = 'u';
|
|
242 text[textPointer++] = 'g';
|
|
243 }
|
|
244
|
|
245 text[textPointer++] = '\n';
|
|
246 text[textPointer++] = '\r';
|
|
247 text[textPointer] = 0;
|
|
248 }
|
|
249 else
|
|
250 {
|
|
251 strcpy(&text[textPointer],"\n\r");
|
|
252 textPointer += 2;
|
|
253 }
|
|
254
|
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
|
255 if((line == 0) || (line == 5))
|
38
|
256 {
|
|
257 text[textPointer++] = TXT_Information;
|
|
258 text[textPointer++] = '\t';
|
|
259 textPointer += snprintf(&text[textPointer],29,"RTE %u.%u OS %i.%i.%i"
|
|
260 ,RTEhigh
|
|
261 ,RTElow
|
|
262 ,firmwareDataGetPointer()->versionFirst
|
|
263 ,firmwareDataGetPointer()->versionSecond
|
|
264 ,firmwareDataGetPointer()->versionThird
|
|
265 );
|
|
266 }
|
|
267 strcpy(&text[textPointer],"\n\r");
|
|
268 textPointer += 2;
|
|
269
|
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
|
270 if((line == 0) || (line == 6))
|
38
|
271 {
|
|
272 text[textPointer++] = TXT_2BYTE;
|
|
273 text[textPointer++] = TXT2BYTE_ResetMenu;
|
|
274 text[textPointer] = 0;
|
|
275 }
|
|
276 strcpy(&text[textPointer],"\n\r");
|
|
277 textPointer += 2;
|
|
278
|
|
279 return StMSYS;
|
|
280 }
|
851
|
281 void tMSystem_checkLineStatus(void)
|
|
282 {
|
|
283 uint8_t localLineMask = 0;
|
|
284 uint8_t lineMask = getLineMask(StMSYS);
|
38
|
285
|
851
|
286 if(t7_customview_disabled(CVIEW_Timer))
|
|
287 {
|
|
288 localLineMask |= 1 << 2;
|
|
289 }
|
|
290 if(lineMask != localLineMask)
|
|
291 {
|
|
292 updateMenu();
|
|
293 }
|
|
294 }
|
38
|
295
|
|
296 /* Private functions ---------------------------------------------------------*/
|