Mercurial > public > ostc4
annotate Discovery/Src/tMenuSystem.c @ 824:2a9a47547b05 Evo_2_23
Bugfix Flipscreen visualization:
In Timer and CCR overview the free custom fram coordinates were not initialized. Depending on which view was activ before the coordinates of the former view were used and sometimes resulting in a bad visualization. To fix the problem the coordinates are now initialized by the views.
The top menu bar text in the flip view did not consider spacings in the text position calculation causing an offset between color bar and text. The offset has been corrected.
author | Ideenmodellierer |
---|---|
date | Mon, 09 Oct 2023 16:50:11 +0200 |
parents | ce8f71217f45 |
children | 9f487ad38170 |
rev | line source |
---|---|
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 | |
379 | 34 static uint8_t customviewsSubpage = 0; |
35 | |
38 | 36 /* Private function prototypes -----------------------------------------------*/ |
37 char customview_TXT2BYTE_helper(uint8_t customViewId); | |
38 | |
379 | 39 void set_CustomsviewsSubpage(uint8_t page) |
40 { | |
41 customviewsSubpage = page; | |
42 } | |
43 | |
38 | 44 /* Exported functions --------------------------------------------------------*/ |
45 | |
46 uint32_t tMSystem_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) | |
47 { | |
48 SSettings *data; | |
379 | 49 int i; |
38 | 50 uint8_t textPointer; |
51 uint8_t dateFormat; | |
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; | |
61 | |
815
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
62 resetLineMask(StMSYS); |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
63 |
38 | 64 // dive mode |
65 if(actual_menu_content != MENU_SURFACE) | |
66 { | |
67 uint8_t id; | |
68 | |
379 | 69 for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */ |
38 | 70 { |
379 | 71 id = cv_changelist[customviewsSubpage * 5 + i]; |
72 if(id == CVIEW_END) /* last list item? */ | |
73 { | |
74 break; | |
75 } | |
76 else | |
77 { | |
78 text[textPointer++] = '\006' - CHECK_BIT_THOME(data->cv_configuration,id); | |
79 text[textPointer++] = ' '; | |
80 textPointer += snprintf(&text[textPointer], 60, | |
81 "%c%c\n\r", | |
82 TXT_2BYTE, customview_TXT2BYTE_helper(id)); | |
83 } | |
38 | 84 } |
85 | |
379 | 86 for(;i<5;i++) /* clear empty lines in case menu shows less than 5 entries */ |
87 { | |
88 text[textPointer++]='\n'; | |
89 text[textPointer++]='\r'; | |
90 text[textPointer] = 0; | |
815
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
91 switch(i) |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
92 { |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
93 case 0: disableLine(StMSYS_Custom0); |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
94 break; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
95 case 1: disableLine(StMSYS_Custom1); |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
96 break; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
97 case 2: disableLine(StMSYS_Custom2); |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
98 break; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
99 case 3: disableLine(StMSYS_Custom3); |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
100 break; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
101 case 4: disableLine(StMSYS_Custom4); |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
102 break; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
103 default: |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
104 case 5: disableLine(StMSYS_Custom5); |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
105 break; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
106 } |
379 | 107 } |
108 | |
815
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
109 text[textPointer++] = TXT_2BYTE; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
110 text[textPointer++] = TXT2BYTE_ButtonNext; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
111 text[textPointer] = 0; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
112 |
38 | 113 return StMSYS; |
114 } | |
115 | |
116 // surface mode | |
139
decb0461302a
Get version from local memory instead from incoming data
Ideenmodellierer
parents:
138
diff
changeset
|
117 getActualRTEandFONTversion(&RTEhigh,&RTElow,NULL,NULL); |
38 | 118 |
119 if((RTEhigh == 0xFF) || (RTElow == 0xFF)) | |
120 { | |
121 RTEhigh = 0; | |
122 RTElow = 0; | |
123 } | |
124 | |
125 if((line == 0) || (line == 1)) | |
126 { | |
127 translateDate(pStateReal->lifeData.dateBinaryFormat, &Sdate); | |
128 translateTime(pStateReal->lifeData.timeBinaryFormat, &Stime); | |
129 | |
130 dateFormat = data->date_format; | |
131 | |
132 textPointer += snprintf(&text[textPointer], 40, | |
133 "Date" | |
134 "\016\016" | |
135 " " | |
136 ); | |
137 | |
138 if(dateFormat == DDMMYY) | |
139 { | |
140 textPointer += snprintf(&text[textPointer], 40, | |
141 "DDMMYY" | |
142 "\017" | |
143 "\t" | |
144 "%02d-%02d-%02d" | |
145 " " | |
146 , Sdate.Date, Sdate.Month, 2000 + Sdate.Year | |
147 ); | |
148 } | |
149 else | |
150 if(dateFormat == MMDDYY) | |
151 { | |
152 textPointer += snprintf(&text[textPointer], 40, | |
153 "MMDDYY" | |
154 "\017" | |
155 "\t" | |
156 "%02d-%02d-%02d" | |
157 " " | |
158 ,Sdate.Month, Sdate.Date, 2000 + Sdate.Year | |
159 ); | |
160 } | |
161 else | |
162 if(dateFormat == YYMMDD) | |
163 { | |
164 textPointer += snprintf(&text[textPointer], 40, | |
165 "YYMMDD" | |
166 "\017" | |
167 "\t" | |
168 "%02d-%02d-%02d" | |
169 " " | |
170 , 2000 + Sdate.Year, Sdate.Month, Sdate.Date | |
171 ); | |
172 } | |
173 | |
174 textPointer += snprintf(&text[textPointer], 60, | |
175 "%02d:%02d:%02d" | |
176 "\n\r" | |
177 ,Stime.Hours, Stime.Minutes, Stime.Seconds | |
178 ); | |
179 } | |
180 else | |
181 { | |
182 strcpy(&text[textPointer],"\n\r"); | |
183 textPointer += 2; | |
184 } | |
185 | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
186 if (line == 0 || line == 2) { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
187 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); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
188 } else { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
189 textPointer += snprintf(&text[textPointer], 3, "\n\r"); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
190 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
191 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
192 if((line == 0) || (line == 3)) |
38 | 193 { |
194 text[textPointer++] = TXT_Language; | |
195 text[textPointer++] = '\t'; | |
196 text[textPointer++] = TXT_LanguageName; | |
197 text[textPointer++] = '\n'; | |
198 text[textPointer++] = '\r'; | |
199 text[textPointer] = 0; | |
200 } | |
201 else | |
202 { | |
203 strcpy(&text[textPointer],"\n\r"); | |
204 textPointer += 2; | |
205 } | |
206 | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
207 if((line == 0) || (line == 4)) |
38 | 208 { |
209 text[textPointer++] = TXT_2BYTE; | |
210 text[textPointer++] = TXT2BYTE_Layout; | |
211 text[textPointer++] = '\t'; | |
212 | |
213 if(!data->showDebugInfo) | |
214 { | |
215 text[textPointer++] = TXT_2BYTE; | |
216 if(data->nonMetricalSystem == 0) | |
217 text[textPointer++] = TXT2BYTE_Units_metric; | |
218 else | |
219 text[textPointer++] = TXT2BYTE_Units_feet; | |
220 | |
221 if(data->tX_colorscheme != 0) | |
222 { | |
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
223 text[textPointer++] = ' '; |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
224 text[textPointer++] = '/'; |
38 | 225 text[textPointer++] = '\027'; |
226 text[textPointer++] = ' '; | |
227 text[textPointer++] = '0' + data->tX_colorscheme; | |
228 text[textPointer++] = '\020'; | |
229 } | |
230 } | |
231 else | |
232 { | |
233 if(data->nonMetricalSystem == 0) | |
234 { | |
235 text[textPointer++] = 'm'; | |
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
236 text[textPointer++] = ' '; |
38 | 237 text[textPointer++] = '/'; |
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
238 text[textPointer++] = ' '; |
38 | 239 text[textPointer++] = 'C'; |
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
240 text[textPointer++] = ' '; |
38 | 241 } |
242 else | |
243 { | |
244 text[textPointer++] = 'f'; | |
245 text[textPointer++] = 't'; | |
246 text[textPointer++] = ' '; | |
247 text[textPointer++] = '/'; | |
248 text[textPointer++] = ' '; | |
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
249 text[textPointer++] = 'F'; |
38 | 250 text[textPointer++] = ' '; |
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
251 } |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
252 if(data->tX_colorscheme != 0) |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
253 { |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
254 text[textPointer++] = '/'; |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
255 text[textPointer++] = '\027'; |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
256 text[textPointer++] = ' '; |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
257 text[textPointer++] = '0' + data->tX_colorscheme; |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
258 text[textPointer++] = ' '; |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
259 text[textPointer++] = '\020'; |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
260 } |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
261 text[textPointer++] = '/'; |
38 | 262 text[textPointer++] = ' '; |
263 text[textPointer++] = 'd'; | |
264 text[textPointer++] = 'e'; | |
265 text[textPointer++] = 'b'; | |
266 text[textPointer++] = 'u'; | |
267 text[textPointer++] = 'g'; | |
268 } | |
269 | |
270 text[textPointer++] = '\n'; | |
271 text[textPointer++] = '\r'; | |
272 text[textPointer] = 0; | |
273 } | |
274 else | |
275 { | |
276 strcpy(&text[textPointer],"\n\r"); | |
277 textPointer += 2; | |
278 } | |
279 | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
280 if((line == 0) || (line == 5)) |
38 | 281 { |
282 text[textPointer++] = TXT_Information; | |
283 text[textPointer++] = '\t'; | |
284 textPointer += snprintf(&text[textPointer],29,"RTE %u.%u OS %i.%i.%i" | |
285 ,RTEhigh | |
286 ,RTElow | |
287 ,firmwareDataGetPointer()->versionFirst | |
288 ,firmwareDataGetPointer()->versionSecond | |
289 ,firmwareDataGetPointer()->versionThird | |
290 ); | |
291 } | |
292 strcpy(&text[textPointer],"\n\r"); | |
293 textPointer += 2; | |
294 | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
295 if((line == 0) || (line == 6)) |
38 | 296 { |
297 text[textPointer++] = TXT_2BYTE; | |
298 text[textPointer++] = TXT2BYTE_ResetMenu; | |
299 text[textPointer] = 0; | |
300 } | |
301 strcpy(&text[textPointer],"\n\r"); | |
302 textPointer += 2; | |
303 | |
304 return StMSYS; | |
305 } | |
306 | |
307 | |
308 /* Private functions ---------------------------------------------------------*/ |