Mercurial > public > ostc4
annotate Discovery/Src/tMenuDeco.c @ 917:0d6c4b40fae4 Evo_2_23
Bugfix external interface power up after sleep:
The previous implementation did not consider if the external power was enabled of not before sleep (the power was later enabled by sensor handling). The power is now activated immediatly after leaving sleep in order to aoid delays in sensor startup.
author | Ideenmodellierer |
---|---|
date | Sun, 03 Nov 2024 15:37:00 +0100 |
parents | 608d3e918146 |
children |
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; | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
41 char divemode; |
38 | 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 | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
87 if((line == 0) || (line == 2)) |
38 | 88 { |
89 textPointer += snprintf(&text[textPointer], 60,\ | |
90 "ppO2" | |
91 "\016\016" | |
92 "max" | |
93 "\017" | |
94 "\t" | |
95 "%0.2f" | |
96 "\016\016" | |
97 " bar " | |
98 " deco " | |
99 "\017" | |
100 "%0.2f" | |
101 "\016\016" | |
102 " bar" | |
103 "\017" | |
104 , ppO2max_std, ppO2max_deco | |
105 ); | |
106 } | |
107 strcpy(&text[textPointer],"\n\r"); | |
108 textPointer += 2; | |
109 | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
110 if((line == 0) || (line == 3)) |
38 | 111 { |
112 textPointer += snprintf(&text[textPointer], 60,\ | |
113 "%c" | |
114 "\t" | |
115 "%u" | |
116 "\016\016" | |
117 " %c" | |
118 "\017" | |
119 " @ " | |
120 "%u" | |
121 "\016\016" | |
122 " %c%c" | |
123 "\017" | |
124 , TXT_SafetyStop | |
125 , settingsGetPointer()->safetystopDuration | |
126 ,TXT_Minutes | |
127 , unit_depth_integer(settingsGetPointer()->safetystopDepth) | |
128 , unit_depth_char1() | |
129 , unit_depth_char2() | |
130 ); | |
131 } | |
132 strcpy(&text[textPointer],"\n\r"); | |
133 textPointer += 2; | |
134 | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
135 if((line == 0) || (line == 4)) |
38 | 136 { |
882 | 137 if(settingsGetPointer()->slowExitTime != 0) |
138 { | |
139 textPointer += snprintf(&text[textPointer], 60,\ | |
140 "%c%c\t%u\016\016 %c\017 ^ %u\016\016 %c%c\017" | |
141 , TXT_2BYTE | |
142 , TXT2BYTE_SlowExit | |
143 , settingsGetPointer()->slowExitTime | |
144 ,TXT_Minutes | |
145 , unit_depth_integer(settingsGetPointer()->last_stop_depth_meter) | |
146 , unit_depth_char1() | |
147 , unit_depth_char2() | |
148 ); | |
149 } | |
150 else | |
151 { | |
152 textPointer += snprintf(&text[textPointer], 60, "%c%c\t%c%c" | |
153 , TXT_2BYTE | |
154 , TXT2BYTE_SlowExit | |
155 , TXT_2BYTE | |
156 , TXT2BYTE_MoCtrlNone | |
157 ); | |
158 } | |
159 } | |
160 strcpy(&text[textPointer],"\n\r"); | |
161 textPointer += 2; | |
162 if((line == 0) || (line == 5)) | |
163 { | |
38 | 164 textPointer += snprintf(&text[textPointer], 60,\ |
165 "%c" | |
166 "\t" | |
167 "%u" | |
168 "\016\016" | |
169 " %c" | |
170 "\017" | |
171 ,TXT_FutureTTS | |
172 ,futureTTS | |
173 ,TXT_Minutes | |
174 ); | |
175 } | |
176 strcpy(&text[textPointer],"\n\r"); | |
177 textPointer += 2; | |
178 | |
882 | 179 if((line == 0) || (line == 6)) |
38 | 180 { |
181 textPointer += snprintf(&text[textPointer], 60,\ | |
182 "%c" | |
183 "\t" | |
184 "%u" | |
185 "\016\016" | |
186 " %%" | |
187 "\017" | |
188 , TXT_Salinity | |
189 , settingsGetPointer()->salinity | |
190 ); | |
191 } | |
192 strcpy(&text[textPointer],"\n\r"); | |
193 textPointer += 2; | |
194 | |
195 | |
196 return StMDECO; | |
197 } |