Mercurial > public > ostc4
annotate Discovery/Src/tMenuDeco.c @ 759:9825dcf50675
Some compass improvements from mikeller
author | heinrichsweikamp |
---|---|
date | Fri, 17 Mar 2023 09:35:25 +0100 |
parents | e81afd727993 |
children | 608d3e918146 |
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 { |
137 textPointer += snprintf(&text[textPointer], 60,\ | |
138 "%c" | |
139 "\t" | |
140 "%u" | |
141 "\016\016" | |
142 " %c" | |
143 "\017" | |
144 ,TXT_FutureTTS | |
145 ,futureTTS | |
146 ,TXT_Minutes | |
147 ); | |
148 } | |
149 strcpy(&text[textPointer],"\n\r"); | |
150 textPointer += 2; | |
151 | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
152 if((line == 0) || (line == 5)) |
38 | 153 { |
154 textPointer += snprintf(&text[textPointer], 60,\ | |
155 "%c" | |
156 "\t" | |
157 "%u" | |
158 "\016\016" | |
159 " %%" | |
160 "\017" | |
161 , TXT_Salinity | |
162 , settingsGetPointer()->salinity | |
163 ); | |
164 } | |
165 strcpy(&text[textPointer],"\n\r"); | |
166 textPointer += 2; | |
167 | |
168 | |
169 return StMDECO; | |
170 } |