Mercurial > public > ostc4
annotate Discovery/Src/tMenuDeco.c @ 686:b1e24513b83e Betatest
Bugfix Battery charge complete event:
In previous version it could happen that the battery charge state was set to 100% even the battery was not completly charged. Rootcause was that the external charger IC signals sometimes completion because e.g. the connection between charger unit and OSTC is disconnected within a short time slot. This may happen while the user is trying to get the OSTC in a good charging position. To avoid this the state machine now checks the voltage everytime for valid charging complete range before a charging complete is signaled.
author | Ideenmodellierer |
---|---|
date | Fri, 05 Aug 2022 14:56:17 +0200 |
parents | 1b995079c045 |
children | e81afd727993 |
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; | |
662 | 70 case DIVEMODE_PSCR: |
71 divemode = TXT_PSClosedCircuit; | |
72 break; | |
51
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
73 default : |
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
74 divemode = TXT_OpenCircuit; |
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
75 break; |
38 | 76 } |
77 textPointer += snprintf(&text[textPointer], 60,\ | |
78 "%c" | |
79 "\t" | |
80 "%c" | |
81 , TXT_DiveMode, divemode | |
82 ); | |
83 } | |
84 strcpy(&text[textPointer],"\n\r"); | |
85 textPointer += 2; | |
86 | |
662 | 87 if(isLoopMode(data->dive_mode)) |
38 | 88 { |
89 if((line == 0) || (line == 2)) | |
90 { | |
662 | 91 switch(data->CCR_Mode) |
92 { | |
93 case CCRMODE_Sensors: CcrModusTxtId = TXT_Sensor; | |
94 break; | |
95 case CCRMODE_FixedSetpoint: CcrModusTxtId = TXT_FixedSP; | |
96 break; | |
97 case CCRMODE_Simulation: CcrModusTxtId = TXT_SimPpo2; | |
98 break; | |
99 default: CcrModusTxtId = 'X'; | |
100 break; | |
101 } | |
102 | |
38 | 103 |
104 textPointer += snprintf(&text[textPointer], 60,\ | |
105 "%c" | |
106 "\t" | |
107 "%c" | |
108 , TXT_CCRmode | |
109 , CcrModusTxtId | |
110 ); | |
111 } | |
112 strcpy(&text[textPointer],"\n\r"); | |
113 textPointer += 2; | |
114 } | |
115 else | |
116 if(line != 0) | |
117 line++; | |
118 | |
119 if((line == 0) || (line == 3)) | |
120 { | |
121 textPointer += snprintf(&text[textPointer], 60,\ | |
122 "ppO2" | |
123 "\016\016" | |
124 "max" | |
125 "\017" | |
126 "\t" | |
127 "%0.2f" | |
128 "\016\016" | |
129 " bar " | |
130 " deco " | |
131 "\017" | |
132 "%0.2f" | |
133 "\016\016" | |
134 " bar" | |
135 "\017" | |
136 , ppO2max_std, ppO2max_deco | |
137 ); | |
138 } | |
139 strcpy(&text[textPointer],"\n\r"); | |
140 textPointer += 2; | |
141 | |
142 if((line == 0) || (line == 4)) | |
143 { | |
144 textPointer += snprintf(&text[textPointer], 60,\ | |
145 "%c" | |
146 "\t" | |
147 "%u" | |
148 "\016\016" | |
149 " %c" | |
150 "\017" | |
151 " @ " | |
152 "%u" | |
153 "\016\016" | |
154 " %c%c" | |
155 "\017" | |
156 , TXT_SafetyStop | |
157 , settingsGetPointer()->safetystopDuration | |
158 ,TXT_Minutes | |
159 , unit_depth_integer(settingsGetPointer()->safetystopDepth) | |
160 , unit_depth_char1() | |
161 , unit_depth_char2() | |
162 ); | |
163 } | |
164 strcpy(&text[textPointer],"\n\r"); | |
165 textPointer += 2; | |
166 | |
167 if((line == 0) || (line == 5)) | |
168 { | |
169 textPointer += snprintf(&text[textPointer], 60,\ | |
170 "%c" | |
171 "\t" | |
172 "%u" | |
173 "\016\016" | |
174 " %c" | |
175 "\017" | |
176 ,TXT_FutureTTS | |
177 ,futureTTS | |
178 ,TXT_Minutes | |
179 ); | |
180 } | |
181 strcpy(&text[textPointer],"\n\r"); | |
182 textPointer += 2; | |
183 | |
184 if((line == 0) || (line == 6)) | |
185 { | |
186 textPointer += snprintf(&text[textPointer], 60,\ | |
187 "%c" | |
188 "\t" | |
189 "%u" | |
190 "\016\016" | |
191 " %%" | |
192 "\017" | |
193 , TXT_Salinity | |
194 , settingsGetPointer()->salinity | |
195 ); | |
196 } | |
197 strcpy(&text[textPointer],"\n\r"); | |
198 textPointer += 2; | |
199 | |
200 | |
201 return StMDECO; | |
202 } |