Mercurial > public > ostc4
comparison Discovery/Src/tMenuDeco.c @ 38:5f11787b4f42
include in ostc4 repository
author | heinrichsweikamp |
---|---|
date | Sat, 28 Apr 2018 11:52:34 +0200 |
parents | |
children | 8f8ea3a32e82 |
comparison
equal
deleted
inserted
replaced
37:ccc45c0e1ea2 | 38:5f11787b4f42 |
---|---|
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; | |
70 } | |
71 textPointer += snprintf(&text[textPointer], 60,\ | |
72 "%c" | |
73 "\t" | |
74 "%c" | |
75 , TXT_DiveMode, divemode | |
76 ); | |
77 } | |
78 strcpy(&text[textPointer],"\n\r"); | |
79 textPointer += 2; | |
80 | |
81 if(data->dive_mode == DIVEMODE_CCR) | |
82 { | |
83 if((line == 0) || (line == 2)) | |
84 { | |
85 if(data->CCR_Mode == CCRMODE_Sensors) | |
86 CcrModusTxtId = TXT_Sensor; | |
87 else | |
88 CcrModusTxtId = TXT_FixedSP; | |
89 | |
90 textPointer += snprintf(&text[textPointer], 60,\ | |
91 "%c" | |
92 "\t" | |
93 "%c" | |
94 , TXT_CCRmode | |
95 , CcrModusTxtId | |
96 ); | |
97 } | |
98 strcpy(&text[textPointer],"\n\r"); | |
99 textPointer += 2; | |
100 } | |
101 else | |
102 if(line != 0) | |
103 line++; | |
104 | |
105 if((line == 0) || (line == 3)) | |
106 { | |
107 textPointer += snprintf(&text[textPointer], 60,\ | |
108 "ppO2" | |
109 "\016\016" | |
110 "max" | |
111 "\017" | |
112 "\t" | |
113 "%0.2f" | |
114 "\016\016" | |
115 " bar " | |
116 " deco " | |
117 "\017" | |
118 "%0.2f" | |
119 "\016\016" | |
120 " bar" | |
121 "\017" | |
122 , ppO2max_std, ppO2max_deco | |
123 ); | |
124 } | |
125 strcpy(&text[textPointer],"\n\r"); | |
126 textPointer += 2; | |
127 | |
128 if((line == 0) || (line == 4)) | |
129 { | |
130 textPointer += snprintf(&text[textPointer], 60,\ | |
131 "%c" | |
132 "\t" | |
133 "%u" | |
134 "\016\016" | |
135 " %c" | |
136 "\017" | |
137 " @ " | |
138 "%u" | |
139 "\016\016" | |
140 " %c%c" | |
141 "\017" | |
142 , TXT_SafetyStop | |
143 , settingsGetPointer()->safetystopDuration | |
144 ,TXT_Minutes | |
145 , unit_depth_integer(settingsGetPointer()->safetystopDepth) | |
146 , unit_depth_char1() | |
147 , unit_depth_char2() | |
148 ); | |
149 } | |
150 strcpy(&text[textPointer],"\n\r"); | |
151 textPointer += 2; | |
152 | |
153 if((line == 0) || (line == 5)) | |
154 { | |
155 textPointer += snprintf(&text[textPointer], 60,\ | |
156 "%c" | |
157 "\t" | |
158 "%u" | |
159 "\016\016" | |
160 " %c" | |
161 "\017" | |
162 ,TXT_FutureTTS | |
163 ,futureTTS | |
164 ,TXT_Minutes | |
165 ); | |
166 } | |
167 strcpy(&text[textPointer],"\n\r"); | |
168 textPointer += 2; | |
169 | |
170 if((line == 0) || (line == 6)) | |
171 { | |
172 textPointer += snprintf(&text[textPointer], 60,\ | |
173 "%c" | |
174 "\t" | |
175 "%u" | |
176 "\016\016" | |
177 " %%" | |
178 "\017" | |
179 , TXT_Salinity | |
180 , settingsGetPointer()->salinity | |
181 ); | |
182 } | |
183 strcpy(&text[textPointer],"\n\r"); | |
184 textPointer += 2; | |
185 | |
186 | |
187 return StMDECO; | |
188 } |