Mercurial > public > ostc4
annotate Discovery/Src/t3.c @ 594:280c11153080
Added compile switch for new T3 View Profile
author | Ideenmodellierer |
---|---|
date | Mon, 04 Jan 2021 21:30:04 +0100 |
parents | f52bc70e380f |
children | 5a8f9126e4cb |
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 ------------------------------------------------------------------*/ | |
30 #include "t3.h" | |
31 | |
32 #include "data_exchange_main.h" | |
33 #include "decom.h" | |
34 #include "gfx_fonts.h" | |
35 #include "math.h" | |
36 #include "tHome.h" | |
37 #include "timer.h" | |
38 #include "unit.h" | |
553 | 39 #include "motion.h" |
38 | 40 |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
41 #include "logbook_miniLive.h" |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
42 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
43 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
44 #define CV_PROFILE_WIDTH (700U) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
45 |
237
ec16fd26e280
Bugfix: do not show NDL in bigscreen mode when zero
Jan Mulder <jlmulder@xs4all.nl>
parents:
214
diff
changeset
|
46 //* Imported function prototypes ---------------------------------------------*/ |
38 | 47 extern uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium); |
48 | |
49 /* Exported variables --------------------------------------------------------*/ | |
50 | |
51 const uint16_t BigFontSeperationLeftRight = 399; | |
52 const uint16_t BigFontSeperationTopBottom = 240; | |
53 | |
54 /* Private variables ---------------------------------------------------------*/ | |
55 GFX_DrawCfgScreen t3screen; | |
56 GFX_DrawCfgWindow t3l1; | |
57 GFX_DrawCfgWindow t3r1; | |
58 GFX_DrawCfgWindow t3c1; | |
59 GFX_DrawCfgWindow t3c2; | |
60 | |
529
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
61 uint8_t t3_selection_customview = CVIEW_noneOrDebug; |
38 | 62 |
63 /* TEM HAS TO MOVE TO GLOBAL--------------------------------------------------*/ | |
64 | |
65 /* Private types -------------------------------------------------------------*/ | |
66 #define TEXTSIZE 16 | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
67 #define NUMBER_OF_VIEWS 7 /* number of views defined in the array below */ |
38 | 68 |
69 const uint8_t t3_customviewsStandard[] = | |
70 { | |
71 CVIEW_T3_Decostop, | |
72 CVIEW_sensors, | |
73 CVIEW_Compass, | |
74 CVIEW_T3_MaxDepth, | |
75 CVIEW_T3_StopWatch, | |
76 CVIEW_T3_TTS, | |
77 CVIEW_T3_ppO2andGas, | |
518 | 78 CVIEW_T3_GasList, |
511 | 79 CVIEW_T3_Navigation, |
80 CVIEW_T3_DepthData, | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
81 CVIEW_noneOrDebug, |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
82 CVIEW_T3_DecoTTS, |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
83 CVIEW_T3_Profile, |
38 | 84 CVIEW_T3_END |
85 }; | |
86 | |
87 /* Private function prototypes -----------------------------------------------*/ | |
88 void t3_refresh_divemode(void); | |
89 | |
90 uint8_t t3_test_customview_warnings(void); | |
91 void t3_refresh_customview(float depth); | |
496 | 92 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, point_t center, uint16_t ActualHeading, uint16_t UserSetHeading); |
38 | 93 |
94 /* Exported functions --------------------------------------------------------*/ | |
95 | |
96 void t3_init(void) | |
97 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
98 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
99 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
100 |
496 | 101 t3_selection_customview = t3_customviewsStandard[0]; |
38 | 102 |
103 t3screen.FBStartAdress = 0; | |
104 t3screen.ImageHeight = 480; | |
105 t3screen.ImageWidth = 800; | |
106 t3screen.LayerIndex = 1; | |
107 | |
108 t3l1.Image = &t3screen; | |
109 t3l1.WindowNumberOfTextLines = 2; | |
110 t3l1.WindowLineSpacing = 19; // Abstand von Y0 | |
111 t3l1.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
112 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
113 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
114 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
115 t3l1.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
116 t3l1.WindowX1 = BigFontSeperationLeftRight - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
117 t3l1.WindowY0 = BigFontSeperationTopBottom + 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
118 t3l1.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
119 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
120 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
121 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
122 t3l1.WindowX0 = 800 - BigFontSeperationLeftRight + 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
123 t3l1.WindowX1 = 799; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
124 t3l1.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
125 t3l1.WindowY1 = 479 - BigFontSeperationTopBottom + 5 ; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
126 } |
38 | 127 |
128 t3r1.Image = &t3screen; | |
129 t3r1.WindowNumberOfTextLines = t3l1.WindowNumberOfTextLines; | |
130 t3r1.WindowLineSpacing = t3l1.WindowLineSpacing; | |
131 t3r1.WindowTab = t3l1.WindowTab; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
132 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
133 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
134 t3r1.WindowX0 = BigFontSeperationLeftRight + 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
135 t3r1.WindowX1 = 799; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
136 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
137 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
138 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
139 t3r1.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
140 t3r1.WindowX1 = BigFontSeperationLeftRight - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
141 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
142 |
38 | 143 t3r1.WindowY0 = t3l1.WindowY0; |
144 t3r1.WindowY1 = t3l1.WindowY1; | |
145 | |
518 | 146 /* t3c1 is across the complete lower part of the display */ |
38 | 147 t3c1.Image = &t3screen; |
148 t3c1.WindowNumberOfTextLines = 2; | |
518 | 149 t3c1.WindowLineSpacing = 84 + 5; /* double font + spacing */ |
38 | 150 t3c1.WindowX0 = 0; |
151 t3c1.WindowX1 = 799; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
152 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
153 { |
511 | 154 t3c1.WindowY0 = 5; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
155 t3c1.WindowY1 = BigFontSeperationTopBottom - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
156 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
157 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
158 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
159 t3c1.WindowY0 = 480 - BigFontSeperationTopBottom + 5; |
511 | 160 t3c1.WindowY1 = 479 - 5; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
161 } |
38 | 162 |
518 | 163 /* t3c2 is just showing the lower right part of the display */ |
38 | 164 t3c2.Image = &t3screen; |
165 t3c2.WindowNumberOfTextLines = 3; | |
511 | 166 t3c2.WindowLineSpacing = t3c1.WindowLineSpacing ; |
38 | 167 t3c2.WindowX0 = 370; |
168 t3c2.WindowX1 = 799; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
169 t3c2.WindowY0 = t3c1.WindowY0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
170 t3c2.WindowY1 = t3c1.WindowY1; |
38 | 171 t3c2.WindowTab = 600; |
172 } | |
173 | |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
174 void t3_select_customview(uint8_t selectedCustomview) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
175 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
176 if(selectedCustomview < CVIEW_T3_END) |
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 t3_selection_customview = selectedCustomview; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
179 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
180 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
181 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
182 void t3_miniLiveLogProfile(void) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
183 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
184 SWindowGimpStyle wintemp; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
185 uint16_t datalength = 0; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
186 uint16_t* pReplayData; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
187 uint16_t max_depth = 0; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
188 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
189 point_t start, stop; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
190 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
191 SSettings* pSettings; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
192 pSettings = settingsGetPointer(); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
193 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
194 wintemp.left = t3c1.WindowX0; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
195 wintemp.right = t3c1.WindowX0 + CV_PROFILE_WIDTH; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
196 wintemp.top = 480 - BigFontSeperationTopBottom + 5; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
197 wintemp.bottom = t3c1.WindowY1 = 479 - 5; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
198 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
199 start.x = CV_PROFILE_WIDTH + 2; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
200 start.y = wintemp.top; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
201 stop.x = start.x; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
202 stop.y = wintemp.bottom; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
203 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
204 GFX_draw_line(&t3screen, start, stop, CLUT_Font020); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
205 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
206 if(getReplayOffset() != 0xFFFF) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
207 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
208 getReplayInfo(&pReplayData, &datalength, &max_depth); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
209 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
210 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
211 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
|
212 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
213 max_depth = (uint16_t)(stateUsed->lifeData.max_depth_meter * 100); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
214 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
215 if(datalength != 0) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
216 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
217 GFX_graph_print(&t3screen, &wintemp, 0,1,0, max_depth, pReplayData, datalength, CLUT_Font031, NULL); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
218 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
219 else |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
220 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
221 datalength = 750; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
222 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
223 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
224 GFX_graph_print(&t3screen, &wintemp, 0,1,0, max_depth, getMiniLiveReplayPointerToData(), datalength, CLUT_Font030, NULL); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
225 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
226 |
38 | 227 |
228 void t3_refresh(void) | |
229 { | |
496 | 230 static uint8_t last_mode = MODE_SURFACE; |
231 | |
38 | 232 SStateList status; |
233 get_globalStateList(&status); | |
234 | |
235 if(stateUsed->mode != MODE_DIVE) | |
236 { | |
237 settingsGetPointer()->design = 7; | |
238 return; | |
239 } | |
240 | |
241 if(status.base != BaseHome) | |
242 return; | |
243 | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
244 if(last_mode != MODE_DIVE) /* Select custom view */ |
496 | 245 { |
246 if((settingsGetPointer()->tX_customViewTimeout == 0) && (settingsGetPointer()->showDebugInfo)) | |
247 { | |
248 t3_selection_customview = CVIEW_noneOrDebug; | |
249 } | |
250 else | |
251 { | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
252 t3_selection_customview = settingsGetPointer()->tX_customViewPrimaryBF; |
496 | 253 } |
254 t3_change_customview(ACTION_END); | |
255 } | |
38 | 256 t3screen.FBStartAdress = getFrame(24); |
257 t3_refresh_divemode(); | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
258 GFX_SetFramesTopBottom(t3screen.FBStartAdress, 0,480); |
38 | 259 releaseAllFramesExcept(24,t3screen.FBStartAdress); |
496 | 260 last_mode = stateUsed->mode; |
38 | 261 } |
262 | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
263 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
|
264 { |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
265 if(stateUsed->mode == MODE_DIVE) |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
266 { |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
267 t3_selection_customview = settingsGetPointer()->tX_customViewPrimaryBF; |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
268 } |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
269 } |
38 | 270 |
271 /* Private functions ---------------------------------------------------------*/ | |
272 | |
273 float t3_basics_lines_depth_and_divetime(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode) | |
274 { | |
518 | 275 char text[256]; |
276 uint8_t textPointer; | |
38 | 277 uint8_t color; |
278 uint8_t depthChangeRate; | |
279 uint8_t depthChangeAscent; | |
280 point_t start, stop, startZeroLine; | |
518 | 281 SDivetime Divetime = {0,0,0,0}; |
38 | 282 |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
283 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
284 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
285 |
38 | 286 start.x = 0; |
287 stop.x = 799; | |
288 stop.y = start.y = BigFontSeperationTopBottom; | |
553 | 289 if(viewInFocus()) |
290 { | |
291 GFX_draw_line(tXscreen, start, stop, CLUT_Font023); | |
292 } | |
293 else | |
294 { | |
295 GFX_draw_line(tXscreen, start, stop, CLUT_Font020); | |
296 } | |
297 | |
38 | 298 |
299 start.y = BigFontSeperationTopBottom; | |
300 stop.y = 479; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
301 |
38 | 302 stop.x = start.x = BigFontSeperationLeftRight; |
553 | 303 if(viewInFocus()) |
304 { | |
305 GFX_draw_line(tXscreen, start, stop, CLUT_Font023); | |
306 } | |
307 else | |
308 { | |
309 GFX_draw_line(tXscreen, start, stop, CLUT_Font020); | |
310 } | |
38 | 311 |
312 /* depth */ | |
174
ecb71521d004
Bugfix: make max depth move with current depth (part 2)
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
313 float depth = unit_depth_float(stateUsed->lifeData.depth_meter); |
38 | 314 |
315 if(depth <= 0.3f) | |
316 depth = 0; | |
317 | |
318 if(settingsGetPointer()->nonMetricalSystem) | |
319 snprintf(text,TEXTSIZE,"\032\f[feet]"); | |
320 else | |
321 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Depth); | |
322 GFX_write_string(&FontT42,tXl1,text,0); | |
323 | |
324 if( ((mode == DIVEMODE_Apnea) && ((stateUsed->lifeData.ascent_rate_meter_per_min > 4) || (stateUsed->lifeData.ascent_rate_meter_per_min < -4 ))) | |
325 || ((mode != DIVEMODE_Apnea) && ((stateUsed->lifeData.ascent_rate_meter_per_min > 8) || (stateUsed->lifeData.ascent_rate_meter_per_min < -10))) | |
326 ) | |
327 { | |
328 snprintf(text,TEXTSIZE,"\f\002%.0f %c%c/min " | |
329 , unit_depth_float(stateUsed->lifeData.ascent_rate_meter_per_min) | |
330 , unit_depth_char1() | |
331 , unit_depth_char2() | |
332 ); | |
333 GFX_write_string(&FontT42,tXl1,text,0); | |
334 } | |
335 | |
336 if( depth < 100) | |
337 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",depth); | |
338 else | |
339 snprintf(text,TEXTSIZE,"\020\003\016%01.0f",depth); | |
340 | |
341 t3_basics_colorscheme_mod(text); | |
342 GFX_write_string(&FontT105,tXl1,text,1); | |
343 | |
344 | |
345 /* ascentrate graph */ | |
346 if(mode == DIVEMODE_Apnea) | |
347 { | |
348 /* ascentrate graph - apnea mode */ | |
349 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) | |
350 { | |
351 depthChangeAscent = 1; | |
352 if(stateUsed->lifeData.ascent_rate_meter_per_min < 200) | |
353 depthChangeRate = (uint8_t)stateUsed->lifeData.ascent_rate_meter_per_min; | |
354 else | |
355 depthChangeRate = 200; | |
356 } | |
357 else | |
358 { | |
359 depthChangeAscent = 0; | |
360 if(stateUsed->lifeData.ascent_rate_meter_per_min > -200) | |
361 depthChangeRate = (uint8_t)(0 - stateUsed->lifeData.ascent_rate_meter_per_min); | |
362 else | |
363 depthChangeRate = 200; | |
364 } | |
413 | 365 |
366 if(!pSettings->FlipDisplay) | |
367 { | |
368 start.y = tXl1->WindowY0 - 1; | |
369 } | |
370 else | |
371 { | |
372 start.y = tXl1->WindowY1 + 1; | |
373 } | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
374 startZeroLine.y = start.y; |
38 | 375 for(int i = 0; i<5;i++) |
376 { | |
377 start.y += 40; | |
378 stop.y = start.y; | |
413 | 379 if(!pSettings->FlipDisplay) |
380 { | |
381 start.x = tXl1->WindowX1 - 1; | |
382 } | |
383 else | |
384 { | |
385 start.x = tXr1->WindowX1 - 1; | |
386 } | |
38 | 387 stop.x = start.x - 17; |
388 | |
389 if(depthChangeRate <= 6) | |
390 { | |
391 if(i == 2) | |
392 { | |
393 startZeroLine.y = start.y; | |
394 stop.x = start.x - 34; | |
395 } | |
396 } | |
397 else | |
398 { | |
399 if(((i == 1) && depthChangeAscent) || ((i == 3) && !depthChangeAscent)) | |
400 { | |
401 startZeroLine.y = start.y; | |
402 stop.x = start.x - 34; | |
403 } | |
404 } | |
405 GFX_draw_line(tXscreen, start, stop, 0); | |
406 } | |
407 // new thick bar design Sept. 2015 | |
408 if((stateUsed->lifeData.ascent_rate_meter_per_min > 4) || (stateUsed->lifeData.ascent_rate_meter_per_min < -4)) | |
409 { | |
410 start.y = startZeroLine.y; | |
411 if(depthChangeAscent) | |
412 { | |
413 color = CLUT_EverythingOkayGreen; | |
414 start.y += 7; // starte etwas weiter oben | |
415 stop.y = start.y + (uint16_t)(depthChangeRate * 4) - 9; // - x; // wegen der Liniendicke | |
416 if(stop.y > 475) | |
417 stop.y = 475; | |
418 } | |
419 else | |
420 { | |
421 color = CLUT_Font023; | |
422 start.y -= 7; | |
423 stop.y = start.y - (uint16_t)(depthChangeRate * 4) + 9; | |
424 if(stop.y <= tXl1->WindowY0) | |
425 stop.y = tXl1->WindowY0 + 1; | |
426 } | |
413 | 427 if(!pSettings->FlipDisplay) |
428 { | |
429 start.x = tXl1->WindowX1 - 3 - 5; | |
430 } | |
431 else | |
432 { | |
433 start.x = tXr1->WindowX1 - 3 - 5; | |
434 } | |
435 | |
436 stop.x = start.x; | |
38 | 437 GFX_draw_thick_line(12,tXscreen, start, stop, color); |
438 } | |
439 } | |
440 else | |
441 { | |
442 /* ascentrate graph -standard mode */ | |
443 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) | |
444 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
445 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
446 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
447 start.y = tXl1->WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
448 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
449 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
450 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
451 start.y = tXl1->WindowY1 + 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
452 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
453 |
38 | 454 for(int i = 0; i<4;i++) |
455 { | |
456 start.y += 5*8; | |
457 stop.y = start.y; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
458 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
459 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
460 start.x = tXl1->WindowX1 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
461 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
462 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
463 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
464 start.x = tXr1->WindowX1 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
465 } |
38 | 466 stop.x = start.x - 17; |
467 GFX_draw_line(tXscreen, start, stop, 0); | |
468 } | |
469 // new thick bar design Sept. 2015 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
470 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
471 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
472 start.x = tXl1->WindowX1 - 3 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
473 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
474 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
475 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
476 start.x = tXr1->WindowX1 - 3 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
477 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
478 |
38 | 479 stop.x = start.x; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
480 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
481 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
482 start.y = tXl1->WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
483 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
484 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
485 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
486 start.y = tXl1->WindowY1 + 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
487 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
488 |
38 | 489 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 8); |
490 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9 | |
491 if(stop.y >= 470) | |
492 stop.y = 470; | |
493 start.y += 7; // starte etwas weiter oben | |
494 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 10) | |
495 color = CLUT_EverythingOkayGreen; | |
496 else | |
497 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 15) | |
498 color = CLUT_WarningYellow; | |
499 else | |
500 color = CLUT_WarningRed; | |
501 | |
502 GFX_draw_thick_line(12,tXscreen, start, stop, color); | |
503 } | |
504 } | |
505 | |
506 // divetime | |
507 if(mode == DIVEMODE_Apnea) | |
508 { | |
509 if(stateUsed->lifeData.counterSecondsShallowDepth) | |
510 { | |
511 SDivetime SurfaceBreakTime = {0,0,0,0}; | |
512 | |
513 SurfaceBreakTime.Total = stateUsed->lifeData.counterSecondsShallowDepth; | |
514 SurfaceBreakTime.Minutes = SurfaceBreakTime.Total / 60; | |
515 SurfaceBreakTime.Seconds = SurfaceBreakTime.Total - (SurfaceBreakTime.Minutes * 60); | |
516 | |
517 snprintf(text,TEXTSIZE,"\032\f\002%c%c", TXT_2BYTE,TXT2BYTE_ApneaSurface); | |
518 GFX_write_string(&FontT42,tXr1,text,0); | |
519 | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
520 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",SurfaceBreakTime.Minutes, SurfaceBreakTime.Seconds); |
38 | 521 } |
522 else | |
523 { | |
524 Divetime.Total = stateUsed->lifeData.dive_time_seconds; | |
525 Divetime.Minutes = Divetime.Total / 60; | |
526 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); | |
527 | |
528 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
529 GFX_write_string(&FontT42,tXr1,text,0); | |
530 | |
531 if(Divetime.Minutes < 100) | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
532 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",Divetime.Minutes, Divetime.Seconds); |
38 | 533 else |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
534 snprintf(text,TEXTSIZE,"\020\003\002\016%u'",Divetime.Minutes); |
38 | 535 } |
518 | 536 t3_basics_colorscheme_mod(text); |
537 GFX_write_string(&FontT105,tXr1,text,1); | |
38 | 538 } |
539 else | |
540 { | |
518 | 541 switch(get_globalState()) |
542 { | |
543 case StDBEAR: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_DiveBearingQ); | |
544 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
545 break; | |
546 case StDRAVG: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_DiveResetAvgQ); | |
547 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
548 break; | |
38 | 549 |
518 | 550 case StDMGAS: |
551 textPointer = 0; | |
552 text[textPointer++] = '\a'; | |
553 text[textPointer++] = '\001'; | |
554 text[textPointer++] = ' '; | |
555 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[actualBetterGasId()].oxygen_percentage,stateUsed->diveSettings.gas[actualBetterGasId()].helium_percentage,&text[textPointer]); | |
556 text[textPointer++] = '?'; | |
557 text[textPointer++] = ' '; | |
558 text[textPointer++] = 0; | |
559 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
560 break; | |
561 default: /* show divetime */ | |
38 | 562 |
518 | 563 Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; |
564 Divetime.Minutes = Divetime.Total / 60; | |
565 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); | |
566 | |
567 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
568 GFX_write_string(&FontT42,tXr1,text,0); | |
569 | |
570 if(Divetime.Minutes < 100) | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
571 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",Divetime.Minutes, Divetime.Seconds); |
518 | 572 else |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
573 snprintf(text,TEXTSIZE,"\020\003\002\016%u'",Divetime.Minutes); |
518 | 574 |
575 t3_basics_colorscheme_mod(text); | |
576 GFX_write_string(&FontT105,tXr1,text,1); | |
577 break; | |
578 } | |
38 | 579 } |
580 | |
581 return depth; | |
582 } | |
583 | |
584 | |
585 void t3_refresh_divemode(void) | |
586 { | |
587 uint8_t customview_warnings = 0; | |
588 float depth_meter = 0.0; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
589 |
38 | 590 // everything like lines, depth, ascent graph and divetime |
591 depth_meter = t3_basics_lines_depth_and_divetime(&t3screen, &t3l1, &t3r1, 0); // 0 could be stateUsed->diveSettings.diveMode for CCR specials | |
592 | |
593 // customview | |
594 if(stateUsed->warnings.numWarnings) | |
595 customview_warnings = t3_test_customview_warnings(); | |
596 | |
597 if(customview_warnings && warning_count_high_time) | |
598 t3_basics_show_customview_warnings(&t3c1); | |
599 else | |
600 t3_refresh_customview(depth_meter); | |
601 | |
602 if(stateUsed->warnings.lowBattery) | |
496 | 603 t3_basics_battery_low_customview_extra(&t3r1); //t3c1); |
38 | 604 } |
605 | |
606 | |
607 void t3_basics_battery_low_customview_extra(GFX_DrawCfgWindow* tXc1) | |
608 { | |
609 char TextC1[256]; | |
610 | |
496 | 611 TextC1[0] = ' ';//'\002'; |
38 | 612 TextC1[1] = '\f'; |
613 TextC1[2] = '\025'; | |
614 TextC1[3] = '3'; | |
615 TextC1[4] = '1'; | |
616 TextC1[5] = '1'; | |
617 TextC1[6] = '1'; | |
618 TextC1[7] = '1'; | |
619 TextC1[8] = '1'; | |
620 TextC1[9] = '1'; | |
621 TextC1[10] = '1'; | |
622 TextC1[11] = '1'; | |
623 TextC1[12] = '1'; | |
624 TextC1[13] = '1'; | |
625 TextC1[14] = '0'; | |
626 TextC1[15] = 0; | |
627 | |
628 if(!warning_count_high_time) | |
629 TextC1[4] = '2'; | |
630 | |
631 GFX_write_string(&Batt24,tXc1,TextC1,0); | |
632 } | |
633 | |
634 | |
635 | |
636 void t3_refresh_customview(float depth) | |
637 { | |
272
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
237
diff
changeset
|
638 t3_basics_refresh_customview(depth, t3_selection_customview, &t3screen, &t3c1, &t3c2, stateUsedWrite->diveSettings.diveMode); |
38 | 639 } |
640 | |
641 | |
642 void t3_basics_refresh_apnoeRight(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) | |
643 { | |
644 char text[512]; | |
645 uint16_t textpointer = 0; | |
646 | |
647 // CVIEW_T3_Temperature | |
648 float temperature; | |
413 | 649 SSettings* pSettings; |
650 pSettings = settingsGetPointer(); | |
38 | 651 |
652 SDivetime TotalDivetime = {0,0,0,0}; | |
653 SDivetime LastDivetime = {0,0,0,0}; | |
654 | |
655 uint16_t tempWinX0; | |
413 | 656 uint16_t tempWinX1; |
38 | 657 uint16_t tempWinY0; |
413 | 658 uint16_t tempWinY1; |
38 | 659 |
660 tempWinX0 = tXc1->WindowX0; | |
413 | 661 tempWinX1 = tXc1->WindowX1; |
38 | 662 tempWinY0 = tXc1->WindowY0; |
413 | 663 tempWinY1 = tXc1->WindowY1; |
38 | 664 |
665 tXc1->WindowX0 = 440; // rechte Seite | |
666 | |
667 switch(tX_selection_customview) | |
668 { | |
669 case CVIEW_T3_Temperature: | |
670 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature); | |
671 GFX_write_string(&FontT42,tXc1,text,0); | |
672 | |
189
8b8074080d7b
Bugfix: average temperature on arrival from RTE instead of display time
Jan Mulder <jlmulder@xs4all.nl>
parents:
174
diff
changeset
|
673 temperature = unit_temperature_float(stateUsed->lifeData.temperature_celsius); |
38 | 674 textpointer = snprintf(text,TEXTSIZE,"\020\003\016%01.0f\016\016\140",temperature); // "\016\016%01.1f `" + C or F |
675 if(settingsGetPointer()->nonMetricalSystem == 0) | |
676 text[textpointer++] = 'C'; | |
677 else | |
678 text[textpointer++] = 'F'; | |
679 text[textpointer++] = 0; | |
680 t3_basics_colorscheme_mod(text); | |
681 GFX_write_string(&FontT105,tXc1,text,1); | |
682 break; | |
683 | |
684 case CVIEW_T3_ApnoeSurfaceInfo: | |
685 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Divetime); | |
686 GFX_write_string(&FontT42,tXc1,text,0); | |
687 | |
688 TotalDivetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; | |
689 TotalDivetime.Minutes = TotalDivetime.Total / 60; | |
690 TotalDivetime.Seconds = TotalDivetime.Total - ( TotalDivetime.Minutes * 60 ); | |
691 | |
692 LastDivetime.Total = stateUsed->lifeData.apnea_last_dive_time_seconds; | |
693 LastDivetime.Minutes = LastDivetime.Total / 60; | |
694 LastDivetime.Seconds = LastDivetime.Total - ( LastDivetime.Minutes * 60 ); | |
695 | |
413 | 696 // tXc1->WindowY0 = 100; // obere Zeile |
697 if(!pSettings->FlipDisplay) | |
698 { | |
699 tXc1->WindowY0 = 100; | |
700 } | |
701 else | |
702 { | |
703 tXc1->WindowY1 -= 100; /* jump to upper of two lines */ | |
704 } | |
38 | 705 |
706 snprintf(text,TEXTSIZE,"\020\016%u:%02u",LastDivetime.Minutes, LastDivetime.Seconds); | |
707 t3_basics_colorscheme_mod(text); | |
708 GFX_write_string(&FontT105,tXc1,text,0); | |
709 | |
413 | 710 if(pSettings->FlipDisplay) |
711 { | |
712 tXc1->WindowX0 = 0; | |
713 | |
714 } | |
38 | 715 snprintf(text,TEXTSIZE,"\032\002%c%c",TXT_2BYTE, TXT2BYTE_ApneaLast); |
716 GFX_write_string(&FontT42,tXc1,text,0); | |
717 | |
413 | 718 if(!pSettings->FlipDisplay) |
719 { | |
720 tXc1->WindowY0 = tempWinY0; | |
721 } | |
722 else | |
723 { | |
724 tXc1->WindowX1 = tempWinX1; | |
725 tXc1->WindowY1 = tempWinY1; /* jump to upper of two lines */ | |
726 } | |
38 | 727 |
728 snprintf(text,TEXTSIZE,"\020\016%u:%02u",TotalDivetime.Minutes, TotalDivetime.Seconds); | |
729 t3_basics_colorscheme_mod(text); | |
730 GFX_write_string(&FontT105,tXc1,text,0); | |
731 | |
732 snprintf(text,TEXTSIZE,"\032\002%c%c",TXT_2BYTE, TXT2BYTE_ApneaTotal); | |
413 | 733 if(pSettings->FlipDisplay) |
734 { | |
735 tXc1->WindowX0 = 0; | |
736 | |
737 } | |
38 | 738 GFX_write_string(&FontT42,tXc1,text,0); |
739 break; | |
740 } | |
741 | |
742 tXc1->WindowX0 = tempWinX0; | |
413 | 743 tXc1->WindowX1 = tempWinX1; |
38 | 744 tXc1->WindowY0 = tempWinY0; |
745 | |
746 } | |
747 | |
748 | |
749 void t3_basics_refresh_customview(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) | |
750 { | |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
751 static uint8_t last_customview = CVIEW_END; |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
752 |
38 | 753 char text[512]; |
754 uint16_t textpointer = 0; | |
755 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
756 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
757 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
758 |
38 | 759 // CVIEW_T3_Decostop and CVIEW_T3_TTS |
760 const SDecoinfo * pDecoinfo; | |
761 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
762 pDecoinfo = &stateUsed->decolistBuehlmann; | |
763 else | |
764 pDecoinfo = &stateUsed->decolistVPM; | |
765 | |
766 // CVIEW_T3_Decostop | |
767 uint16_t nextstopLengthSeconds = 0; | |
768 uint8_t nextstopDepthMeter = 0; | |
769 SDivetime SafetyStopTime = {0,0,0,0}; | |
770 | |
771 // CVIEW_T3_ppO2andGas | |
772 uint8_t oxygen_percentage = 0; | |
773 | |
774 // CVIEW_T3_Temperature | |
775 float temperature; | |
776 | |
777 // CVIEW_T3_GasList | |
778 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth; | |
779 const SGasLine * pGasLine; | |
780 uint8_t oxygen, helium; | |
781 uint8_t lineNumber; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
782 uint8_t gasPosIdx; |
38 | 783 |
496 | 784 /* compass position */ |
785 point_t center; | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
786 uint16_t heading; |
496 | 787 |
38 | 788 // CVIEW_T3_StopWatch |
789 SDivetime Stopwatch = {0,0,0,0}; | |
790 float fAverageDepth, fAverageDepthAbsolute; | |
791 | |
792 uint16_t tempWinX0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
793 uint16_t tempWinX1; |
38 | 794 uint16_t tempWinY0; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
795 uint16_t tempWinY1; |
38 | 796 uint16_t tempWinC2X0; |
413 | 797 uint16_t tempWinC2Y0; |
798 uint16_t tempWinC2X1; | |
799 uint16_t tempWinC2Y1; | |
38 | 800 uint16_t tempWinC2Tab; |
801 | |
802 tempWinX0 = tXc1->WindowX0; | |
803 tempWinY0 = tXc1->WindowY0; | |
496 | 804 tempWinX1 = tXc1->WindowX1; |
805 tempWinY1 = tXc1->WindowY1; | |
413 | 806 |
38 | 807 tempWinC2X0 = tXc2->WindowX0; |
413 | 808 tempWinC2Y0 = tXc2->WindowY0; |
809 tempWinC2X1 = tXc2->WindowX1; | |
810 tempWinC2Y1 = tXc2->WindowY1; | |
38 | 811 tempWinC2Tab = tXc2->WindowTab; |
812 | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
813 if(settingsGetPointer()->compassInertia) |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
814 { |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
815 heading = (uint16_t)compass_getCompensated(); |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
816 } |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
817 else |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
818 { |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
819 heading = (uint16_t)stateUsed->lifeData.compass_heading; |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
820 } |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
821 if(last_customview != tX_selection_customview) /* check if current selection is disabled and should be skipped */ |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
822 { |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
823 if(t3_customview_disabled(tX_selection_customview)) |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
824 { |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
825 tX_selection_customview = t3_change_customview(ACTION_BUTTON_ENTER); |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
826 } |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
827 last_customview = tX_selection_customview; |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
828 } |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
829 |
38 | 830 switch(tX_selection_customview) |
831 { | |
832 case CVIEW_T3_ApnoeSurfaceInfo: | |
833 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
834 | |
413 | 835 if(!pSettings->FlipDisplay) |
836 { | |
837 GFX_write_string(&FontT42,tXc1,text,0); | |
838 tXc1->WindowY0 = 100; | |
839 } | |
840 else | |
841 { | |
842 GFX_write_string(&FontT42,tXc2,text,0); | |
843 tXc2->WindowY1 -= 100; /* jump to upper of two lines */ | |
844 } | |
38 | 845 |
846 snprintf(text,TEXTSIZE,"\020\016%01.1f",unit_depth_float(stateUsed->lifeData.apnea_last_max_depth_meter)); | |
847 t3_basics_colorscheme_mod(text); | |
413 | 848 |
849 if(!pSettings->FlipDisplay) | |
850 { | |
851 GFX_write_string(&FontT105,tXc1,text,0); | |
852 tXc1->WindowY0 = tempWinY0; | |
853 } | |
854 else | |
855 { | |
856 GFX_write_string(&FontT105,tXc2,text,0); | |
857 tXc2->WindowY1 = tempWinC2Y1; /* jump to upper of two lines */ | |
858 } | |
38 | 859 |
860 | |
861 snprintf(text,TEXTSIZE,"\020\016%01.1f",unit_depth_float(stateUsed->lifeData.apnea_total_max_depth_meter)); | |
862 t3_basics_colorscheme_mod(text); | |
413 | 863 if(!pSettings->FlipDisplay) |
864 { | |
865 GFX_write_string(&FontT105,tXc1,text,0); | |
866 } | |
867 else | |
868 { | |
869 GFX_write_string(&FontT105,tXc2,text,0); | |
870 } | |
38 | 871 break; |
872 | |
873 case CVIEW_T3_StopWatch: | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
874 |
38 | 875 Stopwatch.Total = timer_Stopwatch_GetTime(); |
876 Stopwatch.Minutes = Stopwatch.Total / 60; | |
877 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
878 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
879 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
880 | |
881 snprintf(text,TEXTSIZE,"\032\f%c",TXT_AvgDepth); | |
882 GFX_write_string(&FontT42,tXc1,text,0); | |
883 snprintf(text,TEXTSIZE,"\030\003\016%01.1f",unit_depth_float(fAverageDepthAbsolute)); | |
884 GFX_write_string(&FontT105,tXc1,text,0); | |
885 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
886 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
887 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
888 tXc1->WindowX0 = 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
889 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
890 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
891 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
892 tXc1->WindowX1 = 320; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
893 tXc1->WindowY0 = t3c1.WindowY0; /* select customer window */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
894 } |
38 | 895 // 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
|
896 |
38 | 897 snprintf(text,TEXTSIZE,"\032\f%c", TXT_Stopwatch); |
898 GFX_write_string(&FontT42,tXc1,text,0); | |
899 snprintf(text,TEXTSIZE,"\030\016%01.1f",unit_depth_float(fAverageDepth)); | |
900 GFX_write_string(&FontT105,tXc1,text,0); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
901 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
902 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
903 tXc1->WindowY0 = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
904 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
905 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
906 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
907 tXc1->WindowY1 -= 100; /* jump to upper of two lines */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
908 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
909 |
38 | 910 snprintf(text,TEXTSIZE,"\030%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); |
911 GFX_write_string(&FontT105,tXc1,text,0); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
912 |
496 | 913 break; |
38 | 914 |
915 case CVIEW_T3_GasList: | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
916 gasPosIdx = 0; |
38 | 917 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist); |
918 GFX_write_string(&FontT42,tXc1,text,0); | |
919 | |
920 textpointer = 0; | |
921 tXc2->WindowX0 = 0; | |
518 | 922 tXc2->WindowTab = 800/3; // /2 |
38 | 923 |
413 | 924 if(pSettings->FlipDisplay) |
925 { | |
926 tXc2->WindowY1 = 0; | |
927 } | |
928 | |
38 | 929 pGasLine = settingsGetPointer()->gas; |
930 if(actualLeftMaxDepth(stateUsed)) | |
931 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_deco) / 100; | |
932 else | |
933 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100; | |
934 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100; | |
935 for(int gasId=1;gasId<=NUM_GASES;gasId++) | |
936 { | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
937 #ifdef ENABLE_UNUSED_GAS_HIDING |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
938 if(!pGasLine[gasId].note.ub.off) |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
939 { |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
940 #endif |
38 | 941 textpointer = 0; |
518 | 942 text[textpointer++] = '\003'; |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
943 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
944 lineNumber = 1; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
945 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
946 switch(gasPosIdx) |
38 | 947 { |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
948 case 0: lineNumber = 0; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
949 case 1: |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
950 break; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
951 case 4: text[textpointer++] = '\001'; /* display centered */ |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
952 break; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
953 case 2: lineNumber = 0; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
954 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
|
955 default: |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
956 break; |
38 | 957 } |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
958 gasPosIdx++; |
518 | 959 |
38 | 960 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100; |
961 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
|
962 strcpy(&text[textpointer++],"\031"); |
518 | 963 else if(stateUsed->lifeData.actualGas.GasIdInSettings == gasId) /* actual selected gas */ |
964 { | |
965 strcpy(&text[textpointer++],"\030"); | |
966 } | |
38 | 967 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow)) |
968 strcpy(&text[textpointer++],"\025"); | |
518 | 969 else if(actualBetterGasId() == gasId) |
970 { | |
971 strcpy(&text[textpointer++],"\026"); /* Highlight better gas */ | |
972 } | |
38 | 973 else |
518 | 974 strcpy(&text[textpointer++],"\023"); /* Blue for travel or deco without special state */ |
38 | 975 |
976 text[textpointer++] = ' '; | |
977 oxygen = pGasLine[gasId].oxygen_percentage; | |
978 helium = pGasLine[gasId].helium_percentage; | |
979 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
|
980 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
981 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
|
982 { |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
983 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
|
984 } |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
985 text[textpointer++] = 0; |
518 | 986 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
|
987 #ifdef ENABLE_UNUSED_GAS_HIDING |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
988 } |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
989 #endif |
38 | 990 } |
991 break; | |
992 | |
993 case CVIEW_T3_Temperature: | |
994 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature); | |
995 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
|
996 |
8b8074080d7b
Bugfix: average temperature on arrival from RTE instead of display time
Jan Mulder <jlmulder@xs4all.nl>
parents:
174
diff
changeset
|
997 temperature = unit_temperature_float(stateUsed->lifeData.temperature_celsius); |
38 | 998 textpointer = snprintf(text,TEXTSIZE,"\030\003\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F |
999 if(settingsGetPointer()->nonMetricalSystem == 0) | |
1000 text[textpointer++] = 'C'; | |
1001 else | |
1002 text[textpointer++] = 'F'; | |
1003 text[textpointer++] = 0; | |
1004 GFX_write_string(&FontT105,tXc1,text,0); | |
1005 break; | |
1006 | |
1007 case CVIEW_Compass: | |
496 | 1008 center.x = 600; |
1009 center.y = 116; | |
38 | 1010 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); |
1011 GFX_write_string(&FontT42,tXc1,text,0); | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1012 snprintf(text,100,"\030\003%03i`",heading); |
38 | 1013 GFX_write_string(&FontT105,tXc1,text,0); |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1014 t3_basics_compass(tXscreen, center, heading, stateUsed->diveSettings.compassHeading); |
38 | 1015 break; |
1016 | |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
1017 case CVIEW_T3_Profile: |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
1018 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Profile); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
1019 GFX_write_string(&FontT42,tXc1,text,0); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
1020 t3_miniLiveLogProfile(); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
1021 break; |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1022 case CVIEW_T3_DecoTTS: |
38 | 1023 case CVIEW_T3_Decostop: |
1024 default: | |
1025 // decostop | |
1026 if(pDecoinfo->output_time_to_surface_seconds) | |
1027 { | |
1028 tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
1029 } | |
1030 else | |
1031 { | |
1032 nextstopDepthMeter = 0; | |
1033 nextstopLengthSeconds = 0; | |
1034 } | |
1035 | |
1036 SafetyStopTime.Total = timer_Safetystop_GetCountDown(); | |
1037 SafetyStopTime.Minutes = SafetyStopTime.Total / 60; | |
1038 SafetyStopTime.Seconds = SafetyStopTime.Total - (SafetyStopTime.Minutes * 60); | |
1039 | |
1040 if(nextstopDepthMeter) | |
1041 { | |
1042 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Decostop); | |
1043 GFX_write_string(&FontT42,tXc1,text,0); | |
1044 | |
1045 textpointer = 0; | |
1046 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
|
1047 , unit_depth_integer(nextstopDepthMeter) |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1048 , unit_depth_char1_T105() |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1049 , unit_depth_char2_T105() |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1050 , (nextstopLengthSeconds+59)/60); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1051 t3_basics_colorscheme_mod(text); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1052 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1053 } |
1054 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit())) | |
1055 { | |
1056 textpointer = 0; | |
1057 snprintf(&text[textpointer],TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2); | |
1058 GFX_write_string(&FontT42,tXc1,text,0); | |
1059 | |
1060 textpointer = 0; | |
1061 snprintf(&text[textpointer],TEXTSIZE,"\020\003\016%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds); | |
1062 t3_basics_colorscheme_mod(text); | |
496 | 1063 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1064 } |
237
ec16fd26e280
Bugfix: do not show NDL in bigscreen mode when zero
Jan Mulder <jlmulder@xs4all.nl>
parents:
214
diff
changeset
|
1065 else if(pDecoinfo->output_ndl_seconds) // NDL |
38 | 1066 { |
1067 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Nullzeit); | |
1068 GFX_write_string(&FontT42,tXc1,text,0); | |
1069 if(pDecoinfo->output_ndl_seconds < 1000 * 60) | |
1070 snprintf(text,TEXTSIZE,"\020\003%i'",pDecoinfo->output_ndl_seconds/60); | |
1071 else | |
1072 snprintf(text,TEXTSIZE,"\020\003%ih",pDecoinfo->output_ndl_seconds/3600); | |
1073 t3_basics_colorscheme_mod(text); | |
496 | 1074 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1075 } |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1076 |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1077 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
|
1078 { |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1079 snprintf(text,TEXTSIZE,"\002\032\f%c",TXT_TTS); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1080 GFX_write_string(&FontT42,tXc1,text,0); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1081 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
|
1082 { |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1083 if(pDecoinfo->output_time_to_surface_seconds < 100 * 60) |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1084 snprintf(text,TEXTSIZE,"\020\003\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1085 else |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1086 snprintf(text,TEXTSIZE,"\020\003\002%ih",(pDecoinfo->output_time_to_surface_seconds + 59)/ 3600); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1087 t3_basics_colorscheme_mod(text); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1088 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
|
1089 } |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1090 } |
38 | 1091 break; |
1092 | |
1093 case CVIEW_sensors: | |
1094 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_O2monitor); | |
1095 GFX_write_string(&FontT42,tXc1,text,0); | |
1096 | |
1097 for(int i=0;i<3;i++) | |
1098 { | |
1099 textpointer = 0; | |
1100 text[textpointer++] = '\030'; | |
1101 if(i==1) | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1102 text[textpointer++] = '\001'; /* center */ |
38 | 1103 else if(i==2) |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1104 text[textpointer++] = '\002'; /* right */ |
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1105 |
577
9bb9a52d6ae5
Handle o2 voltage values < 0.5mV as invalid:
Ideenmodellierer
parents:
564
diff
changeset
|
1106 if((stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) || (stateUsed->lifeData.ppO2Sensor_bar[i] == 0.0)) |
38 | 1107 { |
1108 text[textpointer++] = '\031'; | |
1109 text[textpointer++] = ' '; | |
1110 text[textpointer++] = '-'; | |
1111 text[textpointer++] = ' '; | |
1112 } | |
1113 else | |
1114 { | |
1115 if(stateUsed->warnings.sensorOutOfBounds[i]) | |
1116 text[textpointer++] = '\025'; | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1117 textpointer += snprintf(&text[textpointer],TEXTSIZE,"%.2f",stateUsed->lifeData.ppO2Sensor_bar[i]); |
38 | 1118 } |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1119 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1120 } |
1121 break; | |
1122 | |
1123 case CVIEW_T3_MaxDepth: | |
1124 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
413 | 1125 if(pSettings->FlipDisplay) |
1126 { | |
1127 if(mode == DIVEMODE_Apnea) | |
1128 { | |
1129 GFX_write_string(&FontT42,tXc2,text,0); | |
1130 } | |
1131 else | |
1132 { | |
1133 GFX_write_string(&FontT42,tXc1,text,0); | |
1134 } | |
1135 } | |
1136 else | |
1137 { | |
1138 GFX_write_string(&FontT42,tXc1,text,0); | |
1139 } | |
38 | 1140 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); |
1141 t3_basics_colorscheme_mod(text); | |
413 | 1142 if(pSettings->FlipDisplay) |
1143 { | |
1144 if(mode == DIVEMODE_Apnea) | |
1145 { | |
1146 GFX_write_string(&FontT105,tXc2,text,0); | |
1147 } | |
1148 else | |
1149 { | |
1150 GFX_write_string(&FontT105,tXc1,text,0); | |
1151 } | |
1152 } | |
1153 else | |
1154 { | |
496 | 1155 GFX_write_string(&FontT105,tXc1,text,0); |
413 | 1156 } |
38 | 1157 break; |
1158 | |
1159 case CVIEW_T3_TTS: | |
1160 snprintf(text,TEXTSIZE,"\032\f%c",TXT_TTS); | |
1161 GFX_write_string(&FontT42,tXc1,text,0); | |
1162 if(pDecoinfo->output_time_to_surface_seconds) | |
1163 { | |
1164 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
|
1165 snprintf(text,TEXTSIZE,"\020\003\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60); |
38 | 1166 else |
214
51a3aeffc6b3
Bugfix: handle rounding of TTS and future TTS consistently
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1167 snprintf(text,TEXTSIZE,"\020\003\002%ih",(pDecoinfo->output_time_to_surface_seconds + 59)/ 3600); |
38 | 1168 t3_basics_colorscheme_mod(text); |
496 | 1169 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1170 } |
1171 break; | |
1172 | |
1173 case CVIEW_T3_ppO2andGas: | |
1174 snprintf(text,TEXTSIZE,"\032\f%c",TXT_ppO2); | |
1175 GFX_write_string(&FontT42,tXc1,text,0); | |
1176 snprintf(text,TEXTSIZE,"\020\003%01.2f",stateUsed->lifeData.ppO2); | |
1177 t3_basics_colorscheme_mod(text); | |
496 | 1178 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1179 |
1180 textpointer = 0; | |
1181 text[textpointer++] = '\020'; | |
1182 text[textpointer++] = '\003'; | |
1183 oxygen_percentage = 100; | |
1184 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage; | |
1185 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage; | |
1186 text[textpointer++] = '\002'; | |
1187 tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&text[textpointer]); | |
1188 //textpointer = snprintf(&text[textpointer],TEXTSIZE,"\020\002%02u/%02u",oxygen_percentage, stateUsed->lifeData.actualGas.helium_percentage); | |
1189 t3_basics_colorscheme_mod(text); | |
496 | 1190 GFX_write_string(&FontT48,tXc1,text,0); |
38 | 1191 break; |
496 | 1192 |
1193 case CVIEW_T3_Navigation: | |
1194 Stopwatch.Total = timer_Stopwatch_GetTime(); | |
1195 Stopwatch.Minutes = Stopwatch.Total / 60; | |
1196 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
1197 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
1198 | |
1199 if(!pSettings->FlipDisplay) | |
1200 { | |
1201 tXc2->WindowX0 = 550; | |
1202 } | |
1203 else | |
1204 { | |
1205 tXc2->WindowX1 = 800; | |
1206 tXc2->WindowY0 = t3c2.WindowY0; /* select customer window */ | |
1207 } | |
1208 | |
1209 snprintf(text,TEXTSIZE,"\032\002\f%c", TXT_Stopwatch); | |
511 | 1210 GFX_write_string(&FontT42,tXc1,text,0); |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1211 snprintf(text,TEXTSIZE,"\030\002\016%01.1f",unit_depth_float(fAverageDepth)); |
511 | 1212 GFX_write_string(&FontT105,tXc1,text,0); |
496 | 1213 if(!pSettings->FlipDisplay) |
1214 { | |
1215 tXc2->WindowY0 = 100; | |
1216 } | |
1217 else | |
1218 { | |
1219 tXc2->WindowY1 -= 100; /* jump to upper of two lines */ | |
1220 } | |
1221 | |
1222 snprintf(text,TEXTSIZE,"\030\002%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); | |
511 | 1223 GFX_write_string(&FontT105,tXc1,text,1); |
496 | 1224 |
1225 | |
1226 center.x = 400; | |
1227 center.y = 116; | |
1228 | |
1229 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); | |
1230 GFX_write_string(&FontT42,tXc1,text,0); | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1231 snprintf(text,100,"\030%03i`",heading); |
496 | 1232 GFX_write_string(&FontT144,tXc1,text,0); |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1233 t3_basics_compass(tXscreen, center, heading, stateUsed->diveSettings.compassHeading); |
496 | 1234 |
1235 break; | |
1236 | |
1237 case CVIEW_T3_DepthData: | |
1238 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
1239 if(pSettings->FlipDisplay) | |
1240 { | |
1241 if(mode == DIVEMODE_Apnea) | |
1242 { | |
1243 GFX_write_string(&FontT42,tXc2,text,0); | |
1244 } | |
1245 else | |
1246 { | |
1247 GFX_write_string(&FontT42,tXc1,text,0); | |
1248 } | |
1249 } | |
1250 else | |
1251 { | |
1252 GFX_write_string(&FontT42,tXc1,text,0); | |
1253 } | |
1254 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
1255 t3_basics_colorscheme_mod(text); | |
1256 if(pSettings->FlipDisplay) | |
1257 { | |
1258 if(mode == DIVEMODE_Apnea) | |
1259 { | |
1260 GFX_write_string(&FontT105,tXc2,text,0); | |
1261 } | |
1262 else | |
1263 { | |
1264 GFX_write_string(&FontT105,tXc1,text,0); | |
1265 } | |
1266 } | |
1267 else | |
1268 { | |
1269 GFX_write_string(&FontT105,tXc1,text,0); | |
1270 } | |
1271 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
1272 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_AvgDepth); | |
511 | 1273 GFX_write_string(&FontT42,tXc1,text,0); |
496 | 1274 |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1275 snprintf(text,TEXTSIZE,"\020\003\002\016\%01.1f",unit_depth_float(fAverageDepthAbsolute)); |
511 | 1276 GFX_write_string(&FontT105,tXc1,text,0); |
496 | 1277 break; |
38 | 1278 } |
496 | 1279 |
1280 | |
1281 | |
38 | 1282 tXc1->WindowX0 = tempWinX0; |
1283 tXc1->WindowY0 = tempWinY0; | |
496 | 1284 tXc1->WindowX1 = tempWinX1; |
1285 tXc1->WindowY1 = tempWinY1; | |
413 | 1286 |
38 | 1287 tXc2->WindowX0 = tempWinC2X0; |
413 | 1288 tXc2->WindowY0 = tempWinC2Y0; |
1289 tXc2->WindowX1 = tempWinC2X1; | |
1290 tXc2->WindowY1 = tempWinC2Y1; | |
38 | 1291 tXc2->WindowTab = tempWinC2Tab; |
1292 } | |
1293 | |
1294 | |
1295 uint8_t t3_test_customview_warnings(void) | |
1296 { | |
1297 uint8_t count = 0; | |
1298 | |
1299 count = 0; | |
1300 count += stateUsed->warnings.decoMissed; | |
1301 count += stateUsed->warnings.ppO2Low; | |
1302 count += stateUsed->warnings.ppO2High; | |
1303 //count += stateUsed->warnings.lowBattery; | |
1304 count += stateUsed->warnings.sensorLinkLost; | |
1305 count += stateUsed->warnings.fallback; | |
1306 | |
1307 return count; | |
1308 } | |
1309 | |
1310 //void t3_show_customview_warnings(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode) | |
1311 void t3_basics_show_customview_warnings(GFX_DrawCfgWindow* tXc1) | |
1312 { | |
1313 char text[256], textMain[256]; | |
1314 uint8_t textpointer, textpointerMain, lineFree, more; | |
1315 | |
1316 snprintf(text,TEXTSIZE,"\025\f%c",TXT_Warning); | |
1317 GFX_write_string(&FontT42,&t3c1,text,0); | |
1318 | |
1319 lineFree = 1; | |
1320 more = 0; | |
1321 | |
1322 textpointerMain = 0; | |
511 | 1323 textMain[textpointerMain++] = '\025'; /* red */ |
1324 textMain[textpointerMain++] = '\003'; /* doublesize */ | |
38 | 1325 |
1326 textpointer = 0; | |
1327 | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1328 text[textpointer++] = '\031'; |
38 | 1329 text[textpointer++] = TXT_2BYTE; |
1330 text[textpointer++] = TXT2BYTE_WarnDecoMissed; | |
1331 if(stateUsed->warnings.decoMissed) | |
1332 { | |
1333 text[textpointer - 3] = '\025'; | |
1334 if(lineFree) | |
1335 { | |
1336 textMain[textpointerMain++] = TXT_2BYTE; | |
1337 textMain[textpointerMain++] = text[textpointer - 1]; | |
1338 textMain[textpointerMain] = 0; | |
1339 lineFree--; | |
1340 } | |
1341 else | |
1342 { | |
1343 more++; | |
1344 } | |
1345 } | |
1346 | |
1347 text[textpointer++] = '\t'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1348 text[textpointer++] = '\031'; |
38 | 1349 text[textpointer++] = TXT_2BYTE; |
1350 text[textpointer++] = TXT2BYTE_WarnPPO2Low; | |
1351 if(stateUsed->warnings.ppO2Low) | |
1352 { | |
1353 text[textpointer - 3] = '\025'; | |
1354 if(lineFree) | |
1355 { | |
1356 textMain[textpointerMain++] = TXT_2BYTE; | |
1357 textMain[textpointerMain++] = text[textpointer - 1]; | |
1358 textMain[textpointerMain] = 0; | |
1359 lineFree--; | |
1360 } | |
1361 else | |
1362 { | |
1363 more++; | |
1364 } | |
1365 } | |
1366 | |
1367 text[textpointer++] = '\n'; | |
1368 text[textpointer++] = '\r'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1369 text[textpointer++] = '\031'; |
38 | 1370 text[textpointer++] = TXT_2BYTE; |
1371 text[textpointer++] = TXT2BYTE_WarnPPO2High; | |
1372 if(stateUsed->warnings.ppO2High) | |
1373 { | |
1374 text[textpointer - 3] = '\025'; | |
1375 if(lineFree) | |
1376 { | |
1377 textMain[textpointerMain++] = TXT_2BYTE; | |
1378 textMain[textpointerMain++] = text[textpointer - 1]; | |
1379 textMain[textpointerMain] = 0; | |
1380 lineFree--; | |
1381 } | |
1382 else | |
1383 { | |
1384 more++; | |
1385 } | |
1386 } | |
1387 | |
1388 text[textpointer++] = '\t'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1389 text[textpointer++] = '\031'; |
38 | 1390 text[textpointer++] = TXT_2BYTE; |
1391 text[textpointer++] = TXT2BYTE_WarnFallback; | |
1392 if(stateUsed->warnings.fallback) | |
1393 { | |
1394 text[textpointer - 3] = '\025'; | |
1395 if(lineFree) | |
1396 { | |
1397 textMain[textpointerMain++] = TXT_2BYTE; | |
1398 textMain[textpointerMain++] = text[textpointer - 1]; | |
1399 textMain[textpointerMain] = 0; | |
1400 lineFree--; | |
1401 } | |
1402 else | |
1403 { | |
1404 more++; | |
1405 } | |
1406 } | |
1407 | |
1408 text[textpointer++] = '\n'; | |
1409 text[textpointer++] = '\r'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1410 text[textpointer++] = '\031'; |
38 | 1411 text[textpointer++] = TXT_2BYTE; |
1412 text[textpointer++] = TXT2BYTE_WarnSensorLinkLost; | |
1413 if(stateUsed->warnings.sensorLinkLost) | |
1414 { | |
1415 text[textpointer - 3] = '\025'; | |
1416 if(lineFree) | |
1417 { | |
1418 textMain[textpointerMain++] = TXT_2BYTE; | |
1419 textMain[textpointerMain++] = text[textpointer - 1]; | |
1420 textMain[textpointerMain] = 0; | |
1421 lineFree--; | |
1422 } | |
1423 else | |
1424 { | |
1425 more++; | |
1426 } | |
1427 } | |
1428 | |
1429 /* | |
1430 text[textpointer++] = '\t'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1431 text[textpointer++] = '\031'; |
38 | 1432 text[textpointer++] = TXT_2BYTE; |
1433 text[textpointer++] = TXT2BYTE_WarnBatteryLow; | |
1434 if(stateUsed->warnings.lowBattery) | |
1435 { | |
1436 text[textpointer - 3] = '\025'; | |
1437 if(lineFree) | |
1438 { | |
1439 textMain[textpointerMain++] = TXT_2BYTE; | |
1440 textMain[textpointerMain++] = text[textpointer - 1]; | |
1441 textMain[textpointerMain] = 0; | |
1442 lineFree--; | |
1443 } | |
1444 else | |
1445 { | |
1446 more++; | |
1447 } | |
1448 } | |
1449 */ | |
1450 text[textpointer] = 0; | |
1451 /* | |
1452 if(more) | |
1453 { | |
1454 text[textpointer++] = '\002'; | |
1455 text[textpointer++] = '+'; | |
1456 if(more < 10) | |
1457 text[textpointer++] = '0' + more; | |
1458 else | |
1459 text[textpointer++] = 'X'; | |
1460 text[textpointer] = 0; | |
1461 } | |
1462 */ | |
511 | 1463 GFX_write_string(&FontT48,&t3c1,textMain,0); |
38 | 1464 if(more) |
1465 { | |
511 | 1466 GFX_write_string(&FontT48,&t3c2,text,0); |
38 | 1467 } |
1468 } | |
1469 | |
496 | 1470 uint8_t t3_customview_disabled(uint8_t view) |
1471 { | |
1472 uint8_t i = 0; | |
1473 uint8_t cv_disabled = 0; | |
1474 const uint8_t *pcv_changelist; | |
1475 uint32_t cv_config = settingsGetPointer()->cv_config_BigScreen; | |
1476 | |
511 | 1477 pcv_changelist = cv_changelist_BS; |
496 | 1478 |
1479 while(pcv_changelist[i] != CVIEW_T3_END) | |
1480 { | |
1481 if((view == pcv_changelist[i]) && !CHECK_BIT_THOME(cv_config, pcv_changelist[i])) | |
1482 { | |
1483 cv_disabled = 1; | |
1484 break; | |
1485 } | |
1486 i++; | |
1487 } | |
1488 | |
1489 if (((view == CVIEW_sensors) || (view == CVIEW_sensors_mV)) && | |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
1490 ((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0) || stateUsed->warnings.fallback)) |
496 | 1491 { |
1492 cv_disabled = 1; | |
1493 } | |
1494 | |
1495 return cv_disabled; | |
1496 } | |
38 | 1497 |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
1498 uint8_t t3_change_customview(uint8_t action) |
38 | 1499 { |
511 | 1500 |
496 | 1501 t3_basics_change_customview(&t3_selection_customview, t3_customviewsStandard, action); |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
1502 return t3_selection_customview; |
38 | 1503 } |
1504 | |
1505 | |
511 | 1506 void t3_basics_change_customview(uint8_t *tX_selection_customview,const uint8_t *tX_customviews, uint8_t action) |
38 | 1507 { |
1508 const SDecoinfo * pDecoinfo; | |
1509 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
1510 pDecoinfo = &stateUsed->decolistBuehlmann; | |
1511 else | |
1512 pDecoinfo = &stateUsed->decolistVPM; | |
1513 | |
511 | 1514 uint8_t curViewIdx = 0xff; |
1515 uint8_t index = 0; | |
1516 uint8_t lastViewIdx = 0; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1517 uint8_t iterate = 0; /* set to 1 if a view has to be skipped */ |
38 | 1518 |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1519 /* set pointer to currently selected view and count number of entries */ |
511 | 1520 while((tX_customviews[index] != CVIEW_T3_END)) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1521 { |
511 | 1522 if (tX_customviews[index] == *tX_selection_customview) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1523 { |
511 | 1524 curViewIdx = index; |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1525 } |
511 | 1526 index++; |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1527 } |
511 | 1528 if(curViewIdx == 0xff) /* called with unknown view */ |
496 | 1529 { |
511 | 1530 curViewIdx = 0; |
1531 *tX_selection_customview = tX_customviews[index]; | |
496 | 1532 } |
511 | 1533 lastViewIdx = index; |
1534 index = curViewIdx; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1535 do |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1536 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1537 iterate = 0; |
496 | 1538 switch(action) |
1539 { | |
1540 case ACTION_BUTTON_ENTER: | |
1541 case ACTION_PITCH_POS: | |
1542 | |
511 | 1543 if(tX_customviews[index] != CVIEW_T3_END) |
496 | 1544 { |
511 | 1545 index++; |
1546 } | |
1547 if(tX_customviews[index] == CVIEW_T3_END) | |
1548 { | |
1549 index = 0; | |
496 | 1550 } |
1551 break; | |
1552 case ACTION_PITCH_NEG: | |
511 | 1553 if(index == 0) |
496 | 1554 { |
511 | 1555 index = lastViewIdx - 1; |
496 | 1556 } |
1557 else | |
1558 { | |
511 | 1559 index--; |
496 | 1560 } |
1561 break; | |
1562 default: | |
1563 break; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1564 } |
496 | 1565 |
511 | 1566 if(t3_customview_disabled(tX_customviews[index])) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1567 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1568 iterate = 1; |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1569 } |
529
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1570 if((tX_customviews[index] == CVIEW_T3_TTS) && !pDecoinfo->output_time_to_surface_seconds) /* Skip TTS if value is 0 */ |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1571 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1572 iterate = 1; |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1573 } |
529
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1574 if((tX_customviews[index] == CVIEW_T3_Decostop) && ((!pDecoinfo->output_ndl_seconds) && (!pDecoinfo->output_time_to_surface_seconds) && (timer_Safetystop_GetCountDown() == 0))) /* Skip Deco if NDL is not set */ |
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1575 { |
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1576 iterate = 1; |
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1577 } |
496 | 1578 if((iterate) && (action == ACTION_END)) |
1579 { | |
1580 action = ACTION_BUTTON_ENTER; | |
1581 } | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1582 }while (iterate == 1); |
38 | 1583 |
511 | 1584 *tX_selection_customview = tX_customviews[index]; |
38 | 1585 } |
1586 | |
1587 | |
1588 void t3_basics_colorscheme_mod(char *text) | |
1589 { | |
1590 if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard()) | |
1591 { | |
1592 text[0] = '\027'; | |
1593 } | |
1594 } | |
1595 | |
1596 | |
496 | 1597 point_t t3_compass_circle(uint8_t id, uint16_t degree, point_t center) |
38 | 1598 { |
1599 float fCos, fSin; | |
1600 const float piMult = ((2 * 3.14159) / 360); | |
1601 // const int radius[4] = {95,105,115,60}; | |
1602 const int radius[4] = {85,95,105,90}; | |
496 | 1603 static point_t forcenter = {.x = 900, .y = 500}; /* used to identify change of circle position */ |
38 | 1604 static point_t r[4][360] = { 0 }; |
1605 | |
496 | 1606 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 | 1607 { |
1608 for(int i=0;i<360;i++) | |
1609 { | |
1610 fCos = cos(i * piMult); | |
1611 fSin = sin(i * piMult); | |
1612 for(int j=0;j<4;j++) | |
1613 { | |
496 | 1614 r[j][i].x = center.x + (int)(fSin * radius[j]); |
1615 r[j][i].y = center.y + (int)(fCos * radius[j]); | |
38 | 1616 } |
1617 } | |
496 | 1618 forcenter.x = center.x; |
1619 forcenter.y = center.y; | |
38 | 1620 } |
1621 if(id > 3) id = 0; | |
1622 if(degree > 359) degree = 0; | |
1623 return r[id][degree]; | |
1624 } | |
1625 | |
1626 | |
496 | 1627 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, point_t center, uint16_t ActualHeading, uint16_t UserSetHeading) |
38 | 1628 { |
496 | 1629 uint8_t loop = 0; |
38 | 1630 uint16_t LineHeading; |
496 | 1631 |
38 | 1632 static int32_t LastHeading = 0; |
1633 int32_t newHeading = 0; | |
1634 int32_t diff = 0; | |
1635 int32_t diff2 = 0; | |
1636 | |
1637 int32_t diffAbs = 0; | |
1638 int32_t diffAbs2 = 0; | |
1639 | |
1640 newHeading = ActualHeading; | |
1641 | |
1642 diff = newHeading - LastHeading; | |
1643 | |
1644 if(newHeading < LastHeading) | |
1645 diff2 = newHeading + 360 - LastHeading; | |
1646 else | |
1647 diff2 = newHeading - 360 - LastHeading; | |
1648 | |
1649 diffAbs = diff; | |
1650 if(diffAbs < 0) | |
1651 diffAbs *= -1; | |
1652 | |
1653 diffAbs2 = diff2; | |
1654 if(diffAbs2 < 0) | |
1655 diffAbs2 *= -1; | |
1656 | |
1657 if(diffAbs <= diffAbs2) | |
1658 newHeading = LastHeading + (diff / 2); | |
1659 else | |
1660 newHeading = LastHeading + (diff2 / 2); | |
1661 | |
1662 if(newHeading < 0) | |
1663 newHeading += 360; | |
1664 else | |
1665 if(newHeading >= 360) | |
1666 newHeading -= 360; | |
1667 | |
1668 LastHeading = newHeading; | |
1669 ActualHeading = newHeading; | |
1670 | |
1671 if (ActualHeading < 90) | |
1672 ActualHeading += 360; | |
1673 | |
1674 while(ActualHeading > 359) ActualHeading -= 360; | |
1675 | |
1676 LineHeading = 360 - ActualHeading; | |
496 | 1677 |
1678 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font030); // North | |
38 | 1679 LineHeading += 90; |
496 | 1680 |
1681 for (loop = 0; loop < 3; loop++) | |
1682 { | |
1683 if(LineHeading > 359) LineHeading -= 360; | |
1684 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Main Ticks | |
1685 LineHeading += 90; | |
1686 } | |
38 | 1687 |
1688 LineHeading = 360 - ActualHeading; | |
1689 LineHeading += 45; | |
496 | 1690 |
1691 for (loop = 0; loop < 4; loop++) | |
1692 { | |
1693 if(LineHeading > 359) LineHeading -= 360; | |
1694 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Subtick | |
1695 LineHeading += 90; | |
1696 } | |
38 | 1697 |
1698 LineHeading = 360 - ActualHeading; | |
1699 LineHeading += 22; | |
496 | 1700 for (loop = 0; loop < 8; loop++) |
1701 { | |
1702 if(LineHeading > 359) LineHeading -= 360; | |
1703 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Subtick | |
1704 LineHeading += 45; | |
1705 } | |
38 | 1706 if(UserSetHeading) |
1707 { | |
1708 LineHeading = UserSetHeading + 360 - ActualHeading; | |
1709 if(LineHeading > 359) LineHeading -= 360; | |
496 | 1710 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_CompassUserHeadingTick); |
38 | 1711 |
1712 // R�ckpeilung, User Back Heading | |
1713 LineHeading = UserSetHeading + 360 + 180 - ActualHeading; | |
1714 if(LineHeading > 359) LineHeading -= 360; | |
1715 if(LineHeading > 359) LineHeading -= 360; | |
496 | 1716 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_CompassUserBackHeadingTick); |
38 | 1717 } |
1718 | |
1719 GFX_draw_circle(tXscreen, center, 106, CLUT_Font030); | |
1720 GFX_draw_circle(tXscreen, center, 107, CLUT_Font030); | |
1721 GFX_draw_circle(tXscreen, center, 108, CLUT_Font030); | |
1722 } | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1723 |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1724 uint8_t t3_GetEnabled_customviews() |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1725 { |
496 | 1726 uint8_t *pViews; |
1727 uint8_t increment = 1; | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1728 uint8_t enabledViewCnt = 0; |
496 | 1729 |
511 | 1730 pViews = (uint8_t*)t3_customviewsStandard; |
496 | 1731 while((*pViews != CVIEW_T3_END)) |
1732 { | |
1733 increment = 1; | |
1734 /* check if view is enabled */ | |
1735 if(t3_customview_disabled(*pViews)) | |
1736 { | |
1737 increment = 0; | |
1738 } | |
1739 pViews++; | |
1740 enabledViewCnt += increment; | |
1741 } | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1742 return enabledViewCnt; |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1743 } |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1744 |
518 | 1745 uint8_t t3_getCustomView(void) |
1746 { | |
1747 return t3_selection_customview; | |
1748 } |