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