Mercurial > public > ostc4
annotate Discovery/Src/tMenuDeco.c @ 503:734f7ad46bca
Bugfix display of disabled screen.
It is possible to select a screen as default which is in parallel disabled in the selection view. To avoid this the enable / disable state is not also checked when entering dive mode. The check function was depending on an ACTION. The functionality has been changed to allow the function call without ACTION.
Changed setting of compass circle position from constant position to variable
This was needed to reuse the same function in several views with different compass position
Added new views Navigation and Depth data
Both views were basically already available but the idea behind the layout is to combine all information needed for navigation dives (compass + timer) in one view. The classic maxdepth view just showed the maxdepth with a black box on the right side. this box is now used for display of average depth (shown in classic view Stopwatch)
Minor changes in compass paint function to improve code readability
Use same Y offset for all views
While switching across the views some number were shown ~20 pixel higher than others. This was caused by the usage of the line selection which works for some fonts but not for all => set linenumber to 0 for all views
author | Ideenmodellierer |
---|---|
date | Mon, 24 Aug 2020 19:53:27 +0200 |
parents | 8f8ea3a32e82 |
children | 1b995079c045 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuDeco.c | |
5 /// \brief Main Template file for Menu Page Deco | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 31-July-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 "tMenuDeco.h" | |
32 #include "unit.h" | |
33 | |
34 /* Exported functions --------------------------------------------------------*/ | |
35 | |
36 uint32_t tMDeco_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) | |
37 { | |
38 uint8_t textPointer; | |
39 uint8_t futureTTS; | |
40 double ppO2max_deco, ppO2max_std; | |
41 char divemode, CcrModusTxtId; | |
42 textPointer = 0; | |
43 *tab = 370; | |
44 *subtext = 0; | |
45 | |
46 SSettings *data = settingsGetPointer(); | |
47 | |
48 futureTTS = data->future_TTS; | |
49 ppO2max_std = data->ppO2_max_std; | |
50 ppO2max_std /= 100.0; | |
51 ppO2max_deco = data->ppO2_max_deco; | |
52 ppO2max_deco /= 100.0; | |
53 | |
54 if((line == 0) || (line == 1)) | |
55 { | |
56 switch(data->dive_mode) | |
57 { | |
58 case DIVEMODE_OC: | |
59 divemode = TXT_OpenCircuit; | |
60 break; | |
61 case DIVEMODE_CCR: | |
62 divemode = TXT_ClosedCircuit; | |
63 break; | |
64 case DIVEMODE_Gauge: | |
65 divemode = TXT_Gauge; | |
66 break; | |
67 case DIVEMODE_Apnea: | |
68 divemode = TXT_Apnoe; | |
69 break; | |
51
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
70 default : |
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
71 divemode = TXT_OpenCircuit; |
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
72 break; |
38 | 73 } |
74 textPointer += snprintf(&text[textPointer], 60,\ | |
75 "%c" | |
76 "\t" | |
77 "%c" | |
78 , TXT_DiveMode, divemode | |
79 ); | |
80 } | |
81 strcpy(&text[textPointer],"\n\r"); | |
82 textPointer += 2; | |
83 | |
84 if(data->dive_mode == DIVEMODE_CCR) | |
85 { | |
86 if((line == 0) || (line == 2)) | |
87 { | |
88 if(data->CCR_Mode == CCRMODE_Sensors) | |
89 CcrModusTxtId = TXT_Sensor; | |
90 else | |
91 CcrModusTxtId = TXT_FixedSP; | |
92 | |
93 textPointer += snprintf(&text[textPointer], 60,\ | |
94 "%c" | |
95 "\t" | |
96 "%c" | |
97 , TXT_CCRmode | |
98 , CcrModusTxtId | |
99 ); | |
100 } | |
101 strcpy(&text[textPointer],"\n\r"); | |
102 textPointer += 2; | |
103 } | |
104 else | |
105 if(line != 0) | |
106 line++; | |
107 | |
108 if((line == 0) || (line == 3)) | |
109 { | |
110 textPointer += snprintf(&text[textPointer], 60,\ | |
111 "ppO2" | |
112 "\016\016" | |
113 "max" | |
114 "\017" | |
115 "\t" | |
116 "%0.2f" | |
117 "\016\016" | |
118 " bar " | |
119 " deco " | |
120 "\017" | |
121 "%0.2f" | |
122 "\016\016" | |
123 " bar" | |
124 "\017" | |
125 , ppO2max_std, ppO2max_deco | |
126 ); | |
127 } | |
128 strcpy(&text[textPointer],"\n\r"); | |
129 textPointer += 2; | |
130 | |
131 if((line == 0) || (line == 4)) | |
132 { | |
133 textPointer += snprintf(&text[textPointer], 60,\ | |
134 "%c" | |
135 "\t" | |
136 "%u" | |
137 "\016\016" | |
138 " %c" | |
139 "\017" | |
140 " @ " | |
141 "%u" | |
142 "\016\016" | |
143 " %c%c" | |
144 "\017" | |
145 , TXT_SafetyStop | |
146 , settingsGetPointer()->safetystopDuration | |
147 ,TXT_Minutes | |
148 , unit_depth_integer(settingsGetPointer()->safetystopDepth) | |
149 , unit_depth_char1() | |
150 , unit_depth_char2() | |
151 ); | |
152 } | |
153 strcpy(&text[textPointer],"\n\r"); | |
154 textPointer += 2; | |
155 | |
156 if((line == 0) || (line == 5)) | |
157 { | |
158 textPointer += snprintf(&text[textPointer], 60,\ | |
159 "%c" | |
160 "\t" | |
161 "%u" | |
162 "\016\016" | |
163 " %c" | |
164 "\017" | |
165 ,TXT_FutureTTS | |
166 ,futureTTS | |
167 ,TXT_Minutes | |
168 ); | |
169 } | |
170 strcpy(&text[textPointer],"\n\r"); | |
171 textPointer += 2; | |
172 | |
173 if((line == 0) || (line == 6)) | |
174 { | |
175 textPointer += snprintf(&text[textPointer], 60,\ | |
176 "%c" | |
177 "\t" | |
178 "%u" | |
179 "\016\016" | |
180 " %%" | |
181 "\017" | |
182 , TXT_Salinity | |
183 , settingsGetPointer()->salinity | |
184 ); | |
185 } | |
186 strcpy(&text[textPointer],"\n\r"); | |
187 textPointer += 2; | |
188 | |
189 | |
190 return StMDECO; | |
191 } |