Mercurial > public > ostc4
annotate Discovery/Src/t3.c @ 841:70092f552f5a Evo_2_23
Added autofocus for T3_DecoTTS view:
a switch to the DecoTTS view will now be triggered in case a new deco stop depth is added, a deco stopp has been missed or if a new 10 minutes TTS is passed.
author | Ideenmodellierer |
---|---|
date | Sun, 07 Jan 2024 21:25:34 +0100 |
parents | aed39d19269c |
children | ba1aebc6d5af |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/t3.c | |
5 /// \brief Main Template file for dive mode special scree t3 | |
6 /// \author Heinrichs Weikamp gmbh | |
7 /// \date 10-Nov-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 ------------------------------------------------------------------*/ | |
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
30 #include <stdbool.h> |
841 | 31 #include <stdlib.h> |
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
32 |
38 | 33 #include "t3.h" |
34 | |
35 #include "data_exchange_main.h" | |
36 #include "decom.h" | |
37 #include "gfx_fonts.h" | |
38 #include "math.h" | |
39 #include "tHome.h" | |
40 #include "timer.h" | |
41 #include "unit.h" | |
553 | 42 #include "motion.h" |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
43 #include "logbook_miniLive.h" |
835 | 44 #include "tMenuEditCustom.h" |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
45 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
46 |
599 | 47 #define CV_PROFILE_WIDTH (600U) |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
48 |
237
ec16fd26e280
Bugfix: do not show NDL in bigscreen mode when zero
Jan Mulder <jlmulder@xs4all.nl>
parents:
214
diff
changeset
|
49 //* Imported function prototypes ---------------------------------------------*/ |
38 | 50 extern uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium); |
51 | |
52 /* Exported variables --------------------------------------------------------*/ | |
53 | |
54 const uint16_t BigFontSeperationLeftRight = 399; | |
55 const uint16_t BigFontSeperationTopBottom = 240; | |
56 | |
57 /* Private variables ---------------------------------------------------------*/ | |
58 GFX_DrawCfgScreen t3screen; | |
59 GFX_DrawCfgWindow t3l1; | |
60 GFX_DrawCfgWindow t3r1; | |
61 GFX_DrawCfgWindow t3c1; | |
62 GFX_DrawCfgWindow t3c2; | |
63 | |
529
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
64 uint8_t t3_selection_customview = CVIEW_noneOrDebug; |
38 | 65 |
841 | 66 static uint8_t AF_lastDecoDepth = 0; |
67 static uint16_t AF_lastTTS = 0; | |
68 | |
69 | |
38 | 70 /* TEM HAS TO MOVE TO GLOBAL--------------------------------------------------*/ |
71 | |
72 /* Private types -------------------------------------------------------------*/ | |
73 #define TEXTSIZE 16 | |
74 | |
841 | 75 /* defines for autofocus of compass */ |
76 #define AF_COMPASS_ACTIVATION_ANGLE (10.0f) /* angle for pitch and roll. Compass gets activated in case the value is smaller (OSTC4 hold in horitontal position */ | |
77 #define AF_COMPASS_DEBOUNCE (10u) /* debouncing value to avoid compass activation during normal movement */ | |
78 | |
79 | |
38 | 80 /* Private function prototypes -----------------------------------------------*/ |
81 void t3_refresh_divemode(void); | |
82 | |
83 uint8_t t3_test_customview_warnings(void); | |
84 void t3_refresh_customview(float depth); | |
496 | 85 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, point_t center, uint16_t ActualHeading, uint16_t UserSetHeading); |
841 | 86 uint8_t t3_EvaluateAFCondition(uint8_t T3CView); |
38 | 87 |
88 /* Exported functions --------------------------------------------------------*/ | |
89 | |
90 void t3_init(void) | |
91 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
92 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
93 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
94 |
837 | 95 t3_selection_customview = cv_changelist_BS[0]; |
38 | 96 |
97 t3screen.FBStartAdress = 0; | |
98 t3screen.ImageHeight = 480; | |
99 t3screen.ImageWidth = 800; | |
100 t3screen.LayerIndex = 1; | |
101 | |
102 t3l1.Image = &t3screen; | |
103 t3l1.WindowNumberOfTextLines = 2; | |
104 t3l1.WindowLineSpacing = 19; // Abstand von Y0 | |
105 t3l1.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
106 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
107 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
108 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
109 t3l1.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
110 t3l1.WindowX1 = BigFontSeperationLeftRight - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
111 t3l1.WindowY0 = BigFontSeperationTopBottom + 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
112 t3l1.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
113 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
114 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
115 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
116 t3l1.WindowX0 = 800 - BigFontSeperationLeftRight + 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
117 t3l1.WindowX1 = 799; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
118 t3l1.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
119 t3l1.WindowY1 = 479 - BigFontSeperationTopBottom + 5 ; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
120 } |
38 | 121 |
122 t3r1.Image = &t3screen; | |
123 t3r1.WindowNumberOfTextLines = t3l1.WindowNumberOfTextLines; | |
124 t3r1.WindowLineSpacing = t3l1.WindowLineSpacing; | |
125 t3r1.WindowTab = t3l1.WindowTab; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
126 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
127 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
128 t3r1.WindowX0 = BigFontSeperationLeftRight + 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
129 t3r1.WindowX1 = 799; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
130 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
131 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
132 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
133 t3r1.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
134 t3r1.WindowX1 = BigFontSeperationLeftRight - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
135 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
136 |
38 | 137 t3r1.WindowY0 = t3l1.WindowY0; |
138 t3r1.WindowY1 = t3l1.WindowY1; | |
139 | |
518 | 140 /* t3c1 is across the complete lower part of the display */ |
38 | 141 t3c1.Image = &t3screen; |
142 t3c1.WindowNumberOfTextLines = 2; | |
518 | 143 t3c1.WindowLineSpacing = 84 + 5; /* double font + spacing */ |
38 | 144 t3c1.WindowX0 = 0; |
145 t3c1.WindowX1 = 799; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
146 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
147 { |
511 | 148 t3c1.WindowY0 = 5; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
149 t3c1.WindowY1 = BigFontSeperationTopBottom - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
150 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
151 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
152 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
153 t3c1.WindowY0 = 480 - BigFontSeperationTopBottom + 5; |
511 | 154 t3c1.WindowY1 = 479 - 5; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
155 } |
38 | 156 |
518 | 157 /* t3c2 is just showing the lower right part of the display */ |
38 | 158 t3c2.Image = &t3screen; |
159 t3c2.WindowNumberOfTextLines = 3; | |
511 | 160 t3c2.WindowLineSpacing = t3c1.WindowLineSpacing ; |
38 | 161 t3c2.WindowX0 = 370; |
162 t3c2.WindowX1 = 799; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
163 t3c2.WindowY0 = t3c1.WindowY0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
164 t3c2.WindowY1 = t3c1.WindowY1; |
38 | 165 t3c2.WindowTab = 600; |
841 | 166 |
167 t3_EvaluateAFCondition(CVIEW_T3_END); /* reset debounce counters */ | |
38 | 168 } |
169 | |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
170 void t3_select_customview(uint8_t selectedCustomview) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
171 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
172 if(selectedCustomview < CVIEW_T3_END) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
173 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
174 t3_selection_customview = selectedCustomview; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
175 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
176 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
177 |
610 | 178 void t3_drawMarker(GFX_DrawCfgScreen *hgfx, const SWindowGimpStyle *window, uint8_t *data, uint16_t datalength, uint8_t color) |
179 { | |
180 uint16_t line = 0; | |
181 uint16_t dataIndex = 0; | |
182 uint16_t lastDataIndex = 0; | |
183 uint16_t windowWidth = 0; | |
184 int16_t factor = 0; | |
185 uint8_t setMarker = 0; | |
186 | |
187 point_t start; | |
188 point_t stop; | |
189 | |
190 | |
191 if( (window->bottom <= 479) | |
192 && (window->top <= 479) | |
193 && (window->right <= 799) | |
194 && (window->left <= 799) | |
195 && (window->right >= 0) | |
196 && (window->left >= 0) | |
197 && (window->bottom > window->top) | |
198 && (window->right > window->left)) | |
199 { | |
200 windowWidth = window->right - window->left; | |
201 | |
624
930f1bbe0ac2
Development bugfix: Marker in standard t3 view drawn in wrong direction
Ideenmodellierer
parents:
622
diff
changeset
|
202 start.y = 479 - BigFontSeperationTopBottom - 5; |
930f1bbe0ac2
Development bugfix: Marker in standard t3 view drawn in wrong direction
Ideenmodellierer
parents:
622
diff
changeset
|
203 stop.y =5; |
930f1bbe0ac2
Development bugfix: Marker in standard t3 view drawn in wrong direction
Ideenmodellierer
parents:
622
diff
changeset
|
204 |
610 | 205 while((line <= windowWidth) && (dataIndex < datalength)) |
206 { | |
207 factor = (10 * line * (long)datalength)/windowWidth; | |
208 dataIndex = factor/10; | |
209 /* check if a marker is set in the intervall which is bypassed because of data reduction */ | |
210 setMarker = 0; | |
211 while(lastDataIndex <= dataIndex) | |
212 { | |
213 lastDataIndex++; | |
214 if(data[lastDataIndex] != 0) | |
215 { | |
216 setMarker = 1; | |
217 break; | |
218 } | |
219 } | |
220 lastDataIndex = dataIndex; | |
221 int rest = factor - dataIndex*10; | |
222 if(rest >= 5) | |
223 dataIndex++; | |
224 | |
225 if((datalength - 1) < dataIndex) | |
226 dataIndex = datalength-1; | |
227 | |
228 if((line > 0) && (setMarker)) /* draw marker line */ | |
229 { | |
230 start.x = line; | |
231 stop.x = line; | |
232 GFX_draw_line(hgfx, start, stop, color); | |
233 } | |
234 line++; | |
235 dataIndex++; | |
236 } | |
237 } | |
238 } | |
239 | |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
240 void t3_miniLiveLogProfile(void) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
241 { |
641
ed5422ac4ffb
Development Bugfix Deco bars not shown after last deco stop passed:
Ideenmodellierer
parents:
633
diff
changeset
|
242 static uint8_t wasDecoDive = 0; |
ed5422ac4ffb
Development Bugfix Deco bars not shown after last deco stop passed:
Ideenmodellierer
parents:
633
diff
changeset
|
243 |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
244 SWindowGimpStyle wintemp; |
602
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
245 uint16_t replayDataLength = 0; |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
246 uint16_t liveDataLength = 0; |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
247 uint16_t drawDataLength = 0; |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
248 uint16_t* pReplayData; |
610 | 249 uint8_t* pReplayMarker; |
599 | 250 uint16_t max_depth = 10; |
251 char text[TEXTSIZE]; | |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
252 point_t start, stop; |
599 | 253 uint16_t diveMinutes = 0; |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
254 |
622 | 255 SSettings* pSettings; |
256 pSettings = settingsGetPointer(); | |
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
257 |
622 | 258 wintemp.top = 479 - BigFontSeperationTopBottom + 5; |
599 | 259 wintemp.bottom = 479 - 5; |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
260 |
622 | 261 if(!pSettings->FlipDisplay) |
262 { | |
263 wintemp.left = t3c1.WindowX0; | |
264 wintemp.right = t3c1.WindowX0 + CV_PROFILE_WIDTH; | |
265 } | |
266 else | |
267 { | |
268 wintemp.left = t3c1.WindowX1 - CV_PROFILE_WIDTH;; | |
269 wintemp.right = t3c1.WindowX1; | |
270 } | |
271 | |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
272 start.x = CV_PROFILE_WIDTH + 2; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
273 stop.x = start.x; |
622 | 274 start.y = 479 - BigFontSeperationTopBottom - 5; |
275 stop.y =5; | |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
276 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
277 GFX_draw_line(&t3screen, start, stop, CLUT_Font020); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
278 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
279 if(getReplayOffset() != 0xFFFF) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
280 { |
610 | 281 getReplayInfo(&pReplayData, &pReplayMarker, &replayDataLength, &max_depth, &diveMinutes); |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
282 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
283 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
284 if(max_depth < (uint16_t)(stateUsed->lifeData.max_depth_meter * 100)) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
285 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
286 max_depth = (uint16_t)(stateUsed->lifeData.max_depth_meter * 100); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
287 } |
602
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
288 |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
289 liveDataLength = getMiniLiveReplayLength(); |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
290 |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
291 if(replayDataLength > liveDataLength) |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
292 { |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
293 drawDataLength = replayDataLength; |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
294 } |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
295 else |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
296 { |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
297 drawDataLength = liveDataLength; |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
298 } |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
299 |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
300 if(drawDataLength < CV_PROFILE_WIDTH) |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
301 { |
602
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
302 drawDataLength = CV_PROFILE_WIDTH; |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
303 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
304 |
599 | 305 if(diveMinutes != 0) |
306 { | |
307 snprintf(text,TEXTSIZE,"\002%dmin",diveMinutes); | |
308 GFX_write_string(&FontT42,&t3c1,text,1); | |
309 } | |
310 | |
311 snprintf(text,TEXTSIZE,"\002%01.1fm", max_depth / 100.0); | |
312 GFX_write_string(&FontT42,&t3c1,text,0); | |
313 | |
641
ed5422ac4ffb
Development Bugfix Deco bars not shown after last deco stop passed:
Ideenmodellierer
parents:
633
diff
changeset
|
314 if(getMiniLiveReplayLength() < 10) /* new dive startet => reset the visualization state for deco data */ |
ed5422ac4ffb
Development Bugfix Deco bars not shown after last deco stop passed:
Ideenmodellierer
parents:
633
diff
changeset
|
315 { |
ed5422ac4ffb
Development Bugfix Deco bars not shown after last deco stop passed:
Ideenmodellierer
parents:
633
diff
changeset
|
316 wasDecoDive = 0; |
ed5422ac4ffb
Development Bugfix Deco bars not shown after last deco stop passed:
Ideenmodellierer
parents:
633
diff
changeset
|
317 } |
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
318 |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
758
diff
changeset
|
319 const SDecoinfo * pDecoinfo = getDecoInfo(); |
641
ed5422ac4ffb
Development Bugfix Deco bars not shown after last deco stop passed:
Ideenmodellierer
parents:
633
diff
changeset
|
320 if((pDecoinfo->output_time_to_surface_seconds) || (wasDecoDive)) /* draw deco data first => will be overlayed by all other informations */ |
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
321 { |
641
ed5422ac4ffb
Development Bugfix Deco bars not shown after last deco stop passed:
Ideenmodellierer
parents:
633
diff
changeset
|
322 wasDecoDive = 1; |
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
323 GFX_graph_print(&t3screen,&wintemp,wintemp.top * -1,1,0,max_depth, getMiniLiveDecoPointerToData(),drawDataLength, CLUT_NiceGreen, NULL); |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
324 } |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
325 |
602
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
326 if(replayDataLength != 0) |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
327 { |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
328 GFX_graph_print(&t3screen, &wintemp, 0,1,0, max_depth, pReplayData, drawDataLength, CLUT_Font031, NULL); |
610 | 329 if(pReplayMarker[0] != 0xFF) |
330 { | |
331 t3_drawMarker(&t3screen, &wintemp, pReplayMarker, drawDataLength, CLUT_CompassUserHeadingTick); | |
332 } | |
602
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
333 } |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
334 |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
335 if(liveDataLength > 3) |
599 | 336 { |
602
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
337 GFX_graph_print(&t3screen, &wintemp, 0,1,0, max_depth, getMiniLiveReplayPointerToData(), drawDataLength, CLUT_Font030, NULL); |
599 | 338 } |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
339 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
340 |
38 | 341 |
342 void t3_refresh(void) | |
343 { | |
496 | 344 static uint8_t last_mode = MODE_SURFACE; |
345 | |
38 | 346 SStateList status; |
347 get_globalStateList(&status); | |
348 | |
349 if(stateUsed->mode != MODE_DIVE) | |
350 { | |
351 settingsGetPointer()->design = 7; | |
352 return; | |
353 } | |
354 | |
355 if(status.base != BaseHome) | |
356 return; | |
357 | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
358 if(last_mode != MODE_DIVE) /* Select custom view */ |
496 | 359 { |
360 if((settingsGetPointer()->tX_customViewTimeout == 0) && (settingsGetPointer()->showDebugInfo)) | |
361 { | |
362 t3_selection_customview = CVIEW_noneOrDebug; | |
363 } | |
364 else | |
365 { | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
366 t3_selection_customview = settingsGetPointer()->tX_customViewPrimaryBF; |
496 | 367 } |
368 t3_change_customview(ACTION_END); | |
369 } | |
38 | 370 t3screen.FBStartAdress = getFrame(24); |
371 t3_refresh_divemode(); | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
372 GFX_SetFramesTopBottom(t3screen.FBStartAdress, 0,480); |
38 | 373 releaseAllFramesExcept(24,t3screen.FBStartAdress); |
496 | 374 last_mode = stateUsed->mode; |
38 | 375 } |
376 | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
377 void t3_set_customview_to_primary(void) |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
378 { |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
379 if(stateUsed->mode == MODE_DIVE) |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
380 { |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
381 t3_selection_customview = settingsGetPointer()->tX_customViewPrimaryBF; |
599 | 382 t3_change_customview(ACTION_END); |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
383 } |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
384 } |
38 | 385 |
386 /* Private functions ---------------------------------------------------------*/ | |
387 | |
388 float t3_basics_lines_depth_and_divetime(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode) | |
389 { | |
518 | 390 char text[256]; |
391 uint8_t textPointer; | |
38 | 392 uint8_t color; |
393 uint8_t depthChangeRate; | |
394 uint8_t depthChangeAscent; | |
395 point_t start, stop, startZeroLine; | |
518 | 396 SDivetime Divetime = {0,0,0,0}; |
38 | 397 |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
398 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
399 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
400 |
38 | 401 start.x = 0; |
402 stop.x = 799; | |
403 stop.y = start.y = BigFontSeperationTopBottom; | |
642
c737cf5d9067
Do not show focus indicator in case motion detection is suspended:
Ideenmodellierer
parents:
641
diff
changeset
|
404 if((viewInFocus()) && (!viewDetectionSuspended())) |
553 | 405 { |
406 GFX_draw_line(tXscreen, start, stop, CLUT_Font023); | |
407 } | |
408 else | |
409 { | |
410 GFX_draw_line(tXscreen, start, stop, CLUT_Font020); | |
411 } | |
412 | |
38 | 413 |
414 start.y = BigFontSeperationTopBottom; | |
415 stop.y = 479; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
416 |
38 | 417 stop.x = start.x = BigFontSeperationLeftRight; |
642
c737cf5d9067
Do not show focus indicator in case motion detection is suspended:
Ideenmodellierer
parents:
641
diff
changeset
|
418 if((viewInFocus() && (!viewDetectionSuspended()))) |
553 | 419 { |
420 GFX_draw_line(tXscreen, start, stop, CLUT_Font023); | |
421 } | |
422 else | |
423 { | |
424 GFX_draw_line(tXscreen, start, stop, CLUT_Font020); | |
425 } | |
38 | 426 |
427 /* depth */ | |
174
ecb71521d004
Bugfix: make max depth move with current depth (part 2)
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
428 float depth = unit_depth_float(stateUsed->lifeData.depth_meter); |
38 | 429 |
430 if(depth <= 0.3f) | |
431 depth = 0; | |
432 | |
433 if(settingsGetPointer()->nonMetricalSystem) | |
434 snprintf(text,TEXTSIZE,"\032\f[feet]"); | |
435 else | |
436 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Depth); | |
437 GFX_write_string(&FontT42,tXl1,text,0); | |
438 | |
439 if( ((mode == DIVEMODE_Apnea) && ((stateUsed->lifeData.ascent_rate_meter_per_min > 4) || (stateUsed->lifeData.ascent_rate_meter_per_min < -4 ))) | |
440 || ((mode != DIVEMODE_Apnea) && ((stateUsed->lifeData.ascent_rate_meter_per_min > 8) || (stateUsed->lifeData.ascent_rate_meter_per_min < -10))) | |
441 ) | |
442 { | |
443 snprintf(text,TEXTSIZE,"\f\002%.0f %c%c/min " | |
444 , unit_depth_float(stateUsed->lifeData.ascent_rate_meter_per_min) | |
445 , unit_depth_char1() | |
446 , unit_depth_char2() | |
447 ); | |
448 GFX_write_string(&FontT42,tXl1,text,0); | |
449 } | |
450 | |
451 if( depth < 100) | |
452 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",depth); | |
453 else | |
454 snprintf(text,TEXTSIZE,"\020\003\016%01.0f",depth); | |
455 | |
456 t3_basics_colorscheme_mod(text); | |
457 GFX_write_string(&FontT105,tXl1,text,1); | |
458 | |
459 | |
460 /* ascentrate graph */ | |
461 if(mode == DIVEMODE_Apnea) | |
462 { | |
463 /* ascentrate graph - apnea mode */ | |
464 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) | |
465 { | |
466 depthChangeAscent = 1; | |
467 if(stateUsed->lifeData.ascent_rate_meter_per_min < 200) | |
468 depthChangeRate = (uint8_t)stateUsed->lifeData.ascent_rate_meter_per_min; | |
469 else | |
470 depthChangeRate = 200; | |
471 } | |
472 else | |
473 { | |
474 depthChangeAscent = 0; | |
475 if(stateUsed->lifeData.ascent_rate_meter_per_min > -200) | |
476 depthChangeRate = (uint8_t)(0 - stateUsed->lifeData.ascent_rate_meter_per_min); | |
477 else | |
478 depthChangeRate = 200; | |
479 } | |
413 | 480 |
481 if(!pSettings->FlipDisplay) | |
482 { | |
483 start.y = tXl1->WindowY0 - 1; | |
484 } | |
485 else | |
486 { | |
487 start.y = tXl1->WindowY1 + 1; | |
488 } | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
489 startZeroLine.y = start.y; |
38 | 490 for(int i = 0; i<5;i++) |
491 { | |
492 start.y += 40; | |
493 stop.y = start.y; | |
413 | 494 if(!pSettings->FlipDisplay) |
495 { | |
496 start.x = tXl1->WindowX1 - 1; | |
497 } | |
498 else | |
499 { | |
500 start.x = tXr1->WindowX1 - 1; | |
501 } | |
38 | 502 stop.x = start.x - 17; |
503 | |
504 if(depthChangeRate <= 6) | |
505 { | |
506 if(i == 2) | |
507 { | |
508 startZeroLine.y = start.y; | |
509 stop.x = start.x - 34; | |
510 } | |
511 } | |
512 else | |
513 { | |
514 if(((i == 1) && depthChangeAscent) || ((i == 3) && !depthChangeAscent)) | |
515 { | |
516 startZeroLine.y = start.y; | |
517 stop.x = start.x - 34; | |
518 } | |
519 } | |
520 GFX_draw_line(tXscreen, start, stop, 0); | |
521 } | |
522 // new thick bar design Sept. 2015 | |
523 if((stateUsed->lifeData.ascent_rate_meter_per_min > 4) || (stateUsed->lifeData.ascent_rate_meter_per_min < -4)) | |
524 { | |
525 start.y = startZeroLine.y; | |
526 if(depthChangeAscent) | |
527 { | |
528 color = CLUT_EverythingOkayGreen; | |
529 start.y += 7; // starte etwas weiter oben | |
530 stop.y = start.y + (uint16_t)(depthChangeRate * 4) - 9; // - x; // wegen der Liniendicke | |
531 if(stop.y > 475) | |
532 stop.y = 475; | |
533 } | |
534 else | |
535 { | |
536 color = CLUT_Font023; | |
537 start.y -= 7; | |
538 stop.y = start.y - (uint16_t)(depthChangeRate * 4) + 9; | |
539 if(stop.y <= tXl1->WindowY0) | |
540 stop.y = tXl1->WindowY0 + 1; | |
541 } | |
413 | 542 if(!pSettings->FlipDisplay) |
543 { | |
544 start.x = tXl1->WindowX1 - 3 - 5; | |
545 } | |
546 else | |
547 { | |
548 start.x = tXr1->WindowX1 - 3 - 5; | |
549 } | |
550 | |
551 stop.x = start.x; | |
38 | 552 GFX_draw_thick_line(12,tXscreen, start, stop, color); |
553 } | |
554 } | |
555 else | |
556 { | |
557 /* ascentrate graph -standard mode */ | |
558 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) | |
559 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
560 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
561 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
562 start.y = tXl1->WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
563 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
564 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
565 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
566 start.y = tXl1->WindowY1 + 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
567 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
568 |
38 | 569 for(int i = 0; i<4;i++) |
570 { | |
571 start.y += 5*8; | |
572 stop.y = start.y; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
573 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
574 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
575 start.x = tXl1->WindowX1 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
576 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
577 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
578 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
579 start.x = tXr1->WindowX1 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
580 } |
38 | 581 stop.x = start.x - 17; |
582 GFX_draw_line(tXscreen, start, stop, 0); | |
583 } | |
584 // new thick bar design Sept. 2015 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
585 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
586 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
587 start.x = tXl1->WindowX1 - 3 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
588 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
589 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
590 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
591 start.x = tXr1->WindowX1 - 3 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
592 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
593 |
38 | 594 stop.x = start.x; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
595 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
596 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
597 start.y = tXl1->WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
598 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
599 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
600 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
601 start.y = tXl1->WindowY1 + 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
602 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
603 |
38 | 604 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 8); |
605 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9 | |
606 if(stop.y >= 470) | |
607 stop.y = 470; | |
608 start.y += 7; // starte etwas weiter oben | |
609 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 10) | |
610 color = CLUT_EverythingOkayGreen; | |
611 else | |
612 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 15) | |
613 color = CLUT_WarningYellow; | |
614 else | |
615 color = CLUT_WarningRed; | |
616 | |
617 GFX_draw_thick_line(12,tXscreen, start, stop, color); | |
618 } | |
619 } | |
620 | |
621 // divetime | |
622 if(mode == DIVEMODE_Apnea) | |
623 { | |
624 if(stateUsed->lifeData.counterSecondsShallowDepth) | |
625 { | |
626 SDivetime SurfaceBreakTime = {0,0,0,0}; | |
627 | |
628 SurfaceBreakTime.Total = stateUsed->lifeData.counterSecondsShallowDepth; | |
629 SurfaceBreakTime.Minutes = SurfaceBreakTime.Total / 60; | |
630 SurfaceBreakTime.Seconds = SurfaceBreakTime.Total - (SurfaceBreakTime.Minutes * 60); | |
631 | |
632 snprintf(text,TEXTSIZE,"\032\f\002%c%c", TXT_2BYTE,TXT2BYTE_ApneaSurface); | |
633 GFX_write_string(&FontT42,tXr1,text,0); | |
634 | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
635 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",SurfaceBreakTime.Minutes, SurfaceBreakTime.Seconds); |
38 | 636 } |
637 else | |
638 { | |
639 Divetime.Total = stateUsed->lifeData.dive_time_seconds; | |
640 Divetime.Minutes = Divetime.Total / 60; | |
641 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); | |
642 | |
643 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
644 GFX_write_string(&FontT42,tXr1,text,0); | |
645 | |
646 if(Divetime.Minutes < 100) | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
647 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",Divetime.Minutes, Divetime.Seconds); |
38 | 648 else |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
649 snprintf(text,TEXTSIZE,"\020\003\002\016%u'",Divetime.Minutes); |
38 | 650 } |
518 | 651 t3_basics_colorscheme_mod(text); |
652 GFX_write_string(&FontT105,tXr1,text,1); | |
38 | 653 } |
654 else | |
655 { | |
518 | 656 switch(get_globalState()) |
657 { | |
739 | 658 case StDMENU: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_DiveMenuQ); |
659 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
660 break; | |
518 | 661 case StDBEAR: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_DiveBearingQ); |
662 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
663 break; | |
664 case StDRAVG: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_DiveResetAvgQ); | |
665 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
666 break; | |
38 | 667 |
518 | 668 case StDMGAS: |
669 textPointer = 0; | |
670 text[textPointer++] = '\a'; | |
671 text[textPointer++] = '\001'; | |
672 text[textPointer++] = ' '; | |
673 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[actualBetterGasId()].oxygen_percentage,stateUsed->diveSettings.gas[actualBetterGasId()].helium_percentage,&text[textPointer]); | |
674 text[textPointer++] = '?'; | |
675 text[textPointer++] = ' '; | |
676 text[textPointer++] = 0; | |
677 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
678 break; | |
613 | 679 |
680 case StDMARK: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_SetMarkerShort); | |
681 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
682 break; | |
683 | |
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
684 case StDCHECK: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_CheckMarker); |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
685 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
686 break; |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
687 |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
688 #ifdef ENABLE_T3_PPO_SIM |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
689 case StDSIM1: snprintf(text,TEXTSIZE,"\a\003\001PPO S0 +"); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
690 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
691 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
692 case StDSIM2: snprintf(text,TEXTSIZE,"\a\003\001PPO S0 -"); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
693 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
694 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
695 case StDSIM3: snprintf(text,TEXTSIZE,"\a\003\001PPO S1 +"); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
696 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
697 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
698 case StDSIM4: snprintf(text,TEXTSIZE,"\a\003\001PPO S1 -"); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
699 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
700 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
701 case StDSIM5: snprintf(text,TEXTSIZE,"\a\003\001PPO S2 +"); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
702 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
703 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
704 case StDSIM6: snprintf(text,TEXTSIZE,"\a\003\001PPO S2 -"); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
705 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
706 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
707 #endif |
518 | 708 default: /* show divetime */ |
38 | 709 |
518 | 710 Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; |
711 Divetime.Minutes = Divetime.Total / 60; | |
712 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); | |
713 | |
714 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
715 GFX_write_string(&FontT42,tXr1,text,0); | |
716 | |
717 if(Divetime.Minutes < 100) | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
718 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",Divetime.Minutes, Divetime.Seconds); |
518 | 719 else |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
720 snprintf(text,TEXTSIZE,"\020\003\002\016%u'",Divetime.Minutes); |
518 | 721 |
722 t3_basics_colorscheme_mod(text); | |
723 GFX_write_string(&FontT105,tXr1,text,1); | |
724 break; | |
725 } | |
38 | 726 } |
727 | |
728 return depth; | |
729 } | |
730 | |
731 | |
732 void t3_refresh_divemode(void) | |
733 { | |
734 uint8_t customview_warnings = 0; | |
735 float depth_meter = 0.0; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
736 |
38 | 737 // everything like lines, depth, ascent graph and divetime |
738 depth_meter = t3_basics_lines_depth_and_divetime(&t3screen, &t3l1, &t3r1, 0); // 0 could be stateUsed->diveSettings.diveMode for CCR specials | |
739 | |
740 // customview | |
741 if(stateUsed->warnings.numWarnings) | |
742 customview_warnings = t3_test_customview_warnings(); | |
743 | |
744 if(customview_warnings && warning_count_high_time) | |
745 t3_basics_show_customview_warnings(&t3c1); | |
746 else | |
747 t3_refresh_customview(depth_meter); | |
748 | |
749 if(stateUsed->warnings.lowBattery) | |
496 | 750 t3_basics_battery_low_customview_extra(&t3r1); //t3c1); |
38 | 751 } |
752 | |
753 | |
754 void t3_basics_battery_low_customview_extra(GFX_DrawCfgWindow* tXc1) | |
755 { | |
756 char TextC1[256]; | |
757 | |
496 | 758 TextC1[0] = ' ';//'\002'; |
38 | 759 TextC1[1] = '\f'; |
760 TextC1[2] = '\025'; | |
761 TextC1[3] = '3'; | |
762 TextC1[4] = '1'; | |
763 TextC1[5] = '1'; | |
764 TextC1[6] = '1'; | |
765 TextC1[7] = '1'; | |
766 TextC1[8] = '1'; | |
767 TextC1[9] = '1'; | |
768 TextC1[10] = '1'; | |
769 TextC1[11] = '1'; | |
770 TextC1[12] = '1'; | |
771 TextC1[13] = '1'; | |
772 TextC1[14] = '0'; | |
773 TextC1[15] = 0; | |
774 | |
775 if(!warning_count_high_time) | |
776 TextC1[4] = '2'; | |
777 | |
778 GFX_write_string(&Batt24,tXc1,TextC1,0); | |
779 } | |
780 | |
781 | |
782 | |
783 void t3_refresh_customview(float depth) | |
784 { | |
272
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
237
diff
changeset
|
785 t3_basics_refresh_customview(depth, t3_selection_customview, &t3screen, &t3c1, &t3c2, stateUsedWrite->diveSettings.diveMode); |
38 | 786 } |
787 | |
788 | |
789 void t3_basics_refresh_apnoeRight(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) | |
790 { | |
722 | 791 char text[30]; |
38 | 792 uint16_t textpointer = 0; |
793 | |
794 // CVIEW_T3_Temperature | |
795 float temperature; | |
413 | 796 SSettings* pSettings; |
797 pSettings = settingsGetPointer(); | |
38 | 798 |
799 SDivetime TotalDivetime = {0,0,0,0}; | |
800 SDivetime LastDivetime = {0,0,0,0}; | |
801 | |
802 uint16_t tempWinX0; | |
413 | 803 uint16_t tempWinX1; |
38 | 804 uint16_t tempWinY0; |
413 | 805 uint16_t tempWinY1; |
38 | 806 |
807 tempWinX0 = tXc1->WindowX0; | |
413 | 808 tempWinX1 = tXc1->WindowX1; |
38 | 809 tempWinY0 = tXc1->WindowY0; |
413 | 810 tempWinY1 = tXc1->WindowY1; |
38 | 811 |
812 tXc1->WindowX0 = 440; // rechte Seite | |
813 | |
814 switch(tX_selection_customview) | |
815 { | |
816 case CVIEW_T3_Temperature: | |
817 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature); | |
818 GFX_write_string(&FontT42,tXc1,text,0); | |
819 | |
189
8b8074080d7b
Bugfix: average temperature on arrival from RTE instead of display time
Jan Mulder <jlmulder@xs4all.nl>
parents:
174
diff
changeset
|
820 temperature = unit_temperature_float(stateUsed->lifeData.temperature_celsius); |
38 | 821 textpointer = snprintf(text,TEXTSIZE,"\020\003\016%01.0f\016\016\140",temperature); // "\016\016%01.1f `" + C or F |
822 if(settingsGetPointer()->nonMetricalSystem == 0) | |
823 text[textpointer++] = 'C'; | |
824 else | |
825 text[textpointer++] = 'F'; | |
826 text[textpointer++] = 0; | |
827 t3_basics_colorscheme_mod(text); | |
828 GFX_write_string(&FontT105,tXc1,text,1); | |
829 break; | |
830 | |
831 case CVIEW_T3_ApnoeSurfaceInfo: | |
832 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Divetime); | |
833 GFX_write_string(&FontT42,tXc1,text,0); | |
834 | |
835 TotalDivetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; | |
836 TotalDivetime.Minutes = TotalDivetime.Total / 60; | |
837 TotalDivetime.Seconds = TotalDivetime.Total - ( TotalDivetime.Minutes * 60 ); | |
838 | |
839 LastDivetime.Total = stateUsed->lifeData.apnea_last_dive_time_seconds; | |
840 LastDivetime.Minutes = LastDivetime.Total / 60; | |
841 LastDivetime.Seconds = LastDivetime.Total - ( LastDivetime.Minutes * 60 ); | |
842 | |
413 | 843 // tXc1->WindowY0 = 100; // obere Zeile |
844 if(!pSettings->FlipDisplay) | |
845 { | |
846 tXc1->WindowY0 = 100; | |
847 } | |
848 else | |
849 { | |
850 tXc1->WindowY1 -= 100; /* jump to upper of two lines */ | |
851 } | |
38 | 852 |
853 snprintf(text,TEXTSIZE,"\020\016%u:%02u",LastDivetime.Minutes, LastDivetime.Seconds); | |
854 t3_basics_colorscheme_mod(text); | |
855 GFX_write_string(&FontT105,tXc1,text,0); | |
856 | |
413 | 857 if(pSettings->FlipDisplay) |
858 { | |
859 tXc1->WindowX0 = 0; | |
860 | |
861 } | |
38 | 862 snprintf(text,TEXTSIZE,"\032\002%c%c",TXT_2BYTE, TXT2BYTE_ApneaLast); |
863 GFX_write_string(&FontT42,tXc1,text,0); | |
864 | |
413 | 865 if(!pSettings->FlipDisplay) |
866 { | |
867 tXc1->WindowY0 = tempWinY0; | |
868 } | |
869 else | |
870 { | |
871 tXc1->WindowX1 = tempWinX1; | |
872 tXc1->WindowY1 = tempWinY1; /* jump to upper of two lines */ | |
873 } | |
38 | 874 |
875 snprintf(text,TEXTSIZE,"\020\016%u:%02u",TotalDivetime.Minutes, TotalDivetime.Seconds); | |
876 t3_basics_colorscheme_mod(text); | |
877 GFX_write_string(&FontT105,tXc1,text,0); | |
878 | |
879 snprintf(text,TEXTSIZE,"\032\002%c%c",TXT_2BYTE, TXT2BYTE_ApneaTotal); | |
413 | 880 if(pSettings->FlipDisplay) |
881 { | |
882 tXc1->WindowX0 = 0; | |
883 | |
884 } | |
38 | 885 GFX_write_string(&FontT42,tXc1,text,0); |
886 break; | |
887 } | |
888 | |
889 tXc1->WindowX0 = tempWinX0; | |
413 | 890 tXc1->WindowX1 = tempWinX1; |
38 | 891 tXc1->WindowY0 = tempWinY0; |
892 | |
893 } | |
894 | |
895 | |
896 void t3_basics_refresh_customview(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) | |
897 { | |
837 | 898 static uint8_t last_customview = CVIEW_T3_END; |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
899 |
722 | 900 char text[30]; |
38 | 901 uint16_t textpointer = 0; |
902 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
903 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
904 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
905 |
38 | 906 // CVIEW_T3_Decostop and CVIEW_T3_TTS |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
758
diff
changeset
|
907 const SDecoinfo * pDecoinfo = getDecoInfo(); |
38 | 908 |
909 // CVIEW_T3_Decostop | |
910 uint16_t nextstopLengthSeconds = 0; | |
911 uint8_t nextstopDepthMeter = 0; | |
912 SDivetime SafetyStopTime = {0,0,0,0}; | |
913 | |
914 // CVIEW_T3_ppO2andGas | |
915 uint8_t oxygen_percentage = 0; | |
916 | |
917 // CVIEW_T3_Temperature | |
918 float temperature; | |
919 | |
920 // CVIEW_T3_GasList | |
921 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth; | |
922 const SGasLine * pGasLine; | |
923 uint8_t oxygen, helium; | |
924 uint8_t lineNumber; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
925 uint8_t gasPosIdx; |
38 | 926 |
496 | 927 /* compass position */ |
928 point_t center; | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
929 uint16_t heading; |
496 | 930 |
38 | 931 // CVIEW_T3_StopWatch |
932 SDivetime Stopwatch = {0,0,0,0}; | |
933 float fAverageDepth, fAverageDepthAbsolute; | |
934 | |
662 | 935 #ifdef ENABLE_PSCR_MODE |
936 uint8_t showSimPPO2 = 1; | |
937 #endif | |
38 | 938 uint16_t tempWinX0; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
939 uint16_t tempWinX1; |
38 | 940 uint16_t tempWinY0; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
941 uint16_t tempWinY1; |
38 | 942 uint16_t tempWinC2X0; |
413 | 943 uint16_t tempWinC2Y0; |
944 uint16_t tempWinC2X1; | |
945 uint16_t tempWinC2Y1; | |
38 | 946 uint16_t tempWinC2Tab; |
947 | |
948 tempWinX0 = tXc1->WindowX0; | |
949 tempWinY0 = tXc1->WindowY0; | |
496 | 950 tempWinX1 = tXc1->WindowX1; |
951 tempWinY1 = tXc1->WindowY1; | |
413 | 952 |
38 | 953 tempWinC2X0 = tXc2->WindowX0; |
413 | 954 tempWinC2Y0 = tXc2->WindowY0; |
955 tempWinC2X1 = tXc2->WindowX1; | |
956 tempWinC2Y1 = tXc2->WindowY1; | |
38 | 957 tempWinC2Tab = tXc2->WindowTab; |
958 | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
959 if(settingsGetPointer()->compassInertia) |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
960 { |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
961 heading = (uint16_t)compass_getCompensated(); |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
962 } |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
963 else |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
964 { |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
965 heading = (uint16_t)stateUsed->lifeData.compass_heading; |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
966 } |
837 | 967 if((last_customview != tX_selection_customview) && (settingsGetPointer()->design == 3)) /* check if current selection is disabled and should be skipped */ |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
968 { |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
969 if(t3_customview_disabled(tX_selection_customview)) |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
970 { |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
971 tX_selection_customview = t3_change_customview(ACTION_BUTTON_ENTER); |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
972 } |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
973 last_customview = tX_selection_customview; |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
974 } |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
975 |
38 | 976 switch(tX_selection_customview) |
977 { | |
978 case CVIEW_T3_ApnoeSurfaceInfo: | |
979 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
980 | |
413 | 981 if(!pSettings->FlipDisplay) |
982 { | |
983 GFX_write_string(&FontT42,tXc1,text,0); | |
984 tXc1->WindowY0 = 100; | |
985 } | |
986 else | |
987 { | |
988 GFX_write_string(&FontT42,tXc2,text,0); | |
989 tXc2->WindowY1 -= 100; /* jump to upper of two lines */ | |
990 } | |
38 | 991 |
992 snprintf(text,TEXTSIZE,"\020\016%01.1f",unit_depth_float(stateUsed->lifeData.apnea_last_max_depth_meter)); | |
993 t3_basics_colorscheme_mod(text); | |
413 | 994 |
995 if(!pSettings->FlipDisplay) | |
996 { | |
997 GFX_write_string(&FontT105,tXc1,text,0); | |
998 tXc1->WindowY0 = tempWinY0; | |
999 } | |
1000 else | |
1001 { | |
1002 GFX_write_string(&FontT105,tXc2,text,0); | |
1003 tXc2->WindowY1 = tempWinC2Y1; /* jump to upper of two lines */ | |
1004 } | |
38 | 1005 |
1006 | |
1007 snprintf(text,TEXTSIZE,"\020\016%01.1f",unit_depth_float(stateUsed->lifeData.apnea_total_max_depth_meter)); | |
1008 t3_basics_colorscheme_mod(text); | |
413 | 1009 if(!pSettings->FlipDisplay) |
1010 { | |
1011 GFX_write_string(&FontT105,tXc1,text,0); | |
1012 } | |
1013 else | |
1014 { | |
1015 GFX_write_string(&FontT105,tXc2,text,0); | |
1016 } | |
38 | 1017 break; |
1018 | |
1019 case CVIEW_T3_StopWatch: | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1020 |
38 | 1021 Stopwatch.Total = timer_Stopwatch_GetTime(); |
1022 Stopwatch.Minutes = Stopwatch.Total / 60; | |
1023 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
1024 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
1025 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
1026 | |
1027 snprintf(text,TEXTSIZE,"\032\f%c",TXT_AvgDepth); | |
1028 GFX_write_string(&FontT42,tXc1,text,0); | |
1029 snprintf(text,TEXTSIZE,"\030\003\016%01.1f",unit_depth_float(fAverageDepthAbsolute)); | |
1030 GFX_write_string(&FontT105,tXc1,text,0); | |
1031 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1032 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1033 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1034 tXc1->WindowX0 = 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1035 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1036 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1037 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1038 tXc1->WindowX1 = 320; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1039 tXc1->WindowY0 = t3c1.WindowY0; /* select customer window */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1040 } |
38 | 1041 // snprintf(text,TEXTSIZE,"\032\f%c%c - %c",TXT_2BYTE, TXT2BYTE_Clock, TXT_AvgDepth); |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1042 |
38 | 1043 snprintf(text,TEXTSIZE,"\032\f%c", TXT_Stopwatch); |
1044 GFX_write_string(&FontT42,tXc1,text,0); | |
1045 snprintf(text,TEXTSIZE,"\030\016%01.1f",unit_depth_float(fAverageDepth)); | |
1046 GFX_write_string(&FontT105,tXc1,text,0); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1047 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1048 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1049 tXc1->WindowY0 = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1050 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1051 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1052 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1053 tXc1->WindowY1 -= 100; /* jump to upper of two lines */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1054 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1055 |
38 | 1056 snprintf(text,TEXTSIZE,"\030%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); |
1057 GFX_write_string(&FontT105,tXc1,text,0); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1058 |
496 | 1059 break; |
38 | 1060 |
1061 case CVIEW_T3_GasList: | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1062 gasPosIdx = 0; |
38 | 1063 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist); |
1064 GFX_write_string(&FontT42,tXc1,text,0); | |
1065 | |
1066 textpointer = 0; | |
1067 tXc2->WindowX0 = 0; | |
518 | 1068 tXc2->WindowTab = 800/3; // /2 |
38 | 1069 |
413 | 1070 if(pSettings->FlipDisplay) |
1071 { | |
1072 tXc2->WindowY1 = 0; | |
1073 } | |
1074 | |
38 | 1075 pGasLine = settingsGetPointer()->gas; |
1076 if(actualLeftMaxDepth(stateUsed)) | |
1077 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_deco) / 100; | |
1078 else | |
1079 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100; | |
1080 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100; | |
1081 for(int gasId=1;gasId<=NUM_GASES;gasId++) | |
1082 { | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1083 #ifdef ENABLE_UNUSED_GAS_HIDING |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1084 if(!pGasLine[gasId].note.ub.off) |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1085 { |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1086 #endif |
38 | 1087 textpointer = 0; |
518 | 1088 text[textpointer++] = '\003'; |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1089 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1090 lineNumber = 1; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1091 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1092 switch(gasPosIdx) |
38 | 1093 { |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1094 case 0: lineNumber = 0; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1095 case 1: |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1096 break; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1097 case 4: text[textpointer++] = '\001'; /* display centered */ |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1098 break; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1099 case 2: lineNumber = 0; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1100 case 3: text[textpointer++] = '\002'; /* display right aligned */ |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1101 default: |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1102 break; |
38 | 1103 } |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1104 gasPosIdx++; |
518 | 1105 |
38 | 1106 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100; |
1107 if(pGasLine[gasId].note.ub.active == 0) | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1108 strcpy(&text[textpointer++],"\031"); |
518 | 1109 else if(stateUsed->lifeData.actualGas.GasIdInSettings == gasId) /* actual selected gas */ |
1110 { | |
1111 strcpy(&text[textpointer++],"\030"); | |
1112 } | |
38 | 1113 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow)) |
1114 strcpy(&text[textpointer++],"\025"); | |
518 | 1115 else if(actualBetterGasId() == gasId) |
1116 { | |
1117 strcpy(&text[textpointer++],"\026"); /* Highlight better gas */ | |
1118 } | |
38 | 1119 else |
518 | 1120 strcpy(&text[textpointer++],"\023"); /* Blue for travel or deco without special state */ |
38 | 1121 |
1122 text[textpointer++] = ' '; | |
1123 oxygen = pGasLine[gasId].oxygen_percentage; | |
1124 helium = pGasLine[gasId].helium_percentage; | |
1125 textpointer += write_gas(&text[textpointer], oxygen, helium); | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1126 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1127 if((pGasLine[gasId].depth_meter) && (gasPosIdx < 5)) /* do not show for potential last gas because of formating issues */ |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1128 { |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1129 textpointer += snprintf(&text[textpointer],7,"\016\016%u%c%c",unit_depth_integer(pGasLine[gasId].depth_meter), unit_depth_char1(), unit_depth_char2()); |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1130 } |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1131 text[textpointer++] = 0; |
518 | 1132 GFX_write_string(&FontT42, tXc1, text, lineNumber); |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1133 #ifdef ENABLE_UNUSED_GAS_HIDING |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1134 } |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1135 #endif |
38 | 1136 } |
1137 break; | |
1138 | |
1139 case CVIEW_T3_Temperature: | |
1140 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature); | |
1141 GFX_write_string(&FontT42,tXc1,text,0); | |
189
8b8074080d7b
Bugfix: average temperature on arrival from RTE instead of display time
Jan Mulder <jlmulder@xs4all.nl>
parents:
174
diff
changeset
|
1142 |
8b8074080d7b
Bugfix: average temperature on arrival from RTE instead of display time
Jan Mulder <jlmulder@xs4all.nl>
parents:
174
diff
changeset
|
1143 temperature = unit_temperature_float(stateUsed->lifeData.temperature_celsius); |
38 | 1144 textpointer = snprintf(text,TEXTSIZE,"\030\003\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F |
1145 if(settingsGetPointer()->nonMetricalSystem == 0) | |
1146 text[textpointer++] = 'C'; | |
1147 else | |
1148 text[textpointer++] = 'F'; | |
1149 text[textpointer++] = 0; | |
1150 GFX_write_string(&FontT105,tXc1,text,0); | |
1151 break; | |
1152 | |
1153 case CVIEW_Compass: | |
496 | 1154 center.x = 600; |
1155 center.y = 116; | |
38 | 1156 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); |
1157 GFX_write_string(&FontT42,tXc1,text,0); | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1158 snprintf(text,100,"\030\003%03i`",heading); |
38 | 1159 GFX_write_string(&FontT105,tXc1,text,0); |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1160 t3_basics_compass(tXscreen, center, heading, stateUsed->diveSettings.compassHeading); |
38 | 1161 break; |
601 | 1162 #ifdef ENABLE_T3_PROFILE_VIEW |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
1163 case CVIEW_T3_Profile: |
599 | 1164 snprintf(text,100,"\032\f\002%c%c",TXT_2BYTE,TXT2BYTE_Profile); |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
1165 GFX_write_string(&FontT42,tXc1,text,0); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
1166 t3_miniLiveLogProfile(); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
1167 break; |
601 | 1168 #endif |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1169 case CVIEW_T3_DecoTTS: |
38 | 1170 case CVIEW_T3_Decostop: |
1171 default: | |
1172 // decostop | |
1173 if(pDecoinfo->output_time_to_surface_seconds) | |
1174 { | |
1175 tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
1176 } | |
1177 else | |
1178 { | |
1179 nextstopDepthMeter = 0; | |
1180 nextstopLengthSeconds = 0; | |
1181 } | |
1182 | |
1183 SafetyStopTime.Total = timer_Safetystop_GetCountDown(); | |
1184 SafetyStopTime.Minutes = SafetyStopTime.Total / 60; | |
1185 SafetyStopTime.Seconds = SafetyStopTime.Total - (SafetyStopTime.Minutes * 60); | |
1186 | |
1187 if(nextstopDepthMeter) | |
1188 { | |
1189 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Decostop); | |
1190 GFX_write_string(&FontT42,tXc1,text,0); | |
1191 | |
1192 textpointer = 0; | |
1193 snprintf(&text[textpointer],TEXTSIZE,"\020\003%u%c%c %u'" | |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1194 , unit_depth_integer(nextstopDepthMeter) |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1195 , unit_depth_char1_T105() |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1196 , unit_depth_char2_T105() |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1197 , (nextstopLengthSeconds+59)/60); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1198 t3_basics_colorscheme_mod(text); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1199 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1200 } |
1201 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit())) | |
1202 { | |
1203 textpointer = 0; | |
1204 snprintf(&text[textpointer],TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2); | |
1205 GFX_write_string(&FontT42,tXc1,text,0); | |
1206 | |
1207 textpointer = 0; | |
1208 snprintf(&text[textpointer],TEXTSIZE,"\020\003\016%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds); | |
1209 t3_basics_colorscheme_mod(text); | |
496 | 1210 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1211 } |
237
ec16fd26e280
Bugfix: do not show NDL in bigscreen mode when zero
Jan Mulder <jlmulder@xs4all.nl>
parents:
214
diff
changeset
|
1212 else if(pDecoinfo->output_ndl_seconds) // NDL |
38 | 1213 { |
1214 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Nullzeit); | |
1215 GFX_write_string(&FontT42,tXc1,text,0); | |
1216 if(pDecoinfo->output_ndl_seconds < 1000 * 60) | |
1217 snprintf(text,TEXTSIZE,"\020\003%i'",pDecoinfo->output_ndl_seconds/60); | |
1218 else | |
1219 snprintf(text,TEXTSIZE,"\020\003%ih",pDecoinfo->output_ndl_seconds/3600); | |
1220 t3_basics_colorscheme_mod(text); | |
496 | 1221 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1222 } |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1223 |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1224 if(tX_selection_customview == CVIEW_T3_DecoTTS) /* add tts data on right side of screen */ |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1225 { |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1226 if(pDecoinfo->output_time_to_surface_seconds) |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1227 { |
722 | 1228 snprintf(text,TEXTSIZE,"\002\032\f%c",TXT_TTS); |
1229 GFX_write_string(&FontT42,tXc1,text,0); | |
1230 if(pDecoinfo->output_time_to_surface_seconds) | |
1231 { | |
1232 if(pDecoinfo->output_time_to_surface_seconds < 100 * 60) | |
1233 snprintf(text,TEXTSIZE,"\020\003\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60); | |
1234 else | |
1235 snprintf(text,TEXTSIZE,"\020\003\002%ih",(pDecoinfo->output_time_to_surface_seconds + 59)/ 3600); | |
1236 t3_basics_colorscheme_mod(text); | |
1237 GFX_write_string(&FontT105,tXc1,text,0); | |
1238 } | |
1239 } | |
1240 else if(pDecoinfo->super_saturation > 0.1) | |
1241 { | |
1242 snprintf(text,TEXTSIZE,"\002\032\f%c",TXT_ActualGradient); | |
1243 GFX_write_string(&FontT42,tXc1,text,0); | |
1244 snprintf(text,TEXTSIZE,"\020\003\002%.0f\016\016%%\017",100 * pDecoinfo->super_saturation); | |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1245 t3_basics_colorscheme_mod(text); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1246 GFX_write_string(&FontT105,tXc1,text,0); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1247 } |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1248 } |
38 | 1249 break; |
1250 | |
837 | 1251 case CVIEW_T3_sensors: |
38 | 1252 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_O2monitor); |
1253 GFX_write_string(&FontT42,tXc1,text,0); | |
1254 | |
1255 for(int i=0;i<3;i++) | |
1256 { | |
1257 textpointer = 0; | |
1258 text[textpointer++] = '\030'; | |
1259 if(i==1) | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1260 text[textpointer++] = '\001'; /* center */ |
38 | 1261 else if(i==2) |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1262 text[textpointer++] = '\002'; /* right */ |
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1263 |
577
9bb9a52d6ae5
Handle o2 voltage values < 0.5mV as invalid:
Ideenmodellierer
parents:
564
diff
changeset
|
1264 if((stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) || (stateUsed->lifeData.ppO2Sensor_bar[i] == 0.0)) |
38 | 1265 { |
662 | 1266 #ifdef ENABLE_PSCR_MODE |
1267 if((stateUsed->diveSettings.diveMode == DIVEMODE_PSCR) && (showSimPPO2) && (stateUsed->mode == MODE_DIVE)) /* display ppo2 sim in blue letters in case a slot is not used in the ppo2 custom view */ | |
1268 { | |
1269 text[textpointer++] = '\023'; | |
1270 textpointer += snprintf(&text[textpointer],TEXTSIZE,"%.2f",stateUsed->lifeData.ppo2Simulated_bar); | |
1271 showSimPPO2 = 0; | |
1272 } | |
1273 else | |
1274 #endif | |
1275 { | |
1276 text[textpointer++] = '\031'; | |
1277 text[textpointer++] = ' '; | |
1278 text[textpointer++] = '-'; | |
1279 text[textpointer++] = ' '; | |
1280 text[textpointer++] = 0; | |
1281 } | |
38 | 1282 } |
1283 else | |
1284 { | |
1285 if(stateUsed->warnings.sensorOutOfBounds[i]) | |
1286 text[textpointer++] = '\025'; | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1287 textpointer += snprintf(&text[textpointer],TEXTSIZE,"%.2f",stateUsed->lifeData.ppO2Sensor_bar[i]); |
38 | 1288 } |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1289 GFX_write_string(&FontT105,tXc1,text,0); |
656 | 1290 |
828 | 1291 if((pSettings->co2_sensor_active) && isLoopMode(pSettings->dive_mode)) |
1292 { | |
1293 snprintf(text,TEXTSIZE,"\032\001\f%c",TXT_CO2Sensor); | |
1294 GFX_write_string(&FontT42,tXc1,text,0); | |
1295 textpointer = 0; | |
1296 if(stateUsed->lifeData.CO2_data.CO2_ppm < CO2_WARNING_LEVEL_PPM) | |
1297 { | |
1298 text[textpointer++] = '\020'; | |
1299 } | |
1300 else if(stateUsed->lifeData.CO2_data.CO2_ppm < CO2_ALARM_LEVEL_PPM) | |
1301 { | |
1302 text[textpointer++] = '\024'; /* yellow */ | |
1303 } | |
1304 else | |
1305 { | |
1306 text[textpointer++] = '\025'; /* red */ | |
1307 } | |
1308 snprintf(&text[textpointer],TEXTSIZE,"\001%5ld",stateUsed->lifeData.CO2_data.CO2_ppm); | |
1309 GFX_write_string(&FontT105,tXc1,text,1); | |
1310 } | |
656 | 1311 |
662 | 1312 if((pSettings->scrubTimerMode != SCRUB_TIMER_OFF) && isLoopMode(pSettings->dive_mode)) |
656 | 1313 { |
1314 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_ScrubTime); | |
1315 GFX_write_string(&FontT42,tXc1,text,0); | |
1316 | |
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1317 textpointer = 0; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1318 text[textpointer++] = '\002'; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1319 textpointer += printScrubberText(&text[textpointer], 10, pSettings); |
656 | 1320 GFX_write_string(&FontT105,tXc1,text,1); |
1321 } | |
38 | 1322 } |
1323 break; | |
1324 | |
1325 case CVIEW_T3_MaxDepth: | |
1326 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
413 | 1327 if(pSettings->FlipDisplay) |
1328 { | |
1329 if(mode == DIVEMODE_Apnea) | |
1330 { | |
1331 GFX_write_string(&FontT42,tXc2,text,0); | |
1332 } | |
1333 else | |
1334 { | |
1335 GFX_write_string(&FontT42,tXc1,text,0); | |
1336 } | |
1337 } | |
1338 else | |
1339 { | |
1340 GFX_write_string(&FontT42,tXc1,text,0); | |
1341 } | |
38 | 1342 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); |
1343 t3_basics_colorscheme_mod(text); | |
413 | 1344 if(pSettings->FlipDisplay) |
1345 { | |
1346 if(mode == DIVEMODE_Apnea) | |
1347 { | |
1348 GFX_write_string(&FontT105,tXc2,text,0); | |
1349 } | |
1350 else | |
1351 { | |
1352 GFX_write_string(&FontT105,tXc1,text,0); | |
1353 } | |
1354 } | |
1355 else | |
1356 { | |
496 | 1357 GFX_write_string(&FontT105,tXc1,text,0); |
413 | 1358 } |
38 | 1359 break; |
1360 | |
1361 case CVIEW_T3_TTS: | |
1362 snprintf(text,TEXTSIZE,"\032\f%c",TXT_TTS); | |
1363 GFX_write_string(&FontT42,tXc1,text,0); | |
1364 if(pDecoinfo->output_time_to_surface_seconds) | |
1365 { | |
1366 if(pDecoinfo->output_time_to_surface_seconds < 1000 * 60) | |
214
51a3aeffc6b3
Bugfix: handle rounding of TTS and future TTS consistently
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1367 snprintf(text,TEXTSIZE,"\020\003\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60); |
38 | 1368 else |
214
51a3aeffc6b3
Bugfix: handle rounding of TTS and future TTS consistently
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1369 snprintf(text,TEXTSIZE,"\020\003\002%ih",(pDecoinfo->output_time_to_surface_seconds + 59)/ 3600); |
38 | 1370 t3_basics_colorscheme_mod(text); |
496 | 1371 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1372 } |
1373 break; | |
1374 | |
1375 case CVIEW_T3_ppO2andGas: | |
1376 snprintf(text,TEXTSIZE,"\032\f%c",TXT_ppO2); | |
1377 GFX_write_string(&FontT42,tXc1,text,0); | |
1378 snprintf(text,TEXTSIZE,"\020\003%01.2f",stateUsed->lifeData.ppO2); | |
1379 t3_basics_colorscheme_mod(text); | |
496 | 1380 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1381 |
1382 textpointer = 0; | |
1383 text[textpointer++] = '\020'; | |
1384 text[textpointer++] = '\003'; | |
1385 oxygen_percentage = 100; | |
1386 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage; | |
1387 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage; | |
1388 text[textpointer++] = '\002'; | |
1389 tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&text[textpointer]); | |
1390 //textpointer = snprintf(&text[textpointer],TEXTSIZE,"\020\002%02u/%02u",oxygen_percentage, stateUsed->lifeData.actualGas.helium_percentage); | |
1391 t3_basics_colorscheme_mod(text); | |
496 | 1392 GFX_write_string(&FontT48,tXc1,text,0); |
38 | 1393 break; |
496 | 1394 |
1395 case CVIEW_T3_Navigation: | |
1396 Stopwatch.Total = timer_Stopwatch_GetTime(); | |
1397 Stopwatch.Minutes = Stopwatch.Total / 60; | |
1398 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
1399 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
1400 | |
1401 if(!pSettings->FlipDisplay) | |
1402 { | |
1403 tXc2->WindowX0 = 550; | |
1404 } | |
1405 else | |
1406 { | |
1407 tXc2->WindowX1 = 800; | |
1408 tXc2->WindowY0 = t3c2.WindowY0; /* select customer window */ | |
1409 } | |
1410 | |
1411 snprintf(text,TEXTSIZE,"\032\002\f%c", TXT_Stopwatch); | |
511 | 1412 GFX_write_string(&FontT42,tXc1,text,0); |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1413 snprintf(text,TEXTSIZE,"\030\002\016%01.1f",unit_depth_float(fAverageDepth)); |
511 | 1414 GFX_write_string(&FontT105,tXc1,text,0); |
496 | 1415 if(!pSettings->FlipDisplay) |
1416 { | |
1417 tXc2->WindowY0 = 100; | |
1418 } | |
1419 else | |
1420 { | |
1421 tXc2->WindowY1 -= 100; /* jump to upper of two lines */ | |
1422 } | |
1423 | |
1424 snprintf(text,TEXTSIZE,"\030\002%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); | |
511 | 1425 GFX_write_string(&FontT105,tXc1,text,1); |
496 | 1426 |
1427 | |
1428 center.x = 400; | |
1429 center.y = 116; | |
1430 | |
1431 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); | |
1432 GFX_write_string(&FontT42,tXc1,text,0); | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1433 snprintf(text,100,"\030%03i`",heading); |
496 | 1434 GFX_write_string(&FontT144,tXc1,text,0); |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1435 t3_basics_compass(tXscreen, center, heading, stateUsed->diveSettings.compassHeading); |
496 | 1436 |
1437 break; | |
1438 | |
1439 case CVIEW_T3_DepthData: | |
1440 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
1441 if(pSettings->FlipDisplay) | |
1442 { | |
1443 if(mode == DIVEMODE_Apnea) | |
1444 { | |
1445 GFX_write_string(&FontT42,tXc2,text,0); | |
1446 } | |
1447 else | |
1448 { | |
1449 GFX_write_string(&FontT42,tXc1,text,0); | |
1450 } | |
1451 } | |
1452 else | |
1453 { | |
1454 GFX_write_string(&FontT42,tXc1,text,0); | |
1455 } | |
1456 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
1457 t3_basics_colorscheme_mod(text); | |
1458 if(pSettings->FlipDisplay) | |
1459 { | |
1460 if(mode == DIVEMODE_Apnea) | |
1461 { | |
1462 GFX_write_string(&FontT105,tXc2,text,0); | |
1463 } | |
1464 else | |
1465 { | |
1466 GFX_write_string(&FontT105,tXc1,text,0); | |
1467 } | |
1468 } | |
1469 else | |
1470 { | |
1471 GFX_write_string(&FontT105,tXc1,text,0); | |
1472 } | |
1473 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
1474 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_AvgDepth); | |
511 | 1475 GFX_write_string(&FontT42,tXc1,text,0); |
496 | 1476 |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1477 snprintf(text,TEXTSIZE,"\020\003\002\016\%01.1f",unit_depth_float(fAverageDepthAbsolute)); |
511 | 1478 GFX_write_string(&FontT105,tXc1,text,0); |
496 | 1479 break; |
38 | 1480 } |
496 | 1481 |
1482 | |
1483 | |
38 | 1484 tXc1->WindowX0 = tempWinX0; |
1485 tXc1->WindowY0 = tempWinY0; | |
496 | 1486 tXc1->WindowX1 = tempWinX1; |
1487 tXc1->WindowY1 = tempWinY1; | |
413 | 1488 |
38 | 1489 tXc2->WindowX0 = tempWinC2X0; |
413 | 1490 tXc2->WindowY0 = tempWinC2Y0; |
1491 tXc2->WindowX1 = tempWinC2X1; | |
1492 tXc2->WindowY1 = tempWinC2Y1; | |
38 | 1493 tXc2->WindowTab = tempWinC2Tab; |
1494 } | |
1495 | |
1496 | |
1497 uint8_t t3_test_customview_warnings(void) | |
1498 { | |
1499 uint8_t count = 0; | |
1500 | |
1501 count = 0; | |
1502 count += stateUsed->warnings.decoMissed; | |
1503 count += stateUsed->warnings.ppO2Low; | |
1504 count += stateUsed->warnings.ppO2High; | |
1505 //count += stateUsed->warnings.lowBattery; | |
1506 count += stateUsed->warnings.sensorLinkLost; | |
1507 count += stateUsed->warnings.fallback; | |
1508 | |
1509 return count; | |
1510 } | |
1511 | |
1512 //void t3_show_customview_warnings(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode) | |
1513 void t3_basics_show_customview_warnings(GFX_DrawCfgWindow* tXc1) | |
1514 { | |
1515 char text[256], textMain[256]; | |
1516 uint8_t textpointer, textpointerMain, lineFree, more; | |
1517 | |
1518 snprintf(text,TEXTSIZE,"\025\f%c",TXT_Warning); | |
1519 GFX_write_string(&FontT42,&t3c1,text,0); | |
1520 | |
1521 lineFree = 1; | |
1522 more = 0; | |
1523 | |
1524 textpointerMain = 0; | |
511 | 1525 textMain[textpointerMain++] = '\025'; /* red */ |
1526 textMain[textpointerMain++] = '\003'; /* doublesize */ | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1527 textMain[textpointerMain++] = TXT_2BYTE; /* There is only one Main warning to be displayed */ |
38 | 1528 |
1529 textpointer = 0; | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1530 text[textpointer++] = '\025'; /* red */ |
38 | 1531 |
1532 if(stateUsed->warnings.decoMissed) | |
1533 { | |
1534 if(lineFree) | |
1535 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1536 textMain[textpointerMain++] = TXT2BYTE_WarnDecoMissed; |
38 | 1537 lineFree--; |
1538 } | |
1539 else | |
1540 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1541 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1542 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1543 text[textpointer++] = TXT2BYTE_WarnDecoMissed; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1544 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1545 text[textpointer++] = '\n'; |
38 | 1546 more++; |
1547 } | |
1548 } | |
1549 | |
1550 if(stateUsed->warnings.ppO2Low) | |
1551 { | |
1552 if(lineFree) | |
1553 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1554 textMain[textpointerMain++] = TXT2BYTE_WarnPPO2Low; |
38 | 1555 lineFree--; |
1556 } | |
1557 else | |
1558 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1559 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1560 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1561 text[textpointer++] = TXT2BYTE_WarnPPO2Low; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1562 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1563 text[textpointer++] = '\n'; |
38 | 1564 more++; |
1565 } | |
1566 } | |
1567 | |
1568 if(stateUsed->warnings.ppO2High) | |
1569 { | |
1570 if(lineFree) | |
1571 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1572 textMain[textpointerMain++] = TXT2BYTE_WarnPPO2High; |
38 | 1573 lineFree--; |
1574 } | |
1575 else | |
1576 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1577 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1578 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1579 text[textpointer++] = TXT2BYTE_WarnPPO2High; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1580 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1581 text[textpointer++] = '\n'; |
38 | 1582 more++; |
1583 } | |
1584 } | |
1585 | |
1586 if(stateUsed->warnings.fallback) | |
1587 { | |
1588 if(lineFree) | |
1589 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1590 textMain[textpointerMain++] = TXT2BYTE_WarnFallback; |
38 | 1591 lineFree--; |
1592 } | |
1593 else | |
1594 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1595 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1596 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1597 text[textpointer++] = TXT2BYTE_WarnFallback; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1598 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1599 text[textpointer++] = '\n'; |
38 | 1600 more++; |
1601 } | |
1602 } | |
1603 | |
1604 if(stateUsed->warnings.sensorLinkLost) | |
1605 { | |
1606 if(lineFree) | |
1607 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1608 textMain[textpointerMain++] = TXT2BYTE_WarnSensorLinkLost; |
38 | 1609 lineFree--; |
1610 } | |
1611 else | |
1612 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1613 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1614 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1615 text[textpointer++] = TXT2BYTE_WarnSensorLinkLost; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1616 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1617 text[textpointer++] = '\n'; |
38 | 1618 more++; |
1619 } | |
1620 } | |
1621 | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1622 if(stateUsed->warnings.co2High) |
38 | 1623 { |
1624 if(lineFree) | |
1625 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1626 textMain[textpointerMain++] = TXT2BYTE_WarnCO2High; |
38 | 1627 } |
1628 else | |
1629 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1630 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1631 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1632 text[textpointer++] = TXT2BYTE_WarnCO2High; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1633 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1634 text[textpointer++] = '\n'; |
38 | 1635 more++; |
1636 } | |
1637 } | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1638 |
38 | 1639 text[textpointer] = 0; |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1640 textMain[textpointerMain] = 0; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1641 |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1642 if(lineFree == 0) |
38 | 1643 { |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1644 GFX_write_string(&FontT48,&t3c1,textMain,0); |
38 | 1645 } |
1646 if(more) | |
1647 { | |
511 | 1648 GFX_write_string(&FontT48,&t3c2,text,0); |
38 | 1649 } |
1650 } | |
1651 | |
496 | 1652 uint8_t t3_customview_disabled(uint8_t view) |
1653 { | |
1654 uint8_t i = 0; | |
1655 uint8_t cv_disabled = 0; | |
1656 const uint8_t *pcv_changelist; | |
1657 uint32_t cv_config = settingsGetPointer()->cv_config_BigScreen; | |
1658 | |
511 | 1659 pcv_changelist = cv_changelist_BS; |
496 | 1660 |
1661 while(pcv_changelist[i] != CVIEW_T3_END) | |
1662 { | |
1663 if((view == pcv_changelist[i]) && !CHECK_BIT_THOME(cv_config, pcv_changelist[i])) | |
1664 { | |
1665 cv_disabled = 1; | |
1666 break; | |
1667 } | |
1668 i++; | |
1669 } | |
1670 | |
837 | 1671 if ((view == CVIEW_T3_sensors) && |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
1672 ((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0) || stateUsed->warnings.fallback)) |
496 | 1673 { |
1674 cv_disabled = 1; | |
1675 } | |
1676 | |
1677 return cv_disabled; | |
1678 } | |
38 | 1679 |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
1680 uint8_t t3_change_customview(uint8_t action) |
38 | 1681 { |
511 | 1682 |
837 | 1683 t3_basics_change_customview(&t3_selection_customview, cv_changelist_BS, action); |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
1684 return t3_selection_customview; |
38 | 1685 } |
1686 | |
1687 | |
511 | 1688 void t3_basics_change_customview(uint8_t *tX_selection_customview,const uint8_t *tX_customviews, uint8_t action) |
38 | 1689 { |
511 | 1690 uint8_t curViewIdx = 0xff; |
1691 uint8_t index = 0; | |
599 | 1692 uint8_t indexOverrun = 0; |
511 | 1693 uint8_t lastViewIdx = 0; |
599 | 1694 uint8_t iterate = 0; /* set to 1 if a view has to be skipped */ |
1695 uint8_t useFallback = 0; /* is set if the current view is disabled */ | |
1696 uint8_t fallbackSelection = CVIEW_noneOrDebug; /* show "None" view per default */ | |
38 | 1697 |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1698 /* set pointer to currently selected view and count number of entries */ |
511 | 1699 while((tX_customviews[index] != CVIEW_T3_END)) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1700 { |
511 | 1701 if (tX_customviews[index] == *tX_selection_customview) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1702 { |
511 | 1703 curViewIdx = index; |
837 | 1704 break; |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1705 } |
511 | 1706 index++; |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1707 } |
511 | 1708 if(curViewIdx == 0xff) /* called with unknown view */ |
496 | 1709 { |
511 | 1710 curViewIdx = 0; |
599 | 1711 *tX_selection_customview = CVIEW_noneOrDebug; /* show "None" view per default */ |
496 | 1712 } |
511 | 1713 lastViewIdx = index; |
1714 index = curViewIdx; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1715 do |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1716 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1717 iterate = 0; |
496 | 1718 switch(action) |
1719 { | |
1720 case ACTION_BUTTON_ENTER: | |
1721 case ACTION_PITCH_POS: | |
1722 | |
511 | 1723 if(tX_customviews[index] != CVIEW_T3_END) |
496 | 1724 { |
511 | 1725 index++; |
1726 } | |
1727 if(tX_customviews[index] == CVIEW_T3_END) | |
1728 { | |
1729 index = 0; | |
599 | 1730 indexOverrun = 1; |
496 | 1731 } |
1732 break; | |
1733 case ACTION_PITCH_NEG: | |
511 | 1734 if(index == 0) |
496 | 1735 { |
511 | 1736 index = lastViewIdx - 1; |
599 | 1737 indexOverrun = 1; |
496 | 1738 } |
1739 else | |
1740 { | |
511 | 1741 index--; |
496 | 1742 } |
1743 break; | |
1744 default: | |
1745 break; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1746 } |
496 | 1747 |
837 | 1748 if((tX_customviews == cv_changelist_BS) && (t3_customview_disabled(tX_customviews[index]))) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1749 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1750 iterate = 1; |
599 | 1751 if(*tX_selection_customview == tX_customviews[index]) |
1752 { | |
1753 useFallback = 1; /* the provided view is disabled => use fallback */ | |
1754 } | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1755 } |
599 | 1756 else /* special case which are enabled but not to be displayed at the moment */ |
1757 { | |
1758 if(settingsGetPointer()->MotionDetection != MOTION_DETECT_SECTOR) /* no hiding in case of active sector view option (fixed mapping would change during dive) */ | |
1759 { | |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
758
diff
changeset
|
1760 const SDecoinfo * pDecoinfo = getDecoInfo(); |
601 | 1761 /* Skip TTS if value is 0 */ |
1762 if((tX_customviews[index] == CVIEW_T3_TTS) && (!pDecoinfo->output_time_to_surface_seconds)) | |
599 | 1763 { |
601 | 1764 if(*tX_selection_customview == tX_customviews[index]) |
1765 { | |
1766 useFallback = 1; /* the provided view is disabled => use fallback */ | |
1767 } | |
599 | 1768 iterate = 1; |
601 | 1769 if(fallbackSelection == CVIEW_noneOrDebug) |
1770 { | |
1771 fallbackSelection = CVIEW_T3_TTS; | |
1772 } | |
599 | 1773 } |
601 | 1774 /* Skip Deco if NDL is not set */ |
1775 if((tX_customviews[index] == CVIEW_T3_Decostop) && ((!pDecoinfo->output_ndl_seconds) && (!pDecoinfo->output_time_to_surface_seconds) && (timer_Safetystop_GetCountDown() == 0))) | |
599 | 1776 { |
601 | 1777 if(*tX_selection_customview == tX_customviews[index]) |
1778 { | |
1779 useFallback = 1; /* the provided view is disabled => use fallback */ | |
1780 } | |
1781 fallbackSelection = CVIEW_T3_Decostop; | |
599 | 1782 iterate = 1; |
1783 } | |
1784 } | |
1785 } | |
1786 if((iterate) && (action == ACTION_END)) /* ACTION_END is used to check the enable state of the provided view. If it is enable the function will return without change */ | |
496 | 1787 { |
1788 action = ACTION_BUTTON_ENTER; | |
1789 } | |
599 | 1790 }while ((iterate == 1) && (!((indexOverrun == 1) && (*tX_selection_customview == tX_customviews[index])))); /* no other available view found => use fallback */ |
38 | 1791 |
599 | 1792 if(*tX_selection_customview == tX_customviews[index]) |
1793 { | |
1794 if(useFallback) | |
1795 { | |
1796 *tX_selection_customview = fallbackSelection; /* no active view found => keep actual view or change to fallback if actual view is deactivated */ | |
1797 } | |
1798 } | |
1799 else | |
1800 { | |
1801 *tX_selection_customview = tX_customviews[index]; | |
1802 } | |
38 | 1803 } |
1804 | |
1805 | |
1806 void t3_basics_colorscheme_mod(char *text) | |
1807 { | |
1808 if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard()) | |
1809 { | |
1810 text[0] = '\027'; | |
1811 } | |
1812 } | |
1813 | |
1814 | |
496 | 1815 point_t t3_compass_circle(uint8_t id, uint16_t degree, point_t center) |
38 | 1816 { |
1817 float fCos, fSin; | |
1818 const float piMult = ((2 * 3.14159) / 360); | |
1819 // const int radius[4] = {95,105,115,60}; | |
1820 const int radius[4] = {85,95,105,90}; | |
496 | 1821 static point_t forcenter = {.x = 900, .y = 500}; /* used to identify change of circle position */ |
38 | 1822 static point_t r[4][360] = { 0 }; |
1823 | |
496 | 1824 if((r[0][0].y == 0) || (forcenter.x != center.x) || (forcenter.y != center.y)) /* calculate values only once during first call or if center position changed */ |
38 | 1825 { |
1826 for(int i=0;i<360;i++) | |
1827 { | |
1828 fCos = cos(i * piMult); | |
1829 fSin = sin(i * piMult); | |
1830 for(int j=0;j<4;j++) | |
1831 { | |
496 | 1832 r[j][i].x = center.x + (int)(fSin * radius[j]); |
1833 r[j][i].y = center.y + (int)(fCos * radius[j]); | |
38 | 1834 } |
1835 } | |
496 | 1836 forcenter.x = center.x; |
1837 forcenter.y = center.y; | |
38 | 1838 } |
1839 if(id > 3) id = 0; | |
1840 if(degree > 359) degree = 0; | |
1841 return r[id][degree]; | |
1842 } | |
1843 | |
1844 | |
496 | 1845 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, point_t center, uint16_t ActualHeading, uint16_t UserSetHeading) |
38 | 1846 { |
496 | 1847 uint8_t loop = 0; |
38 | 1848 uint16_t LineHeading; |
496 | 1849 |
38 | 1850 static int32_t LastHeading = 0; |
1851 int32_t newHeading = 0; | |
1852 int32_t diff = 0; | |
1853 int32_t diff2 = 0; | |
1854 | |
1855 int32_t diffAbs = 0; | |
1856 int32_t diffAbs2 = 0; | |
1857 | |
1858 newHeading = ActualHeading; | |
1859 | |
1860 diff = newHeading - LastHeading; | |
1861 | |
1862 if(newHeading < LastHeading) | |
1863 diff2 = newHeading + 360 - LastHeading; | |
1864 else | |
1865 diff2 = newHeading - 360 - LastHeading; | |
1866 | |
1867 diffAbs = diff; | |
1868 if(diffAbs < 0) | |
1869 diffAbs *= -1; | |
1870 | |
1871 diffAbs2 = diff2; | |
1872 if(diffAbs2 < 0) | |
1873 diffAbs2 *= -1; | |
1874 | |
1875 if(diffAbs <= diffAbs2) | |
1876 newHeading = LastHeading + (diff / 2); | |
1877 else | |
1878 newHeading = LastHeading + (diff2 / 2); | |
1879 | |
1880 if(newHeading < 0) | |
1881 newHeading += 360; | |
1882 else | |
1883 if(newHeading >= 360) | |
1884 newHeading -= 360; | |
1885 | |
1886 LastHeading = newHeading; | |
1887 ActualHeading = newHeading; | |
1888 | |
1889 if (ActualHeading < 90) | |
1890 ActualHeading += 360; | |
1891 | |
1892 while(ActualHeading > 359) ActualHeading -= 360; | |
1893 | |
1894 LineHeading = 360 - ActualHeading; | |
496 | 1895 |
1896 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font030); // North | |
38 | 1897 LineHeading += 90; |
496 | 1898 |
1899 for (loop = 0; loop < 3; loop++) | |
1900 { | |
1901 if(LineHeading > 359) LineHeading -= 360; | |
1902 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Main Ticks | |
1903 LineHeading += 90; | |
1904 } | |
38 | 1905 |
1906 LineHeading = 360 - ActualHeading; | |
1907 LineHeading += 45; | |
496 | 1908 |
1909 for (loop = 0; loop < 4; loop++) | |
1910 { | |
1911 if(LineHeading > 359) LineHeading -= 360; | |
1912 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Subtick | |
1913 LineHeading += 90; | |
1914 } | |
38 | 1915 |
1916 LineHeading = 360 - ActualHeading; | |
1917 LineHeading += 22; | |
496 | 1918 for (loop = 0; loop < 8; loop++) |
1919 { | |
1920 if(LineHeading > 359) LineHeading -= 360; | |
1921 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Subtick | |
1922 LineHeading += 45; | |
1923 } | |
38 | 1924 if(UserSetHeading) |
1925 { | |
1926 LineHeading = UserSetHeading + 360 - ActualHeading; | |
1927 if(LineHeading > 359) LineHeading -= 360; | |
496 | 1928 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_CompassUserHeadingTick); |
38 | 1929 |
1930 // R�ckpeilung, User Back Heading | |
1931 LineHeading = UserSetHeading + 360 + 180 - ActualHeading; | |
1932 if(LineHeading > 359) LineHeading -= 360; | |
1933 if(LineHeading > 359) LineHeading -= 360; | |
496 | 1934 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_CompassUserBackHeadingTick); |
38 | 1935 } |
1936 | |
1937 GFX_draw_circle(tXscreen, center, 106, CLUT_Font030); | |
1938 GFX_draw_circle(tXscreen, center, 107, CLUT_Font030); | |
1939 GFX_draw_circle(tXscreen, center, 108, CLUT_Font030); | |
1940 } | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1941 |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1942 uint8_t t3_GetEnabled_customviews() |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1943 { |
496 | 1944 uint8_t *pViews; |
1945 uint8_t increment = 1; | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1946 uint8_t enabledViewCnt = 0; |
496 | 1947 |
837 | 1948 pViews = (uint8_t*)cv_changelist_BS; |
496 | 1949 while((*pViews != CVIEW_T3_END)) |
1950 { | |
1951 increment = 1; | |
1952 /* check if view is enabled */ | |
1953 if(t3_customview_disabled(*pViews)) | |
1954 { | |
1955 increment = 0; | |
1956 } | |
1957 pViews++; | |
1958 enabledViewCnt += increment; | |
1959 } | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1960 return enabledViewCnt; |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1961 } |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1962 |
518 | 1963 uint8_t t3_getCustomView(void) |
1964 { | |
1965 return t3_selection_customview; | |
1966 } | |
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1967 |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1968 int printScrubberText(char *text, size_t size, SSettings *settings) |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1969 { |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1970 int16_t currentTimerMinutes = settings->scrubberData[settings->scubberActiveId].TimerCur; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1971 char colour = '\020'; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1972 if (currentTimerMinutes <= 0) { |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1973 colour = '\025'; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1974 } else if (currentTimerMinutes <= 30) { |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1975 colour = '\024'; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1976 } |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1977 |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1978 if (settings->scrubTimerMode == SCRUB_TIMER_MINUTES || currentTimerMinutes < 0) { |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1979 return snprintf(text, size, "%c%3i'", colour, currentTimerMinutes); |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1980 } else { |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1981 return snprintf(text, size, "%c%u\016\016%%\017", colour, currentTimerMinutes * 100 / settingsGetPointer()->scrubberData[settings->scubberActiveId].TimerMax); |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1982 } |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1983 } |
838 | 1984 |
841 | 1985 void t3_AF_updateBorderConditions() |
1986 { | |
1987 uint16_t nextstopLengthSeconds = 0; | |
1988 uint8_t nextstopDepthMeter = 0; | |
1989 | |
1990 tHome_findNextStop(getDecoInfo()->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
1991 AF_lastDecoDepth = nextstopDepthMeter; | |
1992 AF_lastTTS = (getDecoInfo()->output_time_to_surface_seconds / 60) / 10; | |
1993 } | |
1994 | |
1995 uint8_t t3_CheckAfCondition(uint8_t T3CView) | |
838 | 1996 { |
841 | 1997 uint8_t retVal = 0; |
1998 | |
1999 float pitch = stateRealGetPointer()->lifeData.compass_pitch; | |
2000 float roll = stateRealGetPointer()->lifeData.compass_roll; | |
2001 | |
2002 uint16_t nextstopLengthSeconds = 0; | |
2003 uint8_t nextstopDepthMeter = 0; | |
2004 | |
2005 switch (T3CView) | |
2006 { | |
2007 case CVIEW_T3_GasList: retVal = (stateUsed->warnings.betterGas) /* switch if better gas is available or depending on ppo2 if in OC mode */ | |
2008 || ((stateUsed->diveSettings.diveMode == DIVEMODE_OC) && ((stateUsed->warnings.ppO2Low) || (stateUsed->warnings.ppO2High))); | |
2009 | |
2010 break; | |
2011 case CVIEW_T3_Navigation: retVal = (pitch > -AF_COMPASS_ACTIVATION_ANGLE) && (pitch < AF_COMPASS_ACTIVATION_ANGLE) | |
2012 && (roll > -AF_COMPASS_ACTIVATION_ANGLE) && (roll < AF_COMPASS_ACTIVATION_ANGLE); | |
2013 | |
2014 break; | |
2015 case CVIEW_T3_DecoTTS: tHome_findNextStop(getDecoInfo()->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
2016 /* A new deco step is added to the plan */ | |
2017 if(nextstopDepthMeter > AF_lastDecoDepth) | |
2018 { | |
2019 retVal = 1; | |
2020 } | |
838 | 2021 |
841 | 2022 /* Close to the next deco step or missed deco step */ |
2023 if((abs(stateUsed->lifeData.depth_meter - nextstopDepthMeter) < 2) || (stateUsed->warnings.decoMissed)) | |
2024 { | |
2025 retVal = 1; | |
2026 } | |
2027 /* Another 10 minutes to surface */ | |
2028 if((getDecoInfo()->output_time_to_surface_seconds) && ((uint16_t)((getDecoInfo()->output_time_to_surface_seconds / 60) / 10) > AF_lastTTS)) | |
2029 { | |
2030 retVal = 1; | |
2031 } | |
2032 break; | |
2033 default: break; | |
2034 } | |
2035 | |
2036 return retVal; | |
2037 } | |
2038 | |
2039 uint8_t t3_EvaluateAFCondition(uint8_t T3CView) | |
2040 { | |
2041 static uint8_t debounce[CVIEW_T3_END]; | |
2042 static uint8_t lastState[CVIEW_T3_END]; | |
2043 uint8_t detectionState = AF_VIEW_NOCHANGE; | |
2044 uint8_t cnt = 0; | |
2045 | |
2046 if(T3CView <= CVIEW_T3_END) | |
838 | 2047 { |
841 | 2048 if(T3CView == CVIEW_T3_END) |
838 | 2049 { |
841 | 2050 for(cnt = 0; cnt < CVIEW_T3_END; cnt++) |
2051 { | |
2052 debounce[cnt] = 0; | |
2053 lastState[cnt] = AF_VIEW_NOCHANGE; | |
2054 } | |
2055 } | |
2056 if(t3_CheckAfCondition(T3CView)) | |
2057 { | |
2058 if(debounce[T3CView] < 10) | |
2059 { | |
2060 debounce[T3CView]++; | |
2061 } | |
2062 else | |
2063 { | |
2064 detectionState = AF_VIEW_ACTIVATED; | |
2065 } | |
838 | 2066 } |
2067 else | |
2068 { | |
841 | 2069 if(debounce[T3CView] > 0) |
2070 { | |
2071 debounce[T3CView]--; | |
2072 } | |
2073 else | |
2074 { | |
2075 detectionState = AF_VIEW_DEACTIVATED; | |
2076 } | |
2077 } | |
2078 if(detectionState) /* no state change => return 0 */ | |
2079 { | |
2080 if((detectionState == lastState[T3CView])) | |
2081 { | |
2082 detectionState = AF_VIEW_NOCHANGE; | |
2083 } | |
2084 else | |
2085 { | |
2086 lastState[T3CView] = detectionState; | |
2087 } | |
838 | 2088 } |
2089 } | |
2090 return detectionState; | |
2091 } | |
2092 | |
835 | 2093 void t3_handleAutofocus(void) |
2094 { | |
2095 static uint8_t returnView = CVIEW_T3_END; | |
2096 | |
841 | 2097 uint8_t runningT3CView = 0; |
835 | 2098 |
841 | 2099 for (runningT3CView = 0; runningT3CView < CVIEW_T3_END; runningT3CView++) |
838 | 2100 { |
841 | 2101 if(stateUsed->diveSettings.activeAFViews & (1 << runningT3CView)) |
838 | 2102 { |
841 | 2103 switch(t3_EvaluateAFCondition(runningT3CView)) |
2104 { | |
2105 case AF_VIEW_ACTIVATED: returnView = t3_selection_customview; | |
2106 t3_select_customview(runningT3CView); | |
2107 t3_AF_updateBorderConditions(); | |
2108 break; | |
2109 case AF_VIEW_DEACTIVATED: if((returnView != CVIEW_T3_END) && (t3_selection_customview == runningT3CView)) | |
2110 { | |
2111 if(runningT3CView != CVIEW_T3_DecoTTS) /* some view does not switch back */ | |
2112 { | |
2113 t3_select_customview(returnView); | |
2114 } | |
2115 returnView = CVIEW_T3_END; | |
2116 } | |
2117 break; | |
2118 default: | |
2119 break; | |
2120 } | |
838 | 2121 } |
2122 } | |
835 | 2123 } |