Mercurial > public > ostc4
annotate Discovery/Src/tMenuXtra.c @ 701:8c48553a0176
Bugfix display of deactivated sensors:
In the previous version disabled sensors had been show after startup. Rootcause was that the deactivation state was taken from the divesettings instead of the common setting. After startup divesettings are not initialized and therefore all three sensors were displayed even if one or more were disabled. This has been fixed by using the common settings in case that the OSTC is not in divemode.
author | Ideenmodellierer |
---|---|
date | Fri, 28 Oct 2022 19:39:20 +0200 |
parents | 1b995079c045 |
children | e81afd727993 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuXtra.c | |
5 /// \brief Menu Xtra - Specials in Divemode like Reset Stopwatch | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 02-Mar-2015 | |
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 <stdio.h> | |
31 #include <string.h> | |
32 #include "tMenu.h" | |
33 #include "tStructure.h" | |
34 #include "tMenuXtra.h" | |
35 #include "text_multilanguage.h" | |
36 #include "data_central.h" | |
37 #include "simulation.h" | |
609
1b243c6c7067
Bugfix: CalibViewport were shown even in case the compile switch had not been set:
Ideenmodellierer
parents:
547
diff
changeset
|
38 #include "configuration.h" |
38 | 39 |
40 /* Exported functions --------------------------------------------------------*/ | |
41 | |
42 uint32_t tMXtra_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) | |
43 { | |
44 uint8_t textPointer; | |
45 | |
46 textPointer = 0; | |
47 *tab = 500; | |
48 *subtext = 0; | |
49 | |
662 | 50 SSettings *pSettings = settingsGetPointer(); |
51 | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
52 /* DIVE MODE */ |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
53 if(actual_menu_content != MENU_SURFACE) |
38 | 54 { |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
55 if((line == 0) || (line == 1)) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
56 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
57 text[textPointer++] = TXT_2BYTE; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
58 text[textPointer++] = TXT2BYTE_ResetStopwatch; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
59 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
60 strcpy(&text[textPointer],"\n\r"); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
61 textPointer += 2; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
62 /* |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
63 if((line == 0) || (line == 2)) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
64 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
65 text[textPointer++] = TXT_2BYTE; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
66 text[textPointer++] = TXT2BYTE_ResetAvgDepth; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
67 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
68 strcpy(&text[textPointer],"\n\r"); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
69 textPointer += 2; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
70 */ |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
71 if((line == 0) || (line == 2)) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
72 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
73 text[textPointer++] = TXT_2BYTE; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
74 text[textPointer++] = TXT2BYTE_CompassHeading; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
75 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
76 strcpy(&text[textPointer],"\n\r"); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
77 textPointer += 2; |
38 | 78 |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
79 if((line == 0) || (line == 3)) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
80 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
81 text[textPointer++] = TXT_2BYTE; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
82 text[textPointer++] = TXT2BYTE_SetMarker; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
83 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
84 strcpy(&text[textPointer],"\n\r"); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
85 textPointer += 2; |
38 | 86 |
609
1b243c6c7067
Bugfix: CalibViewport were shown even in case the compile switch had not been set:
Ideenmodellierer
parents:
547
diff
changeset
|
87 #ifdef ENABLE_MOTION_CONTROL |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
88 if((line == 0) || (line == 4)) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
89 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
90 text[textPointer++] = TXT_2BYTE; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
91 text[textPointer++] = TXT2BYTE_CalibView; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
92 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
93 strcpy(&text[textPointer],"\n\r"); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
94 textPointer += 2; |
609
1b243c6c7067
Bugfix: CalibViewport were shown even in case the compile switch had not been set:
Ideenmodellierer
parents:
547
diff
changeset
|
95 #endif |
547 | 96 |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
97 if(is_stateUsedSetToSim()) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
98 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
99 if((line == 0) || (line == 5)) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
100 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
101 text[textPointer++] = TXT_2BYTE; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
102 text[textPointer++] = TXT2BYTE_SimFollowDecoStops; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
103 text[textPointer++] = ' '; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
104 text[textPointer++] = ' '; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
105 if(simulation_get_heed_decostops()) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
106 text[textPointer++] = '\005'; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
107 else |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
108 text[textPointer++] = '\006'; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
109 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
110 strcpy(&text[textPointer],"\n\r"); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
111 textPointer += 2; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
112 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
113 else |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
114 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
115 if((line == 0) || (line == 5)) /* end dive mode only used during real dives */ |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
116 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
117 text[textPointer++] = TXT_2BYTE; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
118 text[textPointer++] = TXT2BYTE_EndDiveMode; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
119 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
120 strcpy(&text[textPointer],"\n\r"); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
121 textPointer += 2; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
122 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
123 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
124 else /* Surface MODE */ |
38 | 125 { |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
126 if((line == 0) || (line == 1)) |
38 | 127 { |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
128 textPointer += snprintf(&text[textPointer], 60,\ |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
129 "%c" |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
130 "\016\016(%c)\17" |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
131 "\002" |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
132 "%u" |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
133 "\016\016" |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
134 " %c" |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
135 "\017" |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
136 ,TXT_ScrubTime |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
137 ,TXT_Maximum |
662 | 138 ,pSettings->scrubTimerMax |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
139 ,TXT_Minutes |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
140 ); |
38 | 141 } |
142 strcpy(&text[textPointer],"\n\r"); | |
143 textPointer += 2; | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
144 if((line == 0) || (line == 2)) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
145 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
146 textPointer += snprintf(&text[textPointer], 60,\ |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
147 "%c\002%03u\016\016 %c\017" |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
148 ,TXT_ScrubTimeReset |
662 | 149 ,pSettings->scrubTimerCur |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
150 ,TXT_Minutes); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
151 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
152 strcpy(&text[textPointer],"\n\r"); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
153 textPointer += 2; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
154 if((line == 0) || (line == 3)) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
155 { |
662 | 156 switch(pSettings->scrubTimerMode) |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
157 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
158 case SCRUB_TIMER_OFF: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
159 default: textPointer += snprintf(&text[textPointer], 60,"%c\002%c%c",TXT_ScrubTimeMode, TXT_2BYTE, TXT2BYTE_MoCtrlNone ); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
160 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
161 case SCRUB_TIMER_MINUTES: textPointer += snprintf(&text[textPointer], 60,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes ); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
162 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
163 case SCRUB_TIMER_PERCENT: textPointer += snprintf(&text[textPointer], 60,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent ); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
164 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
165 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
166 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
167 strcpy(&text[textPointer],"\n\r"); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
168 textPointer += 2; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
609
diff
changeset
|
169 |
662 | 170 #ifdef ENABLE_PSCR_MODE |
171 if(pSettings->dive_mode == DIVEMODE_PSCR) | |
172 { | |
173 if((line == 0) || (line == 4)) | |
174 { | |
175 textPointer += snprintf(&text[textPointer], 60,\ | |
176 "%c\002%02u\016\016%%\017" | |
177 ,TXT_PSCRO2Drop | |
178 ,pSettings->pscr_o2_drop); | |
179 } | |
180 strcpy(&text[textPointer],"\n\r"); | |
181 textPointer += 2; | |
182 if((line == 0) || (line == 5)) | |
183 { | |
184 textPointer += snprintf(&text[textPointer], 60,\ | |
185 "%c\002 1/%02u" | |
186 ,TXT_PSCRLungRatio | |
187 ,pSettings->pscr_lung_ratio); | |
188 } | |
189 strcpy(&text[textPointer],"\n\r"); | |
190 textPointer += 2; | |
191 } | |
192 #endif | |
193 #ifdef ENABLE_CO2_SUPPORT | |
194 if((line == 0) || (line == 6)) | |
195 { | |
196 textPointer += snprintf(&text[textPointer], 60, "%c", TXT_CO2Sensor); | |
197 } | |
198 #endif | |
38 | 199 } |
200 return StMXTRA; | |
201 } | |
202 |