Mercurial > public > ostc4
annotate Discovery/Src/t3.c @ 956:083afabc6578 Evo_2_23
Bugfix UART sensor MUX channel selection after sleep:
In case only one UART sensor is connected to the MUX, to a channel other than 0 then the sensor operation could fail in case the initial mux address selection was not successfull. To fix this problem the MUX address is selected again in case a timeout occures during sensor setup.
author | Ideenmodellierer |
---|---|
date | Mon, 06 Jan 2025 17:55:34 +0100 |
parents | 4e4fbd73e329 |
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 { | |
954
4e4fbd73e329
Slow exit graph draw normal ascent if slow exit is inactive:
Ideenmodellierer
parents:
951
diff
changeset
|
538 color = 0xff; |
945 | 539 if((pSettings->slowExitTime != 0) && (nextstopDepthMeter == 0) && (stateUsed->lifeData.depth_meter < pSettings->last_stop_depth_meter)) |
540 { | |
541 color = t3_drawSlowExitGraph(tXscreen, tXl1, tXr1); | |
542 } | |
954
4e4fbd73e329
Slow exit graph draw normal ascent if slow exit is inactive:
Ideenmodellierer
parents:
951
diff
changeset
|
543 if(color == 0xff) /* no slow exit => continue with common ascent graph */ |
945 | 544 { |
545 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) /* ascentrate graph -standard mode */ | |
546 { | |
547 if(!pSettings->FlipDisplay) | |
548 { | |
549 start.y = tXl1->WindowY0 - 1; | |
550 } | |
551 else | |
552 { | |
553 start.y = tXl1->WindowY1 + 1; | |
554 } | |
555 | |
556 for(int i = 0; i<4;i++) | |
557 { | |
558 start.y += 5*8; | |
559 stop.y = start.y; | |
560 if(!pSettings->FlipDisplay) | |
561 { | |
562 start.x = tXl1->WindowX1 - 1; | |
563 } | |
564 else | |
565 { | |
566 start.x = tXr1->WindowX1 + 3; | |
567 } | |
568 stop.x = start.x - 17; | |
569 GFX_draw_line(tXscreen, start, stop, 0); | |
570 } | |
571 // new thick bar design Sept. 2015 | |
572 if(!pSettings->FlipDisplay) | |
573 { | |
574 start.x = tXl1->WindowX1 - 3 - 5; | |
575 } | |
576 else | |
577 { | |
578 start.x = tXr1->WindowX1 - 3 - 5; | |
579 } | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
580 |
945 | 581 stop.x = start.x; |
582 if(!pSettings->FlipDisplay) | |
583 { | |
584 start.y = tXl1->WindowY0 - 1; | |
585 } | |
586 else | |
587 { | |
588 start.y = tXl1->WindowY1 + 1; | |
589 } | |
590 | |
591 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 8); | |
592 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9 | |
593 if(stop.y >= 470) | |
594 stop.y = 470; | |
595 start.y += 7; // starte etwas weiter oben | |
596 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 10) | |
597 color = CLUT_EverythingOkayGreen; | |
598 else | |
599 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 15) | |
600 color = CLUT_WarningYellow; | |
601 else | |
602 color = CLUT_WarningRed; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
603 |
945 | 604 GFX_draw_thick_line(12,tXscreen, start, stop, color); |
605 } | |
606 color = drawingColor_from_ascentspeed(stateUsed->lifeData.ascent_rate_meter_per_min); | |
607 } | |
608 } | |
609 /* depth */ | |
610 float depth = unit_depth_float(stateUsed->lifeData.depth_meter); | |
611 | |
612 if(depth <= 0.3f) | |
613 depth = 0; | |
614 | |
615 if(settingsGetPointer()->nonMetricalSystem) | |
616 snprintf(text,TEXTSIZE,"\032\f[feet]"); | |
617 else | |
618 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Depth); | |
619 GFX_write_string(&FontT42,tXl1,text,0); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
620 |
945 | 621 if( ((mode == DIVEMODE_Apnea) && ((stateUsed->lifeData.ascent_rate_meter_per_min > 4) || (stateUsed->lifeData.ascent_rate_meter_per_min < -4 ))) |
622 || ((mode != DIVEMODE_Apnea) && ((stateUsed->lifeData.ascent_rate_meter_per_min > 8) || (stateUsed->lifeData.ascent_rate_meter_per_min < -10))) | |
623 ) | |
624 { | |
625 snprintf(text,TEXTSIZE,"\f\002%.0f %c%c/min " | |
626 , unit_depth_float(stateUsed->lifeData.ascent_rate_meter_per_min) | |
627 , unit_depth_char1() | |
628 , unit_depth_char2() | |
629 ); | |
630 GFX_write_string(&FontT42,tXl1,text,0); | |
631 } | |
38 | 632 |
945 | 633 if( depth < 100) |
634 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",depth); | |
635 else | |
636 snprintf(text,TEXTSIZE,"\020\003\016%01.0f",depth); | |
637 | |
638 Gfx_colorsscheme_mod(text,color); | |
639 GFX_write_string(&FontT105,tXl1,text,1); | |
640 | |
38 | 641 |
642 // divetime | |
643 if(mode == DIVEMODE_Apnea) | |
644 { | |
645 if(stateUsed->lifeData.counterSecondsShallowDepth) | |
646 { | |
647 SDivetime SurfaceBreakTime = {0,0,0,0}; | |
648 | |
649 SurfaceBreakTime.Total = stateUsed->lifeData.counterSecondsShallowDepth; | |
650 SurfaceBreakTime.Minutes = SurfaceBreakTime.Total / 60; | |
651 SurfaceBreakTime.Seconds = SurfaceBreakTime.Total - (SurfaceBreakTime.Minutes * 60); | |
652 | |
653 snprintf(text,TEXTSIZE,"\032\f\002%c%c", TXT_2BYTE,TXT2BYTE_ApneaSurface); | |
654 GFX_write_string(&FontT42,tXr1,text,0); | |
655 | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
656 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",SurfaceBreakTime.Minutes, SurfaceBreakTime.Seconds); |
38 | 657 } |
658 else | |
659 { | |
660 Divetime.Total = stateUsed->lifeData.dive_time_seconds; | |
661 Divetime.Minutes = Divetime.Total / 60; | |
662 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); | |
663 | |
664 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
665 GFX_write_string(&FontT42,tXr1,text,0); | |
666 | |
667 if(Divetime.Minutes < 100) | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
668 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",Divetime.Minutes, Divetime.Seconds); |
38 | 669 else |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
670 snprintf(text,TEXTSIZE,"\020\003\002\016%u'",Divetime.Minutes); |
38 | 671 } |
868
db92692c014f
Introduce speed dependend coloring of depth:
Ideenmodellierer
parents:
857
diff
changeset
|
672 Gfx_colorsscheme_mod(text,0); |
518 | 673 GFX_write_string(&FontT105,tXr1,text,1); |
38 | 674 } |
675 else | |
676 { | |
518 | 677 switch(get_globalState()) |
678 { | |
739 | 679 case StDMENU: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_DiveMenuQ); |
680 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
681 break; | |
518 | 682 case StDBEAR: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_DiveBearingQ); |
683 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
684 break; | |
685 case StDRAVG: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_DiveResetAvgQ); | |
686 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
687 break; | |
38 | 688 |
518 | 689 case StDMGAS: |
690 textPointer = 0; | |
691 text[textPointer++] = '\a'; | |
692 text[textPointer++] = '\001'; | |
693 text[textPointer++] = ' '; | |
694 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[actualBetterGasId()].oxygen_percentage,stateUsed->diveSettings.gas[actualBetterGasId()].helium_percentage,&text[textPointer]); | |
695 text[textPointer++] = '?'; | |
696 text[textPointer++] = ' '; | |
697 text[textPointer++] = 0; | |
698 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
699 break; | |
613 | 700 |
701 case StDMARK: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_SetMarkerShort); | |
702 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
703 break; | |
704 | |
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
705 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
|
706 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
707 break; |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
708 |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
709 #ifdef ENABLE_T3_PPO_SIM |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
710 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
|
711 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
|
712 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
713 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
|
714 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
|
715 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
716 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
|
717 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
|
718 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
719 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
|
720 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
|
721 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
722 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
|
723 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
|
724 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
725 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
|
726 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
|
727 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
728 #endif |
518 | 729 default: /* show divetime */ |
38 | 730 |
518 | 731 Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; |
732 Divetime.Minutes = Divetime.Total / 60; | |
733 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); | |
734 | |
735 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
736 GFX_write_string(&FontT42,tXr1,text,0); | |
737 | |
738 if(Divetime.Minutes < 100) | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
739 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",Divetime.Minutes, Divetime.Seconds); |
518 | 740 else |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
741 snprintf(text,TEXTSIZE,"\020\003\002\016%u'",Divetime.Minutes); |
518 | 742 |
868
db92692c014f
Introduce speed dependend coloring of depth:
Ideenmodellierer
parents:
857
diff
changeset
|
743 Gfx_colorsscheme_mod(text,0); |
518 | 744 GFX_write_string(&FontT105,tXr1,text,1); |
745 break; | |
746 } | |
38 | 747 } |
748 | |
749 return depth; | |
750 } | |
751 | |
752 | |
753 void t3_refresh_divemode(void) | |
754 { | |
755 uint8_t customview_warnings = 0; | |
756 float depth_meter = 0.0; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
757 |
38 | 758 // everything like lines, depth, ascent graph and divetime |
759 depth_meter = t3_basics_lines_depth_and_divetime(&t3screen, &t3l1, &t3r1, 0); // 0 could be stateUsed->diveSettings.diveMode for CCR specials | |
760 | |
761 // customview | |
762 if(stateUsed->warnings.numWarnings) | |
763 customview_warnings = t3_test_customview_warnings(); | |
764 | |
765 if(customview_warnings && warning_count_high_time) | |
951 | 766 { |
38 | 767 t3_basics_show_customview_warnings(&t3c1); |
951 | 768 } |
38 | 769 else |
951 | 770 { |
38 | 771 t3_refresh_customview(depth_meter); |
951 | 772 requestBuzzerActivation(0); |
773 } | |
38 | 774 if(stateUsed->warnings.lowBattery) |
496 | 775 t3_basics_battery_low_customview_extra(&t3r1); //t3c1); |
38 | 776 } |
777 | |
778 | |
779 void t3_basics_battery_low_customview_extra(GFX_DrawCfgWindow* tXc1) | |
780 { | |
781 char TextC1[256]; | |
782 | |
496 | 783 TextC1[0] = ' ';//'\002'; |
38 | 784 TextC1[1] = '\f'; |
785 TextC1[2] = '\025'; | |
786 TextC1[3] = '3'; | |
787 TextC1[4] = '1'; | |
788 TextC1[5] = '1'; | |
789 TextC1[6] = '1'; | |
790 TextC1[7] = '1'; | |
791 TextC1[8] = '1'; | |
792 TextC1[9] = '1'; | |
793 TextC1[10] = '1'; | |
794 TextC1[11] = '1'; | |
795 TextC1[12] = '1'; | |
796 TextC1[13] = '1'; | |
797 TextC1[14] = '0'; | |
798 TextC1[15] = 0; | |
799 | |
800 if(!warning_count_high_time) | |
801 TextC1[4] = '2'; | |
802 | |
803 GFX_write_string(&Batt24,tXc1,TextC1,0); | |
804 } | |
805 | |
806 | |
807 | |
808 void t3_refresh_customview(float depth) | |
809 { | |
272
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
237
diff
changeset
|
810 t3_basics_refresh_customview(depth, t3_selection_customview, &t3screen, &t3c1, &t3c2, stateUsedWrite->diveSettings.diveMode); |
38 | 811 } |
812 | |
813 | |
814 void t3_basics_refresh_apnoeRight(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) | |
815 { | |
722 | 816 char text[30]; |
38 | 817 uint16_t textpointer = 0; |
818 | |
819 // CVIEW_T3_Temperature | |
820 float temperature; | |
413 | 821 SSettings* pSettings; |
822 pSettings = settingsGetPointer(); | |
38 | 823 |
824 SDivetime TotalDivetime = {0,0,0,0}; | |
825 SDivetime LastDivetime = {0,0,0,0}; | |
826 | |
827 uint16_t tempWinX0; | |
413 | 828 uint16_t tempWinX1; |
38 | 829 uint16_t tempWinY0; |
413 | 830 uint16_t tempWinY1; |
38 | 831 |
832 tempWinX0 = tXc1->WindowX0; | |
413 | 833 tempWinX1 = tXc1->WindowX1; |
38 | 834 tempWinY0 = tXc1->WindowY0; |
413 | 835 tempWinY1 = tXc1->WindowY1; |
38 | 836 |
837 tXc1->WindowX0 = 440; // rechte Seite | |
838 | |
839 switch(tX_selection_customview) | |
840 { | |
841 case CVIEW_T3_Temperature: | |
842 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature); | |
843 GFX_write_string(&FontT42,tXc1,text,0); | |
844 | |
189
8b8074080d7b
Bugfix: average temperature on arrival from RTE instead of display time
Jan Mulder <jlmulder@xs4all.nl>
parents:
174
diff
changeset
|
845 temperature = unit_temperature_float(stateUsed->lifeData.temperature_celsius); |
38 | 846 textpointer = snprintf(text,TEXTSIZE,"\020\003\016%01.0f\016\016\140",temperature); // "\016\016%01.1f `" + C or F |
847 if(settingsGetPointer()->nonMetricalSystem == 0) | |
848 text[textpointer++] = 'C'; | |
849 else | |
850 text[textpointer++] = 'F'; | |
851 text[textpointer++] = 0; | |
868
db92692c014f
Introduce speed dependend coloring of depth:
Ideenmodellierer
parents:
857
diff
changeset
|
852 Gfx_colorsscheme_mod(text,0); |
38 | 853 GFX_write_string(&FontT105,tXc1,text,1); |
854 break; | |
855 | |
856 case CVIEW_T3_ApnoeSurfaceInfo: | |
857 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Divetime); | |
858 GFX_write_string(&FontT42,tXc1,text,0); | |
859 | |
860 TotalDivetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; | |
861 TotalDivetime.Minutes = TotalDivetime.Total / 60; | |
862 TotalDivetime.Seconds = TotalDivetime.Total - ( TotalDivetime.Minutes * 60 ); | |
863 | |
864 LastDivetime.Total = stateUsed->lifeData.apnea_last_dive_time_seconds; | |
865 LastDivetime.Minutes = LastDivetime.Total / 60; | |
866 LastDivetime.Seconds = LastDivetime.Total - ( LastDivetime.Minutes * 60 ); | |
867 | |
413 | 868 // tXc1->WindowY0 = 100; // obere Zeile |
869 if(!pSettings->FlipDisplay) | |
870 { | |
871 tXc1->WindowY0 = 100; | |
872 } | |
873 else | |
874 { | |
875 tXc1->WindowY1 -= 100; /* jump to upper of two lines */ | |
876 } | |
38 | 877 |
878 snprintf(text,TEXTSIZE,"\020\016%u:%02u",LastDivetime.Minutes, LastDivetime.Seconds); | |
868
db92692c014f
Introduce speed dependend coloring of depth:
Ideenmodellierer
parents:
857
diff
changeset
|
879 Gfx_colorsscheme_mod(text,0); |
38 | 880 GFX_write_string(&FontT105,tXc1,text,0); |
881 | |
413 | 882 if(pSettings->FlipDisplay) |
883 { | |
884 tXc1->WindowX0 = 0; | |
885 | |
886 } | |
38 | 887 snprintf(text,TEXTSIZE,"\032\002%c%c",TXT_2BYTE, TXT2BYTE_ApneaLast); |
888 GFX_write_string(&FontT42,tXc1,text,0); | |
889 | |
413 | 890 if(!pSettings->FlipDisplay) |
891 { | |
892 tXc1->WindowY0 = tempWinY0; | |
893 } | |
894 else | |
895 { | |
896 tXc1->WindowX1 = tempWinX1; | |
897 tXc1->WindowY1 = tempWinY1; /* jump to upper of two lines */ | |
898 } | |
38 | 899 |
900 snprintf(text,TEXTSIZE,"\020\016%u:%02u",TotalDivetime.Minutes, TotalDivetime.Seconds); | |
868
db92692c014f
Introduce speed dependend coloring of depth:
Ideenmodellierer
parents:
857
diff
changeset
|
901 Gfx_colorsscheme_mod(text,0); |
38 | 902 GFX_write_string(&FontT105,tXc1,text,0); |
903 | |
904 snprintf(text,TEXTSIZE,"\032\002%c%c",TXT_2BYTE, TXT2BYTE_ApneaTotal); | |
413 | 905 if(pSettings->FlipDisplay) |
906 { | |
907 tXc1->WindowX0 = 0; | |
908 | |
909 } | |
38 | 910 GFX_write_string(&FontT42,tXc1,text,0); |
911 break; | |
912 } | |
913 | |
914 tXc1->WindowX0 = tempWinX0; | |
413 | 915 tXc1->WindowX1 = tempWinX1; |
38 | 916 tXc1->WindowY0 = tempWinY0; |
917 | |
918 } | |
919 | |
920 | |
921 void t3_basics_refresh_customview(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) | |
922 { | |
837 | 923 static uint8_t last_customview = CVIEW_T3_END; |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
924 |
722 | 925 char text[30]; |
38 | 926 uint16_t textpointer = 0; |
927 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
928 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
929 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
930 |
38 | 931 // 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
|
932 const SDecoinfo * pDecoinfo = getDecoInfo(); |
38 | 933 |
934 // CVIEW_T3_Decostop | |
935 uint16_t nextstopLengthSeconds = 0; | |
936 uint8_t nextstopDepthMeter = 0; | |
937 SDivetime SafetyStopTime = {0,0,0,0}; | |
938 | |
939 // CVIEW_T3_ppO2andGas | |
940 uint8_t oxygen_percentage = 0; | |
941 | |
942 // CVIEW_T3_Temperature | |
943 float temperature; | |
944 | |
945 // CVIEW_T3_GasList | |
946 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth; | |
947 const SGasLine * pGasLine; | |
948 uint8_t oxygen, helium; | |
949 uint8_t lineNumber; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
950 uint8_t gasPosIdx; |
38 | 951 |
496 | 952 /* compass position */ |
953 point_t center; | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
954 uint16_t heading; |
496 | 955 |
38 | 956 // CVIEW_T3_StopWatch |
957 SDivetime Stopwatch = {0,0,0,0}; | |
958 float fAverageDepth, fAverageDepthAbsolute; | |
959 | |
662 | 960 #ifdef ENABLE_PSCR_MODE |
961 uint8_t showSimPPO2 = 1; | |
962 #endif | |
38 | 963 uint16_t tempWinX0; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
964 uint16_t tempWinX1; |
38 | 965 uint16_t tempWinY0; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
966 uint16_t tempWinY1; |
38 | 967 uint16_t tempWinC2X0; |
413 | 968 uint16_t tempWinC2Y0; |
969 uint16_t tempWinC2X1; | |
970 uint16_t tempWinC2Y1; | |
38 | 971 uint16_t tempWinC2Tab; |
972 | |
973 tempWinX0 = tXc1->WindowX0; | |
974 tempWinY0 = tXc1->WindowY0; | |
496 | 975 tempWinX1 = tXc1->WindowX1; |
976 tempWinY1 = tXc1->WindowY1; | |
413 | 977 |
38 | 978 tempWinC2X0 = tXc2->WindowX0; |
413 | 979 tempWinC2Y0 = tXc2->WindowY0; |
980 tempWinC2X1 = tXc2->WindowX1; | |
981 tempWinC2Y1 = tXc2->WindowY1; | |
38 | 982 tempWinC2Tab = tXc2->WindowTab; |
983 | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
984 if(settingsGetPointer()->compassInertia) |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
985 { |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
986 heading = (uint16_t)compass_getCompensated(); |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
987 } |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
988 else |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
989 { |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
990 heading = (uint16_t)stateUsed->lifeData.compass_heading; |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
991 } |
837 | 992 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
|
993 { |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
994 if(t3_customview_disabled(tX_selection_customview)) |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
995 { |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
996 tX_selection_customview = t3_change_customview(ACTION_BUTTON_ENTER); |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
997 } |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
998 last_customview = tX_selection_customview; |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
999 } |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1000 |
38 | 1001 switch(tX_selection_customview) |
1002 { | |
1003 case CVIEW_T3_ApnoeSurfaceInfo: | |
1004 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
1005 | |
413 | 1006 if(!pSettings->FlipDisplay) |
1007 { | |
1008 GFX_write_string(&FontT42,tXc1,text,0); | |
1009 tXc1->WindowY0 = 100; | |
1010 } | |
1011 else | |
1012 { | |
1013 GFX_write_string(&FontT42,tXc2,text,0); | |
1014 tXc2->WindowY1 -= 100; /* jump to upper of two lines */ | |
1015 } | |
38 | 1016 |
1017 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
|
1018 Gfx_colorsscheme_mod(text,0); |
413 | 1019 |
1020 if(!pSettings->FlipDisplay) | |
1021 { | |
1022 GFX_write_string(&FontT105,tXc1,text,0); | |
1023 tXc1->WindowY0 = tempWinY0; | |
1024 } | |
1025 else | |
1026 { | |
1027 GFX_write_string(&FontT105,tXc2,text,0); | |
1028 tXc2->WindowY1 = tempWinC2Y1; /* jump to upper of two lines */ | |
1029 } | |
38 | 1030 |
1031 | |
1032 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
|
1033 Gfx_colorsscheme_mod(text,0); |
413 | 1034 if(!pSettings->FlipDisplay) |
1035 { | |
1036 GFX_write_string(&FontT105,tXc1,text,0); | |
1037 } | |
1038 else | |
1039 { | |
1040 GFX_write_string(&FontT105,tXc2,text,0); | |
1041 } | |
38 | 1042 break; |
1043 | |
1044 case CVIEW_T3_StopWatch: | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1045 |
38 | 1046 Stopwatch.Total = timer_Stopwatch_GetTime(); |
1047 Stopwatch.Minutes = Stopwatch.Total / 60; | |
1048 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
1049 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
1050 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
1051 | |
1052 snprintf(text,TEXTSIZE,"\032\f%c",TXT_AvgDepth); | |
1053 GFX_write_string(&FontT42,tXc1,text,0); | |
1054 snprintf(text,TEXTSIZE,"\030\003\016%01.1f",unit_depth_float(fAverageDepthAbsolute)); | |
1055 GFX_write_string(&FontT105,tXc1,text,0); | |
1056 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1057 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1058 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1059 tXc1->WindowX0 = 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1060 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1061 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1062 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1063 tXc1->WindowX1 = 320; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1064 tXc1->WindowY0 = t3c1.WindowY0; /* select customer window */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1065 } |
38 | 1066 // 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
|
1067 |
38 | 1068 snprintf(text,TEXTSIZE,"\032\f%c", TXT_Stopwatch); |
1069 GFX_write_string(&FontT42,tXc1,text,0); | |
1070 snprintf(text,TEXTSIZE,"\030\016%01.1f",unit_depth_float(fAverageDepth)); | |
1071 GFX_write_string(&FontT105,tXc1,text,0); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1072 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1073 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1074 tXc1->WindowY0 = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1075 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1076 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1077 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1078 tXc1->WindowY1 -= 100; /* jump to upper of two lines */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1079 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1080 |
38 | 1081 snprintf(text,TEXTSIZE,"\030%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); |
1082 GFX_write_string(&FontT105,tXc1,text,0); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1083 |
496 | 1084 break; |
38 | 1085 |
1086 case CVIEW_T3_GasList: | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1087 gasPosIdx = 0; |
38 | 1088 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist); |
1089 GFX_write_string(&FontT42,tXc1,text,0); | |
1090 | |
1091 textpointer = 0; | |
1092 tXc2->WindowX0 = 0; | |
518 | 1093 tXc2->WindowTab = 800/3; // /2 |
38 | 1094 |
413 | 1095 if(pSettings->FlipDisplay) |
1096 { | |
1097 tXc2->WindowY1 = 0; | |
1098 } | |
1099 | |
38 | 1100 pGasLine = settingsGetPointer()->gas; |
1101 if(actualLeftMaxDepth(stateUsed)) | |
1102 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_deco) / 100; | |
1103 else | |
1104 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100; | |
1105 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100; | |
1106 for(int gasId=1;gasId<=NUM_GASES;gasId++) | |
1107 { | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1108 #ifdef ENABLE_UNUSED_GAS_HIDING |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1109 if(!pGasLine[gasId].note.ub.off) |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1110 { |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1111 #endif |
38 | 1112 textpointer = 0; |
518 | 1113 text[textpointer++] = '\003'; |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1114 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1115 lineNumber = 1; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1116 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1117 switch(gasPosIdx) |
38 | 1118 { |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1119 case 0: lineNumber = 0; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1120 case 1: |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1121 break; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1122 case 4: text[textpointer++] = '\001'; /* display centered */ |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1123 break; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1124 case 2: lineNumber = 0; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1125 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
|
1126 default: |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1127 break; |
38 | 1128 } |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1129 gasPosIdx++; |
518 | 1130 |
38 | 1131 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100; |
1132 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
|
1133 strcpy(&text[textpointer++],"\031"); |
518 | 1134 else if(stateUsed->lifeData.actualGas.GasIdInSettings == gasId) /* actual selected gas */ |
1135 { | |
1136 strcpy(&text[textpointer++],"\030"); | |
1137 } | |
38 | 1138 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow)) |
1139 strcpy(&text[textpointer++],"\025"); | |
518 | 1140 else if(actualBetterGasId() == gasId) |
1141 { | |
1142 strcpy(&text[textpointer++],"\026"); /* Highlight better gas */ | |
1143 } | |
38 | 1144 else |
518 | 1145 strcpy(&text[textpointer++],"\023"); /* Blue for travel or deco without special state */ |
38 | 1146 |
1147 text[textpointer++] = ' '; | |
1148 oxygen = pGasLine[gasId].oxygen_percentage; | |
1149 helium = pGasLine[gasId].helium_percentage; | |
1150 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
|
1151 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1152 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
|
1153 { |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1154 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
|
1155 } |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1156 text[textpointer++] = 0; |
518 | 1157 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
|
1158 #ifdef ENABLE_UNUSED_GAS_HIDING |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1159 } |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1160 #endif |
38 | 1161 } |
1162 break; | |
1163 | |
1164 case CVIEW_T3_Temperature: | |
1165 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature); | |
1166 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
|
1167 |
8b8074080d7b
Bugfix: average temperature on arrival from RTE instead of display time
Jan Mulder <jlmulder@xs4all.nl>
parents:
174
diff
changeset
|
1168 temperature = unit_temperature_float(stateUsed->lifeData.temperature_celsius); |
38 | 1169 textpointer = snprintf(text,TEXTSIZE,"\030\003\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F |
1170 if(settingsGetPointer()->nonMetricalSystem == 0) | |
1171 text[textpointer++] = 'C'; | |
1172 else | |
1173 text[textpointer++] = 'F'; | |
1174 text[textpointer++] = 0; | |
1175 GFX_write_string(&FontT105,tXc1,text,0); | |
1176 break; | |
1177 | |
1178 case CVIEW_Compass: | |
496 | 1179 center.x = 600; |
1180 center.y = 116; | |
38 | 1181 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); |
1182 GFX_write_string(&FontT42,tXc1,text,0); | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1183 snprintf(text,100,"\030\003%03i`",heading); |
38 | 1184 GFX_write_string(&FontT105,tXc1,text,0); |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1185 t3_basics_compass(tXscreen, center, heading, stateUsed->diveSettings.compassHeading); |
38 | 1186 break; |
601 | 1187 #ifdef ENABLE_T3_PROFILE_VIEW |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
1188 case CVIEW_T3_Profile: |
599 | 1189 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
|
1190 GFX_write_string(&FontT42,tXc1,text,0); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
1191 t3_miniLiveLogProfile(); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
1192 break; |
601 | 1193 #endif |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1194 case CVIEW_T3_DecoTTS: |
38 | 1195 case CVIEW_T3_Decostop: |
1196 default: | |
1197 // decostop | |
1198 if(pDecoinfo->output_time_to_surface_seconds) | |
1199 { | |
1200 tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
1201 } | |
1202 else | |
1203 { | |
1204 nextstopDepthMeter = 0; | |
1205 nextstopLengthSeconds = 0; | |
1206 } | |
1207 | |
1208 SafetyStopTime.Total = timer_Safetystop_GetCountDown(); | |
1209 SafetyStopTime.Minutes = SafetyStopTime.Total / 60; | |
1210 SafetyStopTime.Seconds = SafetyStopTime.Total - (SafetyStopTime.Minutes * 60); | |
1211 | |
1212 if(nextstopDepthMeter) | |
1213 { | |
1214 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Decostop); | |
1215 GFX_write_string(&FontT42,tXc1,text,0); | |
1216 | |
1217 textpointer = 0; | |
1218 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
|
1219 , unit_depth_integer(nextstopDepthMeter) |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1220 , unit_depth_char1_T105() |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1221 , unit_depth_char2_T105() |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1222 , (nextstopLengthSeconds+59)/60); |
868
db92692c014f
Introduce speed dependend coloring of depth:
Ideenmodellierer
parents:
857
diff
changeset
|
1223 Gfx_colorsscheme_mod(text,0); |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1224 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1225 } |
1226 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit())) | |
1227 { | |
1228 textpointer = 0; | |
1229 snprintf(&text[textpointer],TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2); | |
1230 GFX_write_string(&FontT42,tXc1,text,0); | |
1231 | |
1232 textpointer = 0; | |
1233 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
|
1234 Gfx_colorsscheme_mod(text,0); |
496 | 1235 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1236 } |
237
ec16fd26e280
Bugfix: do not show NDL in bigscreen mode when zero
Jan Mulder <jlmulder@xs4all.nl>
parents:
214
diff
changeset
|
1237 else if(pDecoinfo->output_ndl_seconds) // NDL |
38 | 1238 { |
1239 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Nullzeit); | |
1240 GFX_write_string(&FontT42,tXc1,text,0); | |
1241 if(pDecoinfo->output_ndl_seconds < 1000 * 60) | |
1242 snprintf(text,TEXTSIZE,"\020\003%i'",pDecoinfo->output_ndl_seconds/60); | |
1243 else | |
1244 snprintf(text,TEXTSIZE,"\020\003%ih",pDecoinfo->output_ndl_seconds/3600); | |
868
db92692c014f
Introduce speed dependend coloring of depth:
Ideenmodellierer
parents:
857
diff
changeset
|
1245 Gfx_colorsscheme_mod(text,0); |
496 | 1246 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1247 } |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1248 |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1249 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
|
1250 { |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1251 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
|
1252 { |
722 | 1253 snprintf(text,TEXTSIZE,"\002\032\f%c",TXT_TTS); |
1254 GFX_write_string(&FontT42,tXc1,text,0); | |
1255 if(pDecoinfo->output_time_to_surface_seconds) | |
1256 { | |
1257 if(pDecoinfo->output_time_to_surface_seconds < 100 * 60) | |
1258 snprintf(text,TEXTSIZE,"\020\003\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60); | |
1259 else | |
1260 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
|
1261 Gfx_colorsscheme_mod(text,0); |
722 | 1262 GFX_write_string(&FontT105,tXc1,text,0); |
1263 } | |
1264 } | |
1265 else if(pDecoinfo->super_saturation > 0.1) | |
1266 { | |
1267 snprintf(text,TEXTSIZE,"\002\032\f%c",TXT_ActualGradient); | |
1268 GFX_write_string(&FontT42,tXc1,text,0); | |
1269 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
|
1270 Gfx_colorsscheme_mod(text,0); |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1271 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
|
1272 } |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1273 } |
38 | 1274 break; |
1275 | |
837 | 1276 case CVIEW_T3_sensors: |
38 | 1277 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_O2monitor); |
1278 GFX_write_string(&FontT42,tXc1,text,0); | |
1279 | |
1280 for(int i=0;i<3;i++) | |
1281 { | |
1282 textpointer = 0; | |
1283 text[textpointer++] = '\030'; | |
1284 if(i==1) | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1285 text[textpointer++] = '\001'; /* center */ |
38 | 1286 else if(i==2) |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1287 text[textpointer++] = '\002'; /* right */ |
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1288 |
577
9bb9a52d6ae5
Handle o2 voltage values < 0.5mV as invalid:
Ideenmodellierer
parents:
564
diff
changeset
|
1289 if((stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) || (stateUsed->lifeData.ppO2Sensor_bar[i] == 0.0)) |
38 | 1290 { |
662 | 1291 #ifdef ENABLE_PSCR_MODE |
1292 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 */ | |
1293 { | |
1294 text[textpointer++] = '\023'; | |
1295 textpointer += snprintf(&text[textpointer],TEXTSIZE,"%.2f",stateUsed->lifeData.ppo2Simulated_bar); | |
1296 showSimPPO2 = 0; | |
1297 } | |
1298 else | |
1299 #endif | |
1300 { | |
1301 text[textpointer++] = '\031'; | |
1302 text[textpointer++] = ' '; | |
1303 text[textpointer++] = '-'; | |
1304 text[textpointer++] = ' '; | |
1305 text[textpointer++] = 0; | |
1306 } | |
38 | 1307 } |
1308 else | |
1309 { | |
1310 if(stateUsed->warnings.sensorOutOfBounds[i]) | |
1311 text[textpointer++] = '\025'; | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1312 textpointer += snprintf(&text[textpointer],TEXTSIZE,"%.2f",stateUsed->lifeData.ppO2Sensor_bar[i]); |
38 | 1313 } |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1314 GFX_write_string(&FontT105,tXc1,text,0); |
656 | 1315 |
828 | 1316 if((pSettings->co2_sensor_active) && isLoopMode(pSettings->dive_mode)) |
1317 { | |
1318 snprintf(text,TEXTSIZE,"\032\001\f%c",TXT_CO2Sensor); | |
1319 GFX_write_string(&FontT42,tXc1,text,0); | |
1320 textpointer = 0; | |
1321 if(stateUsed->lifeData.CO2_data.CO2_ppm < CO2_WARNING_LEVEL_PPM) | |
1322 { | |
1323 text[textpointer++] = '\020'; | |
1324 } | |
1325 else if(stateUsed->lifeData.CO2_data.CO2_ppm < CO2_ALARM_LEVEL_PPM) | |
1326 { | |
1327 text[textpointer++] = '\024'; /* yellow */ | |
1328 } | |
1329 else | |
1330 { | |
1331 text[textpointer++] = '\025'; /* red */ | |
1332 } | |
1333 snprintf(&text[textpointer],TEXTSIZE,"\001%5ld",stateUsed->lifeData.CO2_data.CO2_ppm); | |
1334 GFX_write_string(&FontT105,tXc1,text,1); | |
1335 } | |
656 | 1336 |
662 | 1337 if((pSettings->scrubTimerMode != SCRUB_TIMER_OFF) && isLoopMode(pSettings->dive_mode)) |
656 | 1338 { |
1339 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_ScrubTime); | |
1340 GFX_write_string(&FontT42,tXc1,text,0); | |
1341 | |
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1342 textpointer = 0; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1343 text[textpointer++] = '\002'; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1344 textpointer += printScrubberText(&text[textpointer], 10, pSettings); |
656 | 1345 GFX_write_string(&FontT105,tXc1,text,1); |
1346 } | |
38 | 1347 } |
1348 break; | |
1349 | |
1350 case CVIEW_T3_MaxDepth: | |
1351 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
413 | 1352 if(pSettings->FlipDisplay) |
1353 { | |
1354 if(mode == DIVEMODE_Apnea) | |
1355 { | |
1356 GFX_write_string(&FontT42,tXc2,text,0); | |
1357 } | |
1358 else | |
1359 { | |
1360 GFX_write_string(&FontT42,tXc1,text,0); | |
1361 } | |
1362 } | |
1363 else | |
1364 { | |
1365 GFX_write_string(&FontT42,tXc1,text,0); | |
1366 } | |
38 | 1367 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
|
1368 Gfx_colorsscheme_mod(text,0); |
413 | 1369 if(pSettings->FlipDisplay) |
1370 { | |
1371 if(mode == DIVEMODE_Apnea) | |
1372 { | |
1373 GFX_write_string(&FontT105,tXc2,text,0); | |
1374 } | |
1375 else | |
1376 { | |
1377 GFX_write_string(&FontT105,tXc1,text,0); | |
1378 } | |
1379 } | |
1380 else | |
1381 { | |
496 | 1382 GFX_write_string(&FontT105,tXc1,text,0); |
413 | 1383 } |
38 | 1384 break; |
1385 | |
1386 case CVIEW_T3_TTS: | |
1387 snprintf(text,TEXTSIZE,"\032\f%c",TXT_TTS); | |
1388 GFX_write_string(&FontT42,tXc1,text,0); | |
1389 if(pDecoinfo->output_time_to_surface_seconds) | |
1390 { | |
1391 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
|
1392 snprintf(text,TEXTSIZE,"\020\003\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60); |
38 | 1393 else |
214
51a3aeffc6b3
Bugfix: handle rounding of TTS and future TTS consistently
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1394 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
|
1395 Gfx_colorsscheme_mod(text,0); |
496 | 1396 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1397 } |
1398 break; | |
1399 | |
1400 case CVIEW_T3_ppO2andGas: | |
1401 snprintf(text,TEXTSIZE,"\032\f%c",TXT_ppO2); | |
1402 GFX_write_string(&FontT42,tXc1,text,0); | |
1403 snprintf(text,TEXTSIZE,"\020\003%01.2f",stateUsed->lifeData.ppO2); | |
868
db92692c014f
Introduce speed dependend coloring of depth:
Ideenmodellierer
parents:
857
diff
changeset
|
1404 Gfx_colorsscheme_mod(text,0); |
496 | 1405 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1406 |
1407 textpointer = 0; | |
1408 text[textpointer++] = '\020'; | |
1409 text[textpointer++] = '\003'; | |
1410 oxygen_percentage = 100; | |
1411 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage; | |
1412 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage; | |
1413 text[textpointer++] = '\002'; | |
1414 tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&text[textpointer]); | |
1415 //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
|
1416 Gfx_colorsscheme_mod(text,0); |
496 | 1417 GFX_write_string(&FontT48,tXc1,text,0); |
38 | 1418 break; |
496 | 1419 |
1420 case CVIEW_T3_Navigation: | |
1421 Stopwatch.Total = timer_Stopwatch_GetTime(); | |
1422 Stopwatch.Minutes = Stopwatch.Total / 60; | |
1423 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
1424 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
1425 | |
1426 if(!pSettings->FlipDisplay) | |
1427 { | |
1428 tXc2->WindowX0 = 550; | |
1429 } | |
1430 else | |
1431 { | |
1432 tXc2->WindowX1 = 800; | |
1433 tXc2->WindowY0 = t3c2.WindowY0; /* select customer window */ | |
1434 } | |
1435 | |
1436 snprintf(text,TEXTSIZE,"\032\002\f%c", TXT_Stopwatch); | |
511 | 1437 GFX_write_string(&FontT42,tXc1,text,0); |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1438 snprintf(text,TEXTSIZE,"\030\002\016%01.1f",unit_depth_float(fAverageDepth)); |
511 | 1439 GFX_write_string(&FontT105,tXc1,text,0); |
496 | 1440 if(!pSettings->FlipDisplay) |
1441 { | |
1442 tXc2->WindowY0 = 100; | |
1443 } | |
1444 else | |
1445 { | |
1446 tXc2->WindowY1 -= 100; /* jump to upper of two lines */ | |
1447 } | |
1448 | |
1449 snprintf(text,TEXTSIZE,"\030\002%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); | |
511 | 1450 GFX_write_string(&FontT105,tXc1,text,1); |
496 | 1451 |
1452 | |
1453 center.x = 400; | |
1454 center.y = 116; | |
1455 | |
1456 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); | |
1457 GFX_write_string(&FontT42,tXc1,text,0); | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1458 snprintf(text,100,"\030%03i`",heading); |
496 | 1459 GFX_write_string(&FontT144,tXc1,text,0); |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1460 t3_basics_compass(tXscreen, center, heading, stateUsed->diveSettings.compassHeading); |
496 | 1461 |
1462 break; | |
1463 | |
1464 case CVIEW_T3_DepthData: | |
1465 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
1466 if(pSettings->FlipDisplay) | |
1467 { | |
1468 if(mode == DIVEMODE_Apnea) | |
1469 { | |
1470 GFX_write_string(&FontT42,tXc2,text,0); | |
1471 } | |
1472 else | |
1473 { | |
1474 GFX_write_string(&FontT42,tXc1,text,0); | |
1475 } | |
1476 } | |
1477 else | |
1478 { | |
1479 GFX_write_string(&FontT42,tXc1,text,0); | |
1480 } | |
1481 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
|
1482 Gfx_colorsscheme_mod(text,0); |
496 | 1483 if(pSettings->FlipDisplay) |
1484 { | |
1485 if(mode == DIVEMODE_Apnea) | |
1486 { | |
1487 GFX_write_string(&FontT105,tXc2,text,0); | |
1488 } | |
1489 else | |
1490 { | |
1491 GFX_write_string(&FontT105,tXc1,text,0); | |
1492 } | |
1493 } | |
1494 else | |
1495 { | |
1496 GFX_write_string(&FontT105,tXc1,text,0); | |
1497 } | |
1498 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
1499 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_AvgDepth); | |
511 | 1500 GFX_write_string(&FontT42,tXc1,text,0); |
496 | 1501 |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1502 snprintf(text,TEXTSIZE,"\020\003\002\016\%01.1f",unit_depth_float(fAverageDepthAbsolute)); |
511 | 1503 GFX_write_string(&FontT105,tXc1,text,0); |
496 | 1504 break; |
38 | 1505 } |
496 | 1506 |
1507 | |
1508 | |
38 | 1509 tXc1->WindowX0 = tempWinX0; |
1510 tXc1->WindowY0 = tempWinY0; | |
496 | 1511 tXc1->WindowX1 = tempWinX1; |
1512 tXc1->WindowY1 = tempWinY1; | |
413 | 1513 |
38 | 1514 tXc2->WindowX0 = tempWinC2X0; |
413 | 1515 tXc2->WindowY0 = tempWinC2Y0; |
1516 tXc2->WindowX1 = tempWinC2X1; | |
1517 tXc2->WindowY1 = tempWinC2Y1; | |
38 | 1518 tXc2->WindowTab = tempWinC2Tab; |
1519 } | |
1520 | |
1521 | |
1522 uint8_t t3_test_customview_warnings(void) | |
1523 { | |
1524 uint8_t count = 0; | |
1525 | |
1526 count = 0; | |
1527 count += stateUsed->warnings.decoMissed; | |
1528 count += stateUsed->warnings.ppO2Low; | |
1529 count += stateUsed->warnings.ppO2High; | |
1530 //count += stateUsed->warnings.lowBattery; | |
1531 count += stateUsed->warnings.sensorLinkLost; | |
1532 count += stateUsed->warnings.fallback; | |
1533 | |
1534 return count; | |
1535 } | |
1536 | |
1537 //void t3_show_customview_warnings(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode) | |
1538 void t3_basics_show_customview_warnings(GFX_DrawCfgWindow* tXc1) | |
1539 { | |
1540 char text[256], textMain[256]; | |
1541 uint8_t textpointer, textpointerMain, lineFree, more; | |
951 | 1542 #ifdef HAVE_DEBUG_WARNINGS |
857 | 1543 uint8_t index = 0; |
951 | 1544 #endif |
38 | 1545 |
1546 snprintf(text,TEXTSIZE,"\025\f%c",TXT_Warning); | |
1547 GFX_write_string(&FontT42,&t3c1,text,0); | |
1548 | |
1549 lineFree = 1; | |
1550 more = 0; | |
1551 | |
1552 textpointerMain = 0; | |
511 | 1553 textMain[textpointerMain++] = '\025'; /* red */ |
1554 textMain[textpointerMain++] = '\003'; /* doublesize */ | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1555 textMain[textpointerMain++] = TXT_2BYTE; /* There is only one Main warning to be displayed */ |
38 | 1556 |
1557 textpointer = 0; | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1558 text[textpointer++] = '\025'; /* red */ |
38 | 1559 |
1560 if(stateUsed->warnings.decoMissed) | |
1561 { | |
1562 if(lineFree) | |
1563 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1564 textMain[textpointerMain++] = TXT2BYTE_WarnDecoMissed; |
38 | 1565 lineFree--; |
1566 } | |
1567 else | |
1568 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1569 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1570 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1571 text[textpointer++] = TXT2BYTE_WarnDecoMissed; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1572 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1573 text[textpointer++] = '\n'; |
38 | 1574 more++; |
1575 } | |
1576 } | |
1577 | |
1578 if(stateUsed->warnings.ppO2Low) | |
1579 { | |
1580 if(lineFree) | |
1581 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1582 textMain[textpointerMain++] = TXT2BYTE_WarnPPO2Low; |
38 | 1583 lineFree--; |
1584 } | |
1585 else | |
1586 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1587 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1588 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1589 text[textpointer++] = TXT2BYTE_WarnPPO2Low; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1590 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1591 text[textpointer++] = '\n'; |
38 | 1592 more++; |
1593 } | |
1594 } | |
1595 | |
1596 if(stateUsed->warnings.ppO2High) | |
1597 { | |
1598 if(lineFree) | |
1599 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1600 textMain[textpointerMain++] = TXT2BYTE_WarnPPO2High; |
38 | 1601 lineFree--; |
1602 } | |
1603 else | |
1604 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1605 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1606 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1607 text[textpointer++] = TXT2BYTE_WarnPPO2High; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1608 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1609 text[textpointer++] = '\n'; |
38 | 1610 more++; |
1611 } | |
1612 } | |
1613 | |
1614 if(stateUsed->warnings.fallback) | |
1615 { | |
1616 if(lineFree) | |
1617 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1618 textMain[textpointerMain++] = TXT2BYTE_WarnFallback; |
38 | 1619 lineFree--; |
1620 } | |
1621 else | |
1622 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1623 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1624 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1625 text[textpointer++] = TXT2BYTE_WarnFallback; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1626 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1627 text[textpointer++] = '\n'; |
38 | 1628 more++; |
1629 } | |
1630 } | |
1631 | |
1632 if(stateUsed->warnings.sensorLinkLost) | |
1633 { | |
1634 if(lineFree) | |
1635 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1636 textMain[textpointerMain++] = TXT2BYTE_WarnSensorLinkLost; |
38 | 1637 lineFree--; |
1638 } | |
1639 else | |
1640 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1641 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1642 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1643 text[textpointer++] = TXT2BYTE_WarnSensorLinkLost; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1644 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1645 text[textpointer++] = '\n'; |
38 | 1646 more++; |
1647 } | |
1648 } | |
1649 | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1650 if(stateUsed->warnings.co2High) |
38 | 1651 { |
1652 if(lineFree) | |
1653 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1654 textMain[textpointerMain++] = TXT2BYTE_WarnCO2High; |
38 | 1655 } |
1656 else | |
1657 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1658 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1659 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1660 text[textpointer++] = TXT2BYTE_WarnCO2High; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1661 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1662 text[textpointer++] = '\n'; |
38 | 1663 more++; |
1664 } | |
1665 } | |
857 | 1666 #ifdef HAVE_DEBUG_WARNINGS |
1667 if(lineFree && stateUsed->warnings.debug) | |
1668 { | |
1669 for(index=0; index<3; index++) | |
1670 { | |
1671 if(((stateUsed->lifeData.extIf_sensor_map[index] == SENSOR_DIGO2M) && (((SSensorDataDiveO2*)(stateUsed->lifeData.extIf_sensor_data[index]))->status & DVO2_FATAL_ERROR))) | |
1672 { | |
1673 textpointer += snprintf(&text[textpointer],32,"\001Debug: %lx\n",((SSensorDataDiveO2*)(stateUsed->lifeData.extIf_sensor_data[index]))->status); | |
1674 } | |
1675 } | |
1676 lineFree--; | |
1677 } | |
1678 #endif | |
38 | 1679 text[textpointer] = 0; |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1680 textMain[textpointerMain] = 0; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1681 |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1682 if(lineFree == 0) |
38 | 1683 { |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1684 GFX_write_string(&FontT48,&t3c1,textMain,0); |
38 | 1685 } |
1686 if(more) | |
1687 { | |
511 | 1688 GFX_write_string(&FontT48,&t3c2,text,0); |
38 | 1689 } |
951 | 1690 requestBuzzerActivation(1); |
38 | 1691 } |
1692 | |
496 | 1693 uint8_t t3_customview_disabled(uint8_t view) |
1694 { | |
1695 uint8_t i = 0; | |
1696 uint8_t cv_disabled = 0; | |
1697 const uint8_t *pcv_changelist; | |
1698 uint32_t cv_config = settingsGetPointer()->cv_config_BigScreen; | |
1699 | |
511 | 1700 pcv_changelist = cv_changelist_BS; |
496 | 1701 |
1702 while(pcv_changelist[i] != CVIEW_T3_END) | |
1703 { | |
1704 if((view == pcv_changelist[i]) && !CHECK_BIT_THOME(cv_config, pcv_changelist[i])) | |
1705 { | |
1706 cv_disabled = 1; | |
1707 break; | |
1708 } | |
1709 i++; | |
1710 } | |
1711 | |
837 | 1712 if ((view == CVIEW_T3_sensors) && |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
1713 ((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0) || stateUsed->warnings.fallback)) |
496 | 1714 { |
1715 cv_disabled = 1; | |
1716 } | |
1717 | |
1718 return cv_disabled; | |
1719 } | |
38 | 1720 |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
1721 uint8_t t3_change_customview(uint8_t action) |
38 | 1722 { |
511 | 1723 |
837 | 1724 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
|
1725 return t3_selection_customview; |
38 | 1726 } |
1727 | |
1728 | |
511 | 1729 void t3_basics_change_customview(uint8_t *tX_selection_customview,const uint8_t *tX_customviews, uint8_t action) |
38 | 1730 { |
511 | 1731 uint8_t curViewIdx = 0xff; |
1732 uint8_t index = 0; | |
599 | 1733 uint8_t indexOverrun = 0; |
511 | 1734 uint8_t lastViewIdx = 0; |
599 | 1735 uint8_t iterate = 0; /* set to 1 if a view has to be skipped */ |
1736 uint8_t useFallback = 0; /* is set if the current view is disabled */ | |
1737 uint8_t fallbackSelection = CVIEW_noneOrDebug; /* show "None" view per default */ | |
38 | 1738 |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1739 /* set pointer to currently selected view and count number of entries */ |
511 | 1740 while((tX_customviews[index] != CVIEW_T3_END)) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1741 { |
511 | 1742 if (tX_customviews[index] == *tX_selection_customview) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1743 { |
511 | 1744 curViewIdx = index; |
837 | 1745 break; |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1746 } |
511 | 1747 index++; |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1748 } |
511 | 1749 if(curViewIdx == 0xff) /* called with unknown view */ |
496 | 1750 { |
511 | 1751 curViewIdx = 0; |
599 | 1752 *tX_selection_customview = CVIEW_noneOrDebug; /* show "None" view per default */ |
496 | 1753 } |
511 | 1754 lastViewIdx = index; |
1755 index = curViewIdx; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1756 do |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1757 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1758 iterate = 0; |
496 | 1759 switch(action) |
1760 { | |
1761 case ACTION_BUTTON_ENTER: | |
1762 case ACTION_PITCH_POS: | |
1763 | |
511 | 1764 if(tX_customviews[index] != CVIEW_T3_END) |
496 | 1765 { |
511 | 1766 index++; |
1767 } | |
1768 if(tX_customviews[index] == CVIEW_T3_END) | |
1769 { | |
1770 index = 0; | |
599 | 1771 indexOverrun = 1; |
496 | 1772 } |
1773 break; | |
1774 case ACTION_PITCH_NEG: | |
511 | 1775 if(index == 0) |
496 | 1776 { |
511 | 1777 index = lastViewIdx - 1; |
599 | 1778 indexOverrun = 1; |
496 | 1779 } |
1780 else | |
1781 { | |
511 | 1782 index--; |
496 | 1783 } |
1784 break; | |
1785 default: | |
1786 break; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1787 } |
496 | 1788 |
837 | 1789 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
|
1790 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1791 iterate = 1; |
599 | 1792 if(*tX_selection_customview == tX_customviews[index]) |
1793 { | |
1794 useFallback = 1; /* the provided view is disabled => use fallback */ | |
1795 } | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1796 } |
599 | 1797 else /* special case which are enabled but not to be displayed at the moment */ |
1798 { | |
1799 if(settingsGetPointer()->MotionDetection != MOTION_DETECT_SECTOR) /* no hiding in case of active sector view option (fixed mapping would change during dive) */ | |
1800 { | |
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
|
1801 const SDecoinfo * pDecoinfo = getDecoInfo(); |
601 | 1802 /* Skip TTS if value is 0 */ |
1803 if((tX_customviews[index] == CVIEW_T3_TTS) && (!pDecoinfo->output_time_to_surface_seconds)) | |
599 | 1804 { |
601 | 1805 if(*tX_selection_customview == tX_customviews[index]) |
1806 { | |
1807 useFallback = 1; /* the provided view is disabled => use fallback */ | |
1808 } | |
599 | 1809 iterate = 1; |
601 | 1810 if(fallbackSelection == CVIEW_noneOrDebug) |
1811 { | |
1812 fallbackSelection = CVIEW_T3_TTS; | |
1813 } | |
599 | 1814 } |
601 | 1815 /* Skip Deco if NDL is not set */ |
1816 if((tX_customviews[index] == CVIEW_T3_Decostop) && ((!pDecoinfo->output_ndl_seconds) && (!pDecoinfo->output_time_to_surface_seconds) && (timer_Safetystop_GetCountDown() == 0))) | |
599 | 1817 { |
601 | 1818 if(*tX_selection_customview == tX_customviews[index]) |
1819 { | |
1820 useFallback = 1; /* the provided view is disabled => use fallback */ | |
1821 } | |
1822 fallbackSelection = CVIEW_T3_Decostop; | |
599 | 1823 iterate = 1; |
1824 } | |
1825 } | |
1826 } | |
1827 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 | 1828 { |
1829 action = ACTION_BUTTON_ENTER; | |
1830 } | |
599 | 1831 }while ((iterate == 1) && (!((indexOverrun == 1) && (*tX_selection_customview == tX_customviews[index])))); /* no other available view found => use fallback */ |
38 | 1832 |
599 | 1833 if(*tX_selection_customview == tX_customviews[index]) |
1834 { | |
1835 if(useFallback) | |
1836 { | |
1837 *tX_selection_customview = fallbackSelection; /* no active view found => keep actual view or change to fallback if actual view is deactivated */ | |
1838 } | |
1839 } | |
1840 else | |
1841 { | |
1842 *tX_selection_customview = tX_customviews[index]; | |
1843 } | |
38 | 1844 } |
1845 | |
496 | 1846 point_t t3_compass_circle(uint8_t id, uint16_t degree, point_t center) |
38 | 1847 { |
1848 float fCos, fSin; | |
1849 const float piMult = ((2 * 3.14159) / 360); | |
1850 // const int radius[4] = {95,105,115,60}; | |
1851 const int radius[4] = {85,95,105,90}; | |
496 | 1852 static point_t forcenter = {.x = 900, .y = 500}; /* used to identify change of circle position */ |
38 | 1853 static point_t r[4][360] = { 0 }; |
1854 | |
496 | 1855 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 | 1856 { |
1857 for(int i=0;i<360;i++) | |
1858 { | |
1859 fCos = cos(i * piMult); | |
1860 fSin = sin(i * piMult); | |
1861 for(int j=0;j<4;j++) | |
1862 { | |
496 | 1863 r[j][i].x = center.x + (int)(fSin * radius[j]); |
1864 r[j][i].y = center.y + (int)(fCos * radius[j]); | |
38 | 1865 } |
1866 } | |
496 | 1867 forcenter.x = center.x; |
1868 forcenter.y = center.y; | |
38 | 1869 } |
1870 if(id > 3) id = 0; | |
1871 if(degree > 359) degree = 0; | |
1872 return r[id][degree]; | |
1873 } | |
1874 | |
1875 | |
496 | 1876 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, point_t center, uint16_t ActualHeading, uint16_t UserSetHeading) |
38 | 1877 { |
496 | 1878 uint8_t loop = 0; |
38 | 1879 uint16_t LineHeading; |
496 | 1880 |
38 | 1881 static int32_t LastHeading = 0; |
1882 int32_t newHeading = 0; | |
1883 int32_t diff = 0; | |
1884 int32_t diff2 = 0; | |
1885 | |
1886 int32_t diffAbs = 0; | |
1887 int32_t diffAbs2 = 0; | |
1888 | |
1889 newHeading = ActualHeading; | |
1890 | |
1891 diff = newHeading - LastHeading; | |
1892 | |
1893 if(newHeading < LastHeading) | |
1894 diff2 = newHeading + 360 - LastHeading; | |
1895 else | |
1896 diff2 = newHeading - 360 - LastHeading; | |
1897 | |
1898 diffAbs = diff; | |
1899 if(diffAbs < 0) | |
1900 diffAbs *= -1; | |
1901 | |
1902 diffAbs2 = diff2; | |
1903 if(diffAbs2 < 0) | |
1904 diffAbs2 *= -1; | |
1905 | |
1906 if(diffAbs <= diffAbs2) | |
1907 newHeading = LastHeading + (diff / 2); | |
1908 else | |
1909 newHeading = LastHeading + (diff2 / 2); | |
1910 | |
1911 if(newHeading < 0) | |
1912 newHeading += 360; | |
1913 else | |
1914 if(newHeading >= 360) | |
1915 newHeading -= 360; | |
1916 | |
1917 LastHeading = newHeading; | |
1918 ActualHeading = newHeading; | |
1919 | |
1920 if (ActualHeading < 90) | |
1921 ActualHeading += 360; | |
1922 | |
1923 while(ActualHeading > 359) ActualHeading -= 360; | |
1924 | |
1925 LineHeading = 360 - ActualHeading; | |
496 | 1926 |
1927 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font030); // North | |
38 | 1928 LineHeading += 90; |
496 | 1929 |
1930 for (loop = 0; loop < 3; loop++) | |
1931 { | |
1932 if(LineHeading > 359) LineHeading -= 360; | |
1933 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Main Ticks | |
1934 LineHeading += 90; | |
1935 } | |
38 | 1936 |
1937 LineHeading = 360 - ActualHeading; | |
1938 LineHeading += 45; | |
496 | 1939 |
1940 for (loop = 0; loop < 4; loop++) | |
1941 { | |
1942 if(LineHeading > 359) LineHeading -= 360; | |
1943 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Subtick | |
1944 LineHeading += 90; | |
1945 } | |
38 | 1946 |
1947 LineHeading = 360 - ActualHeading; | |
1948 LineHeading += 22; | |
496 | 1949 for (loop = 0; loop < 8; loop++) |
1950 { | |
1951 if(LineHeading > 359) LineHeading -= 360; | |
1952 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Subtick | |
1953 LineHeading += 45; | |
1954 } | |
38 | 1955 if(UserSetHeading) |
1956 { | |
1957 LineHeading = UserSetHeading + 360 - ActualHeading; | |
1958 if(LineHeading > 359) LineHeading -= 360; | |
496 | 1959 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_CompassUserHeadingTick); |
38 | 1960 |
1961 // R�ckpeilung, User Back Heading | |
1962 LineHeading = UserSetHeading + 360 + 180 - ActualHeading; | |
1963 if(LineHeading > 359) LineHeading -= 360; | |
1964 if(LineHeading > 359) LineHeading -= 360; | |
496 | 1965 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_CompassUserBackHeadingTick); |
38 | 1966 } |
1967 | |
1968 GFX_draw_circle(tXscreen, center, 106, CLUT_Font030); | |
1969 GFX_draw_circle(tXscreen, center, 107, CLUT_Font030); | |
1970 GFX_draw_circle(tXscreen, center, 108, CLUT_Font030); | |
1971 } | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1972 |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1973 uint8_t t3_GetEnabled_customviews() |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1974 { |
496 | 1975 uint8_t *pViews; |
1976 uint8_t increment = 1; | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1977 uint8_t enabledViewCnt = 0; |
496 | 1978 |
837 | 1979 pViews = (uint8_t*)cv_changelist_BS; |
496 | 1980 while((*pViews != CVIEW_T3_END)) |
1981 { | |
1982 increment = 1; | |
1983 /* check if view is enabled */ | |
1984 if(t3_customview_disabled(*pViews)) | |
1985 { | |
1986 increment = 0; | |
1987 } | |
1988 pViews++; | |
1989 enabledViewCnt += increment; | |
1990 } | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1991 return enabledViewCnt; |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1992 } |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1993 |
518 | 1994 uint8_t t3_getCustomView(void) |
1995 { | |
1996 return t3_selection_customview; | |
1997 } | |
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1998 |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1999 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
|
2000 { |
924
4d98fb2a178e
Bugfix real scrubber time decreased in sim mode:
Ideenmodellierer
parents:
868
diff
changeset
|
2001 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
|
2002 char colour = '\020'; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
2003 if (currentTimerMinutes <= 0) { |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
2004 colour = '\025'; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
2005 } else if (currentTimerMinutes <= 30) { |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
2006 colour = '\024'; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
2007 } |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
2008 |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
2009 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
|
2010 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
|
2011 } else { |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
2012 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
|
2013 } |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
2014 } |
838 | 2015 |
841 | 2016 void t3_AF_updateBorderConditions() |
2017 { | |
2018 uint16_t nextstopLengthSeconds = 0; | |
2019 uint8_t nextstopDepthMeter = 0; | |
2020 | |
2021 tHome_findNextStop(getDecoInfo()->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
2022 AF_lastDecoDepth = nextstopDepthMeter; | |
2023 AF_lastTTS = (getDecoInfo()->output_time_to_surface_seconds / 60) / 10; | |
2024 } | |
2025 | |
2026 uint8_t t3_CheckAfCondition(uint8_t T3CView) | |
838 | 2027 { |
841 | 2028 uint8_t retVal = 0; |
2029 | |
2030 float pitch = stateRealGetPointer()->lifeData.compass_pitch; | |
2031 float roll = stateRealGetPointer()->lifeData.compass_roll; | |
2032 | |
2033 uint16_t nextstopLengthSeconds = 0; | |
2034 uint8_t nextstopDepthMeter = 0; | |
2035 | |
2036 switch (T3CView) | |
2037 { | |
2038 case CVIEW_T3_GasList: retVal = (stateUsed->warnings.betterGas) /* switch if better gas is available or depending on ppo2 if in OC mode */ | |
2039 || ((stateUsed->diveSettings.diveMode == DIVEMODE_OC) && ((stateUsed->warnings.ppO2Low) || (stateUsed->warnings.ppO2High))); | |
2040 | |
2041 break; | |
2042 case CVIEW_T3_Navigation: retVal = (pitch > -AF_COMPASS_ACTIVATION_ANGLE) && (pitch < AF_COMPASS_ACTIVATION_ANGLE) | |
2043 && (roll > -AF_COMPASS_ACTIVATION_ANGLE) && (roll < AF_COMPASS_ACTIVATION_ANGLE); | |
2044 | |
2045 break; | |
2046 case CVIEW_T3_DecoTTS: tHome_findNextStop(getDecoInfo()->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
2047 /* A new deco step is added to the plan */ | |
2048 if(nextstopDepthMeter > AF_lastDecoDepth) | |
2049 { | |
2050 retVal = 1; | |
2051 } | |
838 | 2052 |
841 | 2053 /* Close to the next deco step or missed deco step */ |
2054 if((abs(stateUsed->lifeData.depth_meter - nextstopDepthMeter) < 2) || (stateUsed->warnings.decoMissed)) | |
2055 { | |
2056 retVal = 1; | |
2057 } | |
2058 /* Another 10 minutes to surface */ | |
2059 if((getDecoInfo()->output_time_to_surface_seconds) && ((uint16_t)((getDecoInfo()->output_time_to_surface_seconds / 60) / 10) > AF_lastTTS)) | |
2060 { | |
2061 retVal = 1; | |
2062 } | |
2063 break; | |
2064 default: break; | |
2065 } | |
2066 | |
2067 return retVal; | |
2068 } | |
2069 | |
2070 uint8_t t3_EvaluateAFCondition(uint8_t T3CView) | |
2071 { | |
2072 static uint8_t debounce[CVIEW_T3_END]; | |
2073 static uint8_t lastState[CVIEW_T3_END]; | |
2074 uint8_t detectionState = AF_VIEW_NOCHANGE; | |
2075 uint8_t cnt = 0; | |
2076 | |
2077 if(T3CView <= CVIEW_T3_END) | |
838 | 2078 { |
841 | 2079 if(T3CView == CVIEW_T3_END) |
838 | 2080 { |
841 | 2081 for(cnt = 0; cnt < CVIEW_T3_END; cnt++) |
2082 { | |
2083 debounce[cnt] = 0; | |
2084 lastState[cnt] = AF_VIEW_NOCHANGE; | |
2085 } | |
2086 } | |
2087 if(t3_CheckAfCondition(T3CView)) | |
2088 { | |
2089 if(debounce[T3CView] < 10) | |
2090 { | |
2091 debounce[T3CView]++; | |
2092 } | |
2093 else | |
2094 { | |
2095 detectionState = AF_VIEW_ACTIVATED; | |
2096 } | |
838 | 2097 } |
2098 else | |
2099 { | |
841 | 2100 if(debounce[T3CView] > 0) |
2101 { | |
2102 debounce[T3CView]--; | |
2103 } | |
2104 else | |
2105 { | |
2106 detectionState = AF_VIEW_DEACTIVATED; | |
2107 } | |
2108 } | |
2109 if(detectionState) /* no state change => return 0 */ | |
2110 { | |
2111 if((detectionState == lastState[T3CView])) | |
2112 { | |
2113 detectionState = AF_VIEW_NOCHANGE; | |
2114 } | |
2115 else | |
2116 { | |
2117 lastState[T3CView] = detectionState; | |
2118 } | |
838 | 2119 } |
2120 } | |
2121 return detectionState; | |
2122 } | |
2123 | |
835 | 2124 void t3_handleAutofocus(void) |
2125 { | |
2126 static uint8_t returnView = CVIEW_T3_END; | |
2127 | |
841 | 2128 uint8_t runningT3CView = 0; |
835 | 2129 |
841 | 2130 for (runningT3CView = 0; runningT3CView < CVIEW_T3_END; runningT3CView++) |
838 | 2131 { |
841 | 2132 if(stateUsed->diveSettings.activeAFViews & (1 << runningT3CView)) |
838 | 2133 { |
841 | 2134 switch(t3_EvaluateAFCondition(runningT3CView)) |
2135 { | |
2136 case AF_VIEW_ACTIVATED: returnView = t3_selection_customview; | |
2137 t3_select_customview(runningT3CView); | |
2138 t3_AF_updateBorderConditions(); | |
2139 break; | |
2140 case AF_VIEW_DEACTIVATED: if((returnView != CVIEW_T3_END) && (t3_selection_customview == runningT3CView)) | |
2141 { | |
2142 if(runningT3CView != CVIEW_T3_DecoTTS) /* some view does not switch back */ | |
2143 { | |
2144 t3_select_customview(returnView); | |
2145 } | |
2146 returnView = CVIEW_T3_END; | |
2147 } | |
2148 break; | |
2149 default: | |
2150 break; | |
2151 } | |
838 | 2152 } |
2153 } | |
835 | 2154 } |
945 | 2155 |
2156 #define ASCENT_GRAPH_YPIXEL 220 | |
2157 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 */ | |
2158 { | |
2159 static uint16_t countDownSec = 0; | |
2160 uint8_t drawingMeterStep; | |
2161 static float exitDepthMeter = 0.0; | |
2162 | |
2163 | |
2164 uint8_t index = 0; | |
2165 uint8_t color = 0; | |
2166 point_t start, stop; | |
2167 | |
2168 SSettings* pSettings; | |
2169 pSettings = settingsGetPointer(); | |
2170 | |
2171 | |
2172 if(calculateSlowExit(&countDownSec, &exitDepthMeter, &color)) /* graph to be drawn? */ | |
2173 { | |
2174 if(!pSettings->FlipDisplay) | |
2175 { | |
2176 start.y = tXl1->WindowY0 - 1; | |
2177 } | |
2178 else | |
2179 { | |
2180 start.y = tXl1->WindowY1 + 1; | |
2181 } | |
2182 | |
2183 drawingMeterStep = ASCENT_GRAPH_YPIXEL / pSettings->last_stop_depth_meter; /* based on 120 / 4 = 30 of standard ascent graph */ | |
2184 | |
2185 for(index = 0; index < pSettings->last_stop_depth_meter; index++) /* draw meter indicators */ | |
2186 { | |
2187 start.y += drawingMeterStep; | |
2188 stop.y = start.y; | |
2189 if(!pSettings->FlipDisplay) | |
2190 { | |
2191 start.x = tXl1->WindowX1 - 1; | |
2192 } | |
2193 else | |
2194 { | |
2195 start.x = tXr1->WindowX1 + 3; | |
2196 } | |
2197 stop.x = start.x - 43; | |
2198 GFX_draw_line(tXscreen, start, stop, 0); | |
2199 } | |
2200 | |
2201 /* draw cntdown bar */ | |
2202 | |
2203 if(!pSettings->FlipDisplay) | |
2204 { | |
2205 start.x -= 20; | |
2206 start.y = tXl1->WindowY0 + ASCENT_GRAPH_YPIXEL + 2; | |
2207 } | |
2208 else | |
2209 { | |
2210 start.x -= 25; | |
2211 start.y = tXl1->WindowY1 + ASCENT_GRAPH_YPIXEL + 5; | |
2212 } | |
2213 stop.x = start.x; | |
2214 stop.y = start.y - countDownSec * (ASCENT_GRAPH_YPIXEL / (float)(pSettings->slowExitTime * 60.0)); | |
2215 if(stop.y >= 470) stop.y = 470; | |
2216 if(!pSettings->FlipDisplay) | |
2217 { | |
2218 stop.y += 5; | |
2219 } | |
2220 GFX_draw_thick_line(15,tXscreen, start, stop, 3); | |
2221 /* mark diver depth */ | |
2222 if(!pSettings->FlipDisplay) | |
2223 { | |
2224 start.x = tXl1->WindowX1 - 32; | |
2225 stop.x = start.x + 24; | |
2226 } | |
2227 else | |
2228 { | |
2229 start.x = tXr1->WindowX1 - 33; | |
2230 stop.x = start.x + 24; | |
2231 } | |
2232 | |
2233 | |
2234 start.y = start.y - (stateUsed->lifeData.depth_meter * (ASCENT_GRAPH_YPIXEL) / pSettings->last_stop_depth_meter); | |
2235 stop.y = start.y; | |
2236 GFX_draw_thick_line(10,tXscreen, start, stop, 9); | |
2237 } | |
954
4e4fbd73e329
Slow exit graph draw normal ascent if slow exit is inactive:
Ideenmodellierer
parents:
951
diff
changeset
|
2238 else |
4e4fbd73e329
Slow exit graph draw normal ascent if slow exit is inactive:
Ideenmodellierer
parents:
951
diff
changeset
|
2239 { |
4e4fbd73e329
Slow exit graph draw normal ascent if slow exit is inactive:
Ideenmodellierer
parents:
951
diff
changeset
|
2240 color = 0xff; |
4e4fbd73e329
Slow exit graph draw normal ascent if slow exit is inactive:
Ideenmodellierer
parents:
951
diff
changeset
|
2241 } |
945 | 2242 return color; |
2243 } |