Mercurial > public > ostc4
annotate Discovery/Src/t7.c @ 184:8117802894a4 Cleanup_Compass_Wireless
Cleanup compiler warnings
author | ideenmodellierer |
---|---|
date | Thu, 14 Mar 2019 20:44:23 +0100 |
parents | ecb71521d004 |
children | d36596281501 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/t7.c | |
5 /// \brief Main Template file for dive mode 7x | |
6 /// \author Heinrichs Weikamp gmbh | |
7 /// \date 23-April-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 "t7.h" | |
31 | |
32 #include "data_exchange_main.h" | |
33 #include "decom.h" | |
34 #include "gfx_fonts.h" | |
35 #include "logbook_miniLive.h" | |
36 #include "math.h" | |
37 #include "tHome.h" | |
38 #include "simulation.h" | |
39 #include "timer.h" | |
40 #include "unit.h" | |
41 | |
42 /* Private function prototypes -----------------------------------------------*/ | |
43 | |
44 void t7_refresh_surface(void); | |
45 void t7_refresh_surface_debugmode(void); | |
46 void t7_refresh_divemode(void); | |
47 void t7_refresh_sleep_design_fun(void); | |
48 void t7_refresh_divemode_userselected_left_lower_corner(void); | |
49 void t7_refresh_customview(void); | |
50 | |
51 void draw_frame(_Bool PluginBoxHeader, _Bool LinesOnTheSides, uint8_t colorBox, uint8_t colorLinesOnTheSide); | |
52 | |
53 void t7_tissues(const SDiveState * pState); | |
54 void t7_compass(uint16_t ActualHeading, uint16_t UserSetHeading); | |
55 void t7_SummaryOfLeftCorner(void); | |
56 void t7_debug(void); | |
57 | |
58 void t7_miniLiveLogProfile(void); | |
59 //void t7_clock(void); | |
60 void t7_logo_OSTC(void); | |
61 void t7_colorscheme_mod(char *text); | |
62 | |
63 uint8_t t7_test_customview_warnings(void); | |
64 void t7_show_customview_warnings(void); | |
65 | |
66 uint8_t t7_test_customview_warnings_surface_mode(void); | |
67 void t7_show_customview_warnings_surface_mode(void); | |
68 | |
69 uint8_t t7_customtextPrepare(char * text); | |
70 | |
71 /* Importend function prototypes ---------------------------------------------*/ | |
72 extern uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium); | |
73 | |
74 /* Exported variables --------------------------------------------------------*/ | |
75 | |
76 /* Private variables ---------------------------------------------------------*/ | |
77 float depthLastCall[9] = { 0,0,0,0,0,0,0,0,0}; | |
78 uint8_t idDepthLastCall = 0; | |
79 float temperatureLastCall[3] = { 0,0,0}; | |
80 uint8_t idTemperatureLastCall = 0; | |
81 | |
82 GFX_DrawCfgScreen t7screen; | |
83 GFX_DrawCfgScreen t7screenCompass; | |
84 | |
85 /* left 3 fields | |
86 * right 3 fields | |
87 * centered one field on top of customview, one below | |
88 * customview header + customview + warning | |
89 */ | |
90 GFX_DrawCfgWindow t7l1, t7l2, t7l3; | |
91 GFX_DrawCfgWindow t7r1, t7r2, t7r3; | |
92 GFX_DrawCfgWindow t7c1, t7batt, t7c2, t7charge, t7voltage; | |
93 GFX_DrawCfgWindow t7cH, t7cC, t7cW, t7cY0free; | |
94 GFX_DrawCfgWindow t7pCompass; | |
95 GFX_DrawCfgWindow t7surfaceL, t7surfaceR; | |
96 | |
97 uint8_t selection_custom_field = 1; | |
98 uint8_t selection_customview = 1; | |
99 | |
100 uint8_t updateNecessary = 0; | |
101 | |
102 typedef struct{ | |
103 uint32_t pointer; | |
104 uint32_t x0; | |
105 uint32_t y0; | |
106 uint32_t width; | |
107 uint32_t height; | |
108 } SBackground; | |
109 | |
110 SBackground background = | |
111 { | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
112 .pointer = 0, |
38 | 113 }; |
114 | |
115 | |
116 /* Private types -------------------------------------------------------------*/ | |
117 const uint8_t customviewsDiveStandard[] = | |
118 { | |
119 CVIEW_sensors, | |
120 CVIEW_Compass, | |
121 CVIEW_Decolist, | |
122 CVIEW_Tissues, | |
123 CVIEW_Profile, | |
124 CVIEW_Gaslist, | |
125 CVIEW_sensors_mV, | |
126 CVIEW_EADTime, | |
127 CVIEW_SummaryOfLeftCorner, | |
128 CVIEW_noneOrDebug, | |
129 CVIEW_END, | |
130 CVIEW_END | |
131 }; | |
132 | |
133 const uint8_t customviewsSurfaceStandard[] = | |
134 { | |
135 // CVIEW_CompassDebug, | |
136 CVIEW_Hello, | |
137 CVIEW_sensors, | |
138 CVIEW_Compass, | |
139 CVIEW_Tissues, | |
140 CVIEW_sensors_mV, | |
141 CVIEW_END, | |
142 CVIEW_END | |
143 }; | |
144 | |
145 const uint8_t *customviewsDive = customviewsDiveStandard; | |
146 const uint8_t *customviewsSurface = customviewsSurfaceStandard; | |
147 | |
148 #define TEXTSIZE 16 | |
149 /* offset includes line: 2 = line +1 | |
150 * box (line) is 300 px | |
151 * inside is 296 px | |
152 * left of box are 249 px ( 0..248) | |
153 * right of box are 249 px (551 .. 799) | |
154 */ | |
155 | |
156 #define CUSTOMBOX_LINE_LEFT (250) | |
157 #define CUSTOMBOX_LINE_RIGHT (549) | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
158 #define CUSTOMBOX_LINE_TOP (0) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
159 #define CUSTOMBOX_LINE_MIDDLE (142) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
160 #define CUSTOMBOX_LINE_BOTTOM (318) |
38 | 161 #define CUSTOMBOX_INSIDE_OFFSET (2) |
162 #define CUSTOMBOX_OUTSIDE_OFFSET (2) | |
163 #define CUSTOMBOX_SPACE_INSIDE (CUSTOMBOX_LINE_RIGHT + 1 - (CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + CUSTOMBOX_INSIDE_OFFSET)) | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
164 #define TOP_LINE_HIGHT (25) |
38 | 165 |
166 /* Exported functions --------------------------------------------------------*/ | |
167 | |
168 void t7_init(void) | |
169 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
170 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
171 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
172 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
173 |
38 | 174 selection_custom_field = 1; |
175 selection_customview = customviewsSurface[0]; | |
176 | |
177 t7screen.FBStartAdress = 0; | |
178 t7screen.ImageHeight = 480; | |
179 t7screen.ImageWidth = 800; | |
180 t7screen.LayerIndex = 1; | |
181 | |
182 t7screenCompass.FBStartAdress = 0; | |
183 t7screenCompass.ImageHeight = 240; | |
184 t7screenCompass.ImageWidth = 1600; | |
185 t7screenCompass.LayerIndex = 0; | |
186 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
187 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
188 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
189 t7l1.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
190 t7l1.WindowNumberOfTextLines = 2; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
191 t7l1.WindowLineSpacing = 19; // Abstand von Y0 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
192 t7l1.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
193 t7l1.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
194 t7l1.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
195 t7l1.WindowY0 = 318; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
196 t7l1.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
197 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
198 t7l2.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
199 t7l2.WindowNumberOfTextLines = 2; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
200 t7l2.WindowLineSpacing = 22; // Abstand von Y0 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
201 t7l2.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
202 t7l2.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
203 t7l2.WindowX1 = t7l1.WindowX1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
204 t7l2.WindowY0 = 142; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
205 t7l2.WindowY1 = t7l1.WindowY0 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
206 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
207 t7l3.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
208 t7l3.WindowNumberOfTextLines = 2; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
209 t7l3.WindowLineSpacing = 58; // Abstand von Y0 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
210 t7l3.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
211 t7l3.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
212 t7l3.WindowX1 = t7l1.WindowX1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
213 t7l3.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
214 t7l3.WindowY1 = t7l2.WindowY0 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
215 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
216 t7r1.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
217 t7r1.WindowNumberOfTextLines = 2; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
218 t7r1.WindowLineSpacing = t7l1.WindowLineSpacing; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
219 t7r1.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
220 t7r1.WindowX0 = 550; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
221 t7r1.WindowX1 = 799; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
222 t7r1.WindowY0 = t7l1.WindowY0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
223 t7r1.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
224 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
225 t7r2.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
226 t7r2.WindowNumberOfTextLines = 2; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
227 t7r2.WindowLineSpacing = t7l2.WindowLineSpacing; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
228 t7r2.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
229 t7r2.WindowX0 = 550; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
230 t7r2.WindowX1 = 799; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
231 t7r2.WindowY0 = t7l2.WindowY0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
232 t7r2.WindowY1 = t7l2.WindowY1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
233 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
234 t7r3.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
235 t7r3.WindowNumberOfTextLines = 2; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
236 t7r3.WindowLineSpacing = 0;//t7l3.WindowLineSpacing; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
237 t7r3.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
238 t7r3.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
239 t7r3.WindowX1 = 799; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
240 t7r3.WindowY0 = t7l3.WindowY0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
241 t7r3.WindowY1 = t7l3.WindowY1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
242 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
243 t7cC.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
244 t7cC.WindowNumberOfTextLines = 3; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
245 t7cC.WindowLineSpacing = 95; // Abstand von Y0 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
246 t7cC.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
247 t7cC.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
248 t7cC.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
249 t7cC.WindowY0 = 90; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
250 t7cC.WindowY1 = 434 - 95; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
251 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
252 t7cH.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
253 t7cH.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
254 t7cH.WindowLineSpacing = 95; // Abstand von Y0 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
255 t7cH.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
256 t7cH.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
257 t7cH.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
258 t7cH.WindowY0 = 434 - 94; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
259 t7cH.WindowY1 = 434; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
260 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
261 t7cW.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
262 t7cW.WindowNumberOfTextLines = 3; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
263 t7cW.WindowLineSpacing = 95; // Abstand von Y0 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
264 t7cW.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
265 t7cW.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
266 t7cW.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
267 t7cW.WindowY0 = 90; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
268 t7cW.WindowY1 = 434 - 95; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
269 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
270 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
271 t7surfaceL.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
272 t7surfaceL.WindowNumberOfTextLines = 9; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
273 t7surfaceL.WindowLineSpacing = 53; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
274 t7surfaceL.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
275 t7surfaceL.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
276 t7surfaceL.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
277 t7surfaceL.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
278 t7surfaceL.WindowY1 = 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
279 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
280 t7surfaceR.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
281 t7surfaceR.WindowNumberOfTextLines = 9; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
282 t7surfaceR.WindowLineSpacing = 53; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
283 t7surfaceR.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
284 t7surfaceR.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
285 t7surfaceR.WindowX1 = 800; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
286 t7surfaceR.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
287 t7surfaceR.WindowY1 = 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
288 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
289 t7cY0free.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
290 t7cY0free.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
291 t7cY0free.WindowLineSpacing = 95; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
292 t7cY0free.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
293 t7cY0free.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
294 t7cY0free.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
295 t7cY0free.WindowY0 = 90; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
296 t7cY0free.WindowY1 = 434 - 95; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
297 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
298 t7batt.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
299 t7batt.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
300 t7batt.WindowLineSpacing = 10; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
301 t7batt.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
302 t7batt.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
303 t7batt.WindowX0 = t7batt.WindowX1 - (52+52); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
304 t7batt.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
305 t7batt.WindowY0 = t7batt.WindowY1 - 25; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
306 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
307 t7charge.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
308 t7charge.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
309 t7charge.WindowLineSpacing = 10; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
310 t7charge.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
311 t7charge.WindowX1 = t7batt.WindowX1 - 18; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
312 t7charge.WindowX0 = t7charge.WindowX1 - 14; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
313 t7charge.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
314 t7charge.WindowY0 = t7batt.WindowY1 - 25; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
315 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
316 t7voltage.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
317 t7voltage.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
318 t7voltage.WindowLineSpacing = 10; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
319 t7voltage.WindowTab = 100; |
145 | 320 t7voltage.WindowX0 = t7charge.WindowX0 - 10; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
321 t7voltage.WindowX1 = t7voltage.WindowX0 + (18*3)+ 9; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
322 t7voltage.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
323 t7voltage.WindowY0 = t7batt.WindowY1 - 25; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
324 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
325 t7c1.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
326 t7c1.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
327 t7c1.WindowLineSpacing = 10; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
328 t7c1.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
329 t7c1.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
330 t7c1.WindowX1 = t7batt.WindowX0 - 18; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
331 t7c1.WindowY0 = 435; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
332 t7c1.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
333 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
334 t7c2.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
335 t7c2.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
336 t7c2.WindowLineSpacing = 0; // Abstand von Y0 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
337 t7c2.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
338 t7c2.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
339 t7c2.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
340 t7c2.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
341 t7c2.WindowY1 = 69; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
342 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
343 t7pCompass.Image = &t7screenCompass; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
344 t7pCompass.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
345 t7pCompass.WindowLineSpacing = 100; // Abstand von Y0 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
346 t7pCompass.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
347 t7pCompass.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
348 t7pCompass.WindowX1 = 1600-1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
349 t7pCompass.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
350 t7pCompass.WindowY1 = 100-1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
351 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
352 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
353 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
354 /* 6 segments (left / right) used to show data during dive */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
355 |
38 | 356 t7l1.Image = &t7screen; |
357 t7l1.WindowNumberOfTextLines = 2; | |
358 t7l1.WindowLineSpacing = 19; // Abstand von Y0 | |
359 t7l1.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
360 t7l1.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
361 t7l1.WindowX1 = 799; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
362 t7l1.WindowY0 = CUSTOMBOX_LINE_TOP; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
363 t7l1.WindowY1 = 150 + TOP_LINE_HIGHT; |
38 | 364 |
365 t7l2.Image = &t7screen; | |
366 t7l2.WindowNumberOfTextLines = 2; | |
367 t7l2.WindowLineSpacing = 22; // Abstand von Y0 | |
368 t7l2.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
369 t7l2.WindowX0 = t7l1.WindowX0; |
38 | 370 t7l2.WindowX1 = t7l1.WindowX1; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
371 t7l2.WindowY0 = t7l1.WindowY1 + 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
372 t7l2.WindowY1 = t7l2.WindowY0 + 146; |
38 | 373 |
374 t7l3.Image = &t7screen; | |
375 t7l3.WindowNumberOfTextLines = 2; | |
376 t7l3.WindowLineSpacing = 58; // Abstand von Y0 | |
377 t7l3.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
378 t7l3.WindowX0 = t7l1.WindowX0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
379 t7l3.WindowX1 = t7l1.WindowX1;; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
380 t7l3.WindowY0 = 479 - 150; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
381 t7l3.WindowY1 = 479; |
38 | 382 |
383 t7r1.Image = &t7screen; | |
384 t7r1.WindowNumberOfTextLines = 2; | |
385 t7r1.WindowLineSpacing = t7l1.WindowLineSpacing; | |
386 t7r1.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
387 t7r1.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
388 t7r1.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET; |
38 | 389 t7r1.WindowY0 = t7l1.WindowY0; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
390 t7r1.WindowY1 = t7l1.WindowY1; |
38 | 391 |
392 t7r2.Image = &t7screen; | |
393 t7r2.WindowNumberOfTextLines = 2; | |
394 t7r2.WindowLineSpacing = t7l2.WindowLineSpacing; | |
395 t7r2.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
396 t7r2.WindowX0 = t7r1.WindowX0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
397 t7r2.WindowX1 = t7r1.WindowX1; |
38 | 398 t7r2.WindowY0 = t7l2.WindowY0; |
399 t7r2.WindowY1 = t7l2.WindowY1; | |
400 | |
401 t7r3.Image = &t7screen; | |
402 t7r3.WindowNumberOfTextLines = 2; | |
403 t7r3.WindowLineSpacing = 0;//t7l3.WindowLineSpacing; | |
404 t7r3.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
405 t7r3.WindowX0 = t7r1.WindowX0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
406 t7r3.WindowX1 = t7r1.WindowX1; |
38 | 407 t7r3.WindowY0 = t7l3.WindowY0; |
408 t7r3.WindowY1 = t7l3.WindowY1; | |
409 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
410 /* screen for CustomText / serial number */ |
38 | 411 t7cC.Image = &t7screen; |
412 t7cC.WindowNumberOfTextLines = 3; | |
413 t7cC.WindowLineSpacing = 95; // Abstand von Y0 | |
414 t7cC.WindowTab = 100; | |
415 t7cC.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
416 t7cC.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
417 t7cC.WindowY0 = 165; //90; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
418 t7cC.WindowY1 = 415; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
419 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
420 /* used by warning message box */ |
38 | 421 t7cH.Image = &t7screen; |
422 t7cH.WindowNumberOfTextLines = 1; | |
423 t7cH.WindowLineSpacing = 95; // Abstand von Y0 | |
424 t7cH.WindowTab = 100; | |
425 t7cH.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
426 t7cH.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
427 t7cH.WindowY0 = 46; //480 - 434; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
428 t7cH.WindowY1 = 390 - 46;// - 90; //46 + 390; //480 - (434 - 94); //434; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
429 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
430 /* used by warning custom box */ |
38 | 431 t7cW.Image = &t7screen; |
432 t7cW.WindowNumberOfTextLines = 3; | |
433 t7cW.WindowLineSpacing = 95; // Abstand von Y0 | |
434 t7cW.WindowTab = 100; | |
435 t7cW.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
436 t7cW.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
437 t7cW.WindowY0 = 480 - (434 - 90); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
438 t7cW.WindowY1 = 480 - 90; //434 - 95; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
439 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
440 /* time and environment */ |
38 | 441 t7surfaceL.Image = &t7screen; |
442 t7surfaceL.WindowNumberOfTextLines = 9; | |
443 t7surfaceL.WindowLineSpacing = 53; | |
444 t7surfaceL.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
445 t7surfaceL.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
446 t7surfaceL.WindowX1 = 799; |
38 | 447 t7surfaceL.WindowY0 = 0; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
448 t7surfaceL.WindowY1 = 479; |
38 | 449 |
450 t7surfaceR.Image = &t7screen; | |
451 t7surfaceR.WindowNumberOfTextLines = 9; | |
452 t7surfaceR.WindowLineSpacing = 53; | |
453 t7surfaceR.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
454 t7surfaceR.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
455 t7surfaceR.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET; |
38 | 456 t7surfaceR.WindowY0 = 0; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
457 t7surfaceR.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
458 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
459 /* info screen in the middle */ |
38 | 460 t7cY0free.Image = &t7screen; |
461 t7cY0free.WindowNumberOfTextLines = 1; | |
462 t7cY0free.WindowLineSpacing = 95; | |
463 t7cY0free.WindowTab = 100; | |
464 t7cY0free.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
465 t7cY0free.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
466 t7cY0free.WindowY0 = 115; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
467 t7cY0free.WindowY1 = 365; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
468 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
469 /* voltage value (V or %) */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
470 t7voltage.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
471 t7voltage.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
472 t7voltage.WindowLineSpacing = 10; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
473 t7voltage.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
474 t7voltage.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
475 t7voltage.WindowX1 = t7voltage.WindowX0 + (18*3) +9; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
476 t7voltage.WindowY1 = TOP_LINE_HIGHT; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
477 t7voltage.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
478 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
479 /* battery symbol */ |
38 | 480 t7batt.Image = &t7screen; |
481 t7batt.WindowNumberOfTextLines = 1; | |
482 t7batt.WindowLineSpacing = 10; | |
483 t7batt.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
484 t7batt.WindowX0 = t7voltage.WindowX1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
485 t7batt.WindowX1 = t7batt.WindowX0 + (52); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
486 t7batt.WindowY1 = TOP_LINE_HIGHT; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
487 t7batt.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
488 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
489 /* charger symbol */ |
38 | 490 t7charge.Image = &t7screen; |
491 t7charge.WindowNumberOfTextLines = 1; | |
492 t7charge.WindowLineSpacing = 10; | |
493 t7charge.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
494 t7charge.WindowX1 = t7batt.WindowX0 - 18; |
38 | 495 t7charge.WindowX0 = t7charge.WindowX1 - 14; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
496 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
497 t7charge.WindowY1 = TOP_LINE_HIGHT; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
498 t7charge.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
499 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
500 /* show dive mode OC / CC */ |
38 | 501 t7c1.Image = &t7screen; |
502 t7c1.WindowNumberOfTextLines = 1; | |
503 t7c1.WindowLineSpacing = 10; | |
504 t7c1.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
505 t7c1.WindowX0 = t7batt.WindowX1 + 18; //CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
506 t7c1.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; //t7batt.WindowX1 + 18; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
507 t7c1.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
508 t7c1.WindowY1 = 479 - 435; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
509 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
510 /* Gas warnings and exit Sim*/ |
38 | 511 t7c2.Image = &t7screen; |
512 t7c2.WindowNumberOfTextLines = 1; | |
513 t7c2.WindowLineSpacing = 0; // Abstand von Y0 | |
514 t7c2.WindowTab = 100; | |
515 t7c2.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
516 t7c2.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
517 t7c2.WindowY0 = 480 - 69; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
518 t7c2.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
519 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
520 /* Rotating compass */ |
38 | 521 t7pCompass.Image = &t7screenCompass; |
522 t7pCompass.WindowNumberOfTextLines = 1; | |
523 t7pCompass.WindowLineSpacing = 100; // Abstand von Y0 | |
524 t7pCompass.WindowTab = 100; | |
525 t7pCompass.WindowX0 = 0; | |
526 t7pCompass.WindowX1 = 1600-1; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
527 t7pCompass.WindowY0 = 479 - 75; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
528 t7pCompass.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
529 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
530 } |
38 | 531 |
532 init_t7_compass(); | |
533 } | |
534 | |
535 | |
536 void t7_refresh_sleepmode_fun(void) | |
537 { | |
538 uint32_t oldScreen; | |
539 | |
540 oldScreen = t7screen.FBStartAdress; | |
541 t7screen.FBStartAdress = getFrame(22); | |
542 | |
543 t7_refresh_sleep_design_fun(); | |
544 | |
545 if(get_globalState() == StStop) | |
546 { | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
547 GFX_SetFramesTopBottom(t7screen.FBStartAdress, 0,480); |
38 | 548 } |
549 releaseFrame(22,oldScreen); | |
550 } | |
551 | |
552 | |
553 void t7_refresh(void) | |
554 { | |
555 static uint8_t last_mode = MODE_SURFACE; | |
556 | |
557 // uint32_t oldScreen;//, oldPlugin; | |
558 SStateList status; | |
559 get_globalStateList(&status); | |
560 | |
561 t7screen.FBStartAdress = getFrame(22); | |
562 | |
563 background.pointer = 0; | |
564 | |
565 if(stateUsed->mode == MODE_DIVE) | |
566 { | |
567 if(last_mode != MODE_DIVE) | |
568 { | |
569 last_mode = MODE_DIVE; | |
570 /* lower left corner primary */ | |
571 selection_custom_field = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; | |
572 /* custom view primary OR debug if automatic return is off */ | |
573 if((settingsGetPointer()->tX_customViewTimeout == 0) && (settingsGetPointer()->showDebugInfo)) | |
574 selection_customview = CVIEW_noneOrDebug; | |
575 else | |
576 selection_customview = settingsGetPointer()->tX_customViewPrimary; | |
577 } | |
578 | |
579 if(status.page == PageSurface) | |
580 set_globalState(StD); | |
581 | |
582 if(stateUsed->diveSettings.diveMode == DIVEMODE_Gauge) | |
583 { | |
584 settingsGetPointer()->design = 5; | |
585 releaseAllFramesExcept(22,t7screen.FBStartAdress); | |
586 releaseFrame(22,t7screen.FBStartAdress); | |
587 return; | |
588 } | |
589 else if(stateUsed->diveSettings.diveMode == DIVEMODE_Apnea) | |
590 { | |
591 settingsGetPointer()->design = 6; | |
592 releaseAllFramesExcept(22,t7screen.FBStartAdress); | |
593 releaseFrame(22,t7screen.FBStartAdress); | |
594 return; | |
595 } | |
596 else | |
597 { | |
598 t7_refresh_divemode(); | |
599 } | |
600 } | |
601 else // from if(stateUsed->mode == MODE_DIVE) | |
602 { | |
603 if(last_mode != MODE_SURFACE) | |
604 { | |
605 last_mode = MODE_SURFACE; | |
606 selection_customview = customviewsSurface[0]; | |
607 } | |
608 if(status.page == PageDive) | |
609 set_globalState(StS); | |
610 | |
611 if(settingsGetPointer()->showDebugInfo) | |
612 t7_refresh_surface_debugmode(); | |
613 else | |
614 t7_refresh_surface(); | |
615 } | |
616 | |
617 tHome_show_lost_connection_count(&t7screen); | |
618 | |
619 if(status.base == BaseHome) | |
620 { | |
621 if(background.pointer) | |
622 { | |
623 GFX_SetFrameTop(t7screen.FBStartAdress); | |
624 GFX_SetFrameBottom(background.pointer,background.x0 , background.y0, background.width, background.height); | |
625 } | |
626 else | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
627 GFX_SetFramesTopBottom(t7screen.FBStartAdress, 0,480); |
38 | 628 } |
629 | |
630 releaseAllFramesExcept(22,t7screen.FBStartAdress); | |
631 } | |
632 | |
633 /* Private functions ---------------------------------------------------------*/ | |
634 | |
635 void t7_fill_surfacetime_helper(SSurfacetime *outArray, uint32_t inputMinutes, uint32_t inputSeconds) | |
636 { | |
637 inputSeconds += inputMinutes * 60; | |
638 | |
639 outArray->Total = inputSeconds; | |
640 | |
641 outArray->Days = inputSeconds / 86400;// (24*60*60); | |
642 inputSeconds -= 86400 * (uint32_t)outArray->Days; | |
643 | |
644 outArray->Hours = inputSeconds / 3600;// (60*60); | |
645 inputSeconds -= 3600 * (uint32_t)outArray->Hours; | |
646 | |
647 outArray->Minutes = inputSeconds / 60;; | |
648 inputSeconds -= 60 * (uint32_t)outArray->Minutes; | |
649 | |
650 outArray->Seconds = inputSeconds; | |
651 } | |
652 | |
653 void t7_refresh_sleep_design_fun(void) | |
654 { | |
655 static uint16_t state = 0; | |
656 uint16_t ytop = 0; | |
657 | |
658 state +=1; | |
659 if(state > 800) | |
660 state = 1; | |
661 | |
662 if(state > 400) | |
663 ytop = 800 - state; | |
664 else | |
665 ytop = 0 + state; | |
666 Gfx_write_label_var(&t7screen, 300,800, ytop,&FontT48,CLUT_Font020,"SLEEP SLEEP SLEEP"); | |
667 } | |
668 | |
669 void t7_refresh_surface(void) | |
670 { | |
671 char text[256]; | |
672 uint8_t date[3], year,month,day; | |
673 uint32_t color; | |
674 uint8_t customview_warnings = 0; | |
675 | |
676 RTC_DateTypeDef Sdate; | |
677 RTC_TimeTypeDef Stime; | |
678 RTC_DateTypeDef SdateFirmware; | |
679 | |
680 uint8_t dateNotSet = 0; | |
681 | |
682 uint8_t oxygen_percentage, gasOffset, actualGasID; | |
683 // uint16_t bottleFirstGas_bar; | |
684 point_t start, stop;//, other; | |
685 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
686 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
687 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
688 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
689 |
38 | 690 // update in all customview modes |
691 if(DataEX_check_RTE_version__needs_update() || font_update_required()) | |
692 updateNecessary = 1; | |
693 else | |
694 updateNecessary = 0; | |
695 | |
696 /* buttons */ | |
697 text[0] = TXT_2BYTE; | |
698 text[1] = TXT2BYTE_ButtonLogbook; | |
699 text[2] = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
700 write_content_simple(&t7screen, 0, 799, 479-TOP_LINE_HIGHT, &FontT24,text,CLUT_ButtonSurfaceScreen); |
38 | 701 |
702 text[0] = '\001'; | |
703 text[1] = TXT_2BYTE; | |
704 text[2] = TXT2BYTE_ButtonView; | |
705 text[3] = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
706 write_content_simple(&t7screen, 0, 799, 479-TOP_LINE_HIGHT, &FontT24,text,CLUT_ButtonSurfaceScreen); |
38 | 707 |
708 text[0] = '\002'; | |
709 text[1] = TXT_2BYTE; | |
710 text[2] = TXT2BYTE_ButtonMenu; | |
711 text[3] = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
712 write_content_simple(&t7screen, 0, 799, 479-TOP_LINE_HIGHT, &FontT24,text,CLUT_ButtonSurfaceScreen); |
38 | 713 |
714 /* was power on reset */ | |
715 //..... | |
716 /* removed hw 160802 in V1.1.1 | |
717 if(errorsInSettings) | |
718 { | |
719 sprintf(text,"Settings: %u",errorsInSettings); | |
720 GFX_write_string_color(&FontT42,&t7surfaceR,text,4,CLUT_WarningRed); | |
721 } | |
722 else | |
723 */ | |
724 if(DataEX_was_power_on()) | |
725 GFX_write_string_color(&FontT42,&t7surfaceR,"cold start",4,CLUT_WarningRed); | |
726 | |
727 /* time and date */ | |
728 translateDate(stateUsed->lifeData.dateBinaryFormat, &Sdate); | |
729 translateTime(stateUsed->lifeData.timeBinaryFormat, &Stime); | |
730 | |
731 firmwareGetDate(&SdateFirmware); | |
732 if(tHome_DateCode(&Sdate) < tHome_DateCode(&SdateFirmware)) | |
733 dateNotSet = 1; | |
734 else | |
735 dateNotSet = 0; | |
736 /* | |
737 if(Stime.Seconds % 2) | |
738 snprintf(text,255,"\001%02d:%02d",Stime.Hours,Stime.Minutes); | |
739 else | |
740 snprintf(text,255,"\001%02d\021:\020%02d",Stime.Hours,Stime.Minutes); | |
741 GFX_write_string(&FontT54,&t7surfaceR,text,3); | |
742 */ | |
743 // debug version: | |
744 if(Stime.Seconds % 2) | |
745 snprintf(text,255,"\001%02d:%02d:%02d",Stime.Hours,Stime.Minutes,Stime.Seconds); | |
746 else if(dateNotSet) | |
747 snprintf(text,255,"\001\021%02d:%02d:%02d\020",Stime.Hours,Stime.Minutes,Stime.Seconds); | |
748 else | |
749 snprintf(text,255,"\001%02d\021:\020%02d:%02d",Stime.Hours,Stime.Minutes,Stime.Seconds); | |
750 GFX_write_string(&FontT54,&t7surfaceR,text,3); | |
751 | |
752 if(settingsGetPointer()->date_format == DDMMYY) | |
753 { | |
754 day = 0; | |
755 month = 1; | |
756 year = 2; | |
757 } | |
758 else | |
759 if(settingsGetPointer()->date_format == MMDDYY) | |
760 { | |
761 day = 1; | |
762 month = 0; | |
763 year = 2; | |
764 } | |
765 else | |
766 { | |
767 day = 2; | |
768 month = 1; | |
769 year = 0; | |
770 } | |
771 date[day] = Sdate.Date; | |
772 date[month] = Sdate.Month; | |
773 date[year] = Sdate.Year; | |
774 | |
775 if((Stime.Seconds % 2) || (dateNotSet == 0)) | |
776 snprintf(text,255,"\001%02d.%02d.%02d",date[0],date[1],date[2]); | |
777 else | |
778 snprintf(text,255,"\001\021%02d.%02d.%02d",date[0],date[1],date[2]); | |
779 | |
780 GFX_write_string(&FontT54,&t7surfaceR,text,5); | |
781 | |
782 if(!DataEX_was_power_on() && !errorsInSettings) | |
783 { | |
784 text[0] = '\001'; | |
785 text[1] = '\004'; | |
786 text[2] = TXT_2BYTE; | |
787 text[3] = TXT2BYTE_Sunday; | |
788 text[4] = 0; | |
789 if(Sdate.WeekDay != RTC_WEEKDAY_SUNDAY) | |
790 text[3] += Sdate.WeekDay; | |
791 | |
792 if(!(Stime.Seconds % 2) && (dateNotSet == 1)) | |
793 text[1] = '\021'; | |
794 | |
795 GFX_write_string(&FontT24,&t7surfaceR,text,4); | |
796 } | |
797 | |
798 /* DEBUG uTick Pressure and Compass */ | |
799 /* | |
800 snprintf(text,255,"\001%u",stateRealGetPointer()->pressure_uTick_new - stateRealGetPointer()->pressure_uTick_old); | |
801 GFX_write_string(&FontT42,&t7surfaceR,text,1); | |
802 snprintf(text,255,"\001%u",HAL_GetTick() - stateRealGetPointer()->pressure_uTick_local_new); | |
803 GFX_write_string(&FontT42,&t7surfaceR,text,2); | |
804 | |
805 snprintf(text,255,"\001%u",stateRealGetPointer()->compass_uTick_new - stateRealGetPointer()->compass_uTick_old); | |
806 GFX_write_string(&FontT42,&t7surfaceR,text,6); | |
807 snprintf(text,255,"\001%u",HAL_GetTick() - stateRealGetPointer()->compass_uTick_local_new); | |
808 GFX_write_string(&FontT42,&t7surfaceR,text,7); | |
809 | |
810 static uint32_t bildschirmRefresh = 0; | |
811 snprintf(text,255,"\001%u",HAL_GetTick() - bildschirmRefresh); | |
812 GFX_write_string(&FontT42,&t7surfaceR,text,8); | |
813 bildschirmRefresh = HAL_GetTick(); | |
814 | |
815 static uint16_t bildschirmRefreshCount = 1; | |
816 if(bildschirmRefreshCount>10) | |
817 bildschirmRefreshCount = 1; | |
818 for(int i=0;i<bildschirmRefreshCount;i++) | |
819 text[i] = '.'; | |
820 text[bildschirmRefreshCount++] = 0; | |
821 GFX_write_string(&FontT42,&t7surfaceR,text,4); | |
822 */ | |
823 | |
824 /* noFlyTime or DesaturationTime */ | |
825 | |
826 if((!display_count_high_time) && (stateUsed->lifeData.no_fly_time_minutes)) | |
827 { | |
828 SSurfacetime NoFlyTime = {0,0,0,0}; | |
829 t7_fill_surfacetime_helper(&NoFlyTime,stateUsed->lifeData.no_fly_time_minutes, 0); | |
830 | |
831 if(NoFlyTime.Days) | |
832 { | |
833 snprintf(text,30,"\001%02d\016\016d\017 %02d\016\016h\017",NoFlyTime.Days, NoFlyTime.Hours); | |
834 } | |
835 else | |
836 { | |
837 snprintf(text,20,"\001%02d:%02d",NoFlyTime.Hours, NoFlyTime.Minutes); | |
838 } | |
839 | |
840 GFX_write_string(&FontT54,&t7surfaceR,text,7); | |
841 | |
842 text[0] = '\001'; | |
843 text[1] = '\022'; | |
844 text[2] = '\016'; | |
845 text[3] = '\016'; | |
846 text[4] = TXT_2BYTE; | |
847 text[5] = TXT2BYTE_noFly; | |
848 text[6] = 0; | |
849 GFX_write_string(&FontT48,&t7surfaceR,text,6); | |
850 } | |
851 else | |
852 if(stateUsed->lifeData.desaturation_time_minutes) | |
853 { | |
854 SSurfacetime DesatTime = {0,0,0,0}; | |
855 t7_fill_surfacetime_helper(&DesatTime,stateUsed->lifeData.desaturation_time_minutes, 0); | |
856 | |
857 if(DesatTime.Days) | |
858 { | |
859 snprintf(text,30,"\001%02d\016\016d\017 %02d\016\016h\017",DesatTime.Days, DesatTime.Hours); | |
860 } | |
861 else | |
862 { | |
863 snprintf(text,20,"\001%02d:%02d",DesatTime.Hours, DesatTime.Minutes); | |
864 } | |
865 GFX_write_string(&FontT54,&t7surfaceR,text,7); | |
866 | |
867 text[0] = '\001'; | |
868 text[1] = '\022'; | |
869 text[2] = '\016'; | |
870 text[3] = '\016'; | |
871 text[4] = TXT_2BYTE; | |
872 text[5] = TXT2BYTE_Desaturation; | |
873 text[6] = 0; | |
874 GFX_write_string(&FontT48,&t7surfaceR,text,6); | |
875 } | |
876 | |
877 /* Time since last dive */ | |
878 if(stateUsed->lifeData.surface_time_seconds) | |
879 { | |
880 SSurfacetime SurfTime = {0,0,0,0}; | |
881 t7_fill_surfacetime_helper(&SurfTime, 0, stateUsed->lifeData.surface_time_seconds); | |
882 | |
883 if(SurfTime.Days == 0) | |
884 { | |
885 snprintf(text,20,"\001\022%02d:%02d",SurfTime.Hours, SurfTime.Minutes); | |
886 } | |
887 else | |
888 { | |
889 snprintf(text,30,"\001\022%02d\016\016d\017 %02d\016\016h\017",SurfTime.Days, SurfTime.Hours); | |
890 } | |
891 | |
892 GFX_write_string(&FontT54,&t7surfaceR,text,2); | |
893 | |
894 | |
895 text[0] = '\001'; | |
896 text[1] = '\022'; | |
897 text[2] = '\016'; | |
898 text[3] = '\016'; | |
899 text[4] = TXT_2BYTE; | |
900 text[5] = TXT2BYTE_TimeSinceLastDive; | |
901 text[6] = 0; | |
902 GFX_write_string(&FontT48,&t7surfaceR,text,1); | |
903 } | |
904 | |
905 /* beta version */ | |
906 if( firmwareDataGetPointer()->versionBeta ) | |
907 { | |
908 snprintf(text,255,"\025 BETA"); | |
909 GFX_write_string(&FontT48,&t7surfaceL,text,2); | |
910 } | |
911 | |
912 /* surface pressure and temperature */ | |
913 if(stateUsed->sensorErrorsRTE == 0) | |
914 { | |
103
f5d2f02dc73f
Generalize TEXT of pressure unit
Dmitry Romanov <kitt@bk.ru>
parents:
102
diff
changeset
|
915 snprintf(text,30,"%01.0f\022\016\016 %s", stateUsed->lifeData.pressure_surface_bar * 1000.0f,TEXT_PRESSURE_UNIT); |
38 | 916 GFX_write_string(&FontT48,&t7surfaceL,text,3); |
917 | |
918 if(settingsGetPointer()->nonMetricalSystem) | |
919 snprintf(text,40,"%01.0f\140\022\016\016 fahrenheit",unit_temperature_float(stateUsed->lifeData.temperature_celsius)); | |
920 else | |
921 snprintf(text,30,"%01.0f\140\022\016\016 celsius",stateUsed->lifeData.temperature_celsius); | |
922 GFX_write_string(&FontT48,&t7surfaceL,text,4); | |
923 } | |
924 else | |
925 { | |
103
f5d2f02dc73f
Generalize TEXT of pressure unit
Dmitry Romanov <kitt@bk.ru>
parents:
102
diff
changeset
|
926 snprintf(text,30,"ERR\022\016\016 %s",TEXT_PRESSURE_UNIT); |
38 | 927 GFX_write_string(&FontT48,&t7surfaceL,text,3); |
928 | |
929 if(settingsGetPointer()->nonMetricalSystem) | |
930 snprintf(text,40,"ERR\022\016\016 fahrenheit"); | |
931 else | |
932 snprintf(text,30,"ERR\022\016\016 celsius"); | |
933 GFX_write_string(&FontT48,&t7surfaceL,text,4); | |
934 } | |
935 | |
936 | |
937 /* gas mix and selection */ | |
938 if((stateUsed->diveSettings.diveMode == DIVEMODE_Gauge) || (stateUsed->diveSettings.diveMode == DIVEMODE_Apnea)) | |
939 { | |
940 if(stateUsed->diveSettings.diveMode == DIVEMODE_Gauge) | |
941 text[0] = TXT_Gauge; | |
942 else | |
943 text[0] = TXT_Apnoe; | |
944 | |
945 text[1] = 0; | |
946 GFX_write_string(&FontT48,&t7surfaceL,text,6); | |
947 } | |
948 else | |
949 { | |
950 text[0] = '\021'; | |
951 text[1] = '1'; | |
952 text[2] = '\177'; | |
953 text[3] = '\177'; | |
954 text[4] = 10; | |
955 text[5] = '\021'; | |
956 text[6] = '2'; | |
957 text[7] = '\177'; | |
958 text[8] = '\177'; | |
959 text[9] = 10; | |
960 text[10] = '\021'; | |
961 text[11] = '3'; | |
962 text[12] = '\177'; | |
963 text[13] = '\177'; | |
964 text[14] = 10; | |
965 text[15] = '\021'; | |
966 text[16] = '4'; | |
967 text[17] = '\177'; | |
968 text[18] = '\177'; | |
969 text[19] = 10; | |
970 text[20] = '\021'; | |
971 text[21] = '5'; | |
972 text[22] = 0; | |
973 | |
974 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) | |
975 gasOffset = NUM_OFFSET_DILUENT; | |
976 else | |
977 gasOffset = 0; | |
978 for(int i=1;i<=5;i++) | |
979 { | |
980 if(stateUsed->diveSettings.gas[i+gasOffset].note.ub.active) | |
981 text[(i-1)*5] -= 1; | |
982 } | |
983 GFX_write_string(&FontT48,&t7surfaceL,text,6); | |
984 | |
985 | |
986 oxygen_percentage = 100; | |
987 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage; | |
988 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage; | |
989 | |
990 tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&text[0]); | |
991 GFX_write_string(&FontT48,&t7surfaceL,text,7); | |
992 | |
993 actualGasID = stateUsed->lifeData.actualGas.GasIdInSettings; | |
994 /* | |
995 bottleFirstGas_bar = stateUsed->lifeData.bottle_bar[actualGasID]; | |
996 if(bottleFirstGas_bar) | |
997 { | |
998 snprintf(text,255,"%3u\022\016\016 bar",bottleFirstGas_bar); | |
999 GFX_write_string(&FontT48,&t7surfaceL,text,8); | |
1000 } | |
1001 */ | |
1002 // after gas name :-) | |
1003 if(actualGasID > gasOffset) // security | |
1004 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1005 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1006 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1007 start.y = t7surfaceL.WindowY0 + (3 * t7surfaceL.WindowLineSpacing); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1008 start.x = t7surfaceL.WindowX0 + ((stateUsed->lifeData.actualGas.GasIdInSettings - gasOffset - 1) * 35); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1009 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1010 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1011 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1012 start.y = t7surfaceR.WindowY0 + (3 * t7surfaceR.WindowLineSpacing); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1013 start.x = t7surfaceR.WindowX0 + ((stateUsed->lifeData.actualGas.GasIdInSettings - gasOffset - 1) * 35); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1014 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1015 |
38 | 1016 stop.x = start.x + 25; |
1017 stop.y = start.y + 52; | |
1018 GFX_draw_box2(&t7screen, start, stop, CLUT_Font020, 1); | |
1019 } | |
1020 } | |
1021 | |
1022 /* dive mode */ | |
1023 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) | |
1024 GFX_write_string(&FontT24,&t7c1,"\f\002" "CCR",0); | |
1025 else | |
1026 GFX_write_string(&FontT24,&t7c1,"\f\002" "OC",0); | |
1027 // GFX_write_string(&FontT24,&t7c1,"\f\177\177\x80" "CCR",0); | |
1028 | |
1029 /*battery */ | |
1030 | |
1031 text[0] = '3'; | |
1032 text[1] = '1'; | |
1033 text[2] = '1'; | |
1034 text[3] = '1'; | |
1035 text[4] = '1'; | |
1036 text[5] = '1'; | |
1037 text[6] = '1'; | |
1038 text[7] = '1'; | |
1039 text[8] = '1'; | |
1040 text[9] = '1'; | |
1041 text[10] = '1'; | |
1042 text[11] = '0'; | |
1043 text[12] = 0; | |
1044 | |
1045 for(int i=1;i<=10;i++) | |
1046 { | |
1047 if( stateUsed->lifeData.battery_charge > (9 * i)) | |
1048 text[i] += 1; | |
1049 } | |
1050 | |
1051 if(stateUsed->chargeStatus == CHARGER_off) | |
1052 { | |
1053 if(stateUsed->warnings.lowBattery) | |
1054 { | |
1055 if(warning_count_high_time) | |
1056 { | |
1057 for(int i=1;i<=10;i++) | |
1058 text[i] = '1'; | |
1059 } | |
1060 else | |
1061 { | |
1062 text[1] = '2'; | |
1063 } | |
1064 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_WarningRed); | |
1065 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) | |
1066 { | |
1067 snprintf(text,16,"\004\025\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); | |
1068 if(warning_count_high_time) | |
1069 text[0] = '\a'; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1070 GFX_write_string(&FontT24,&t7voltage,text,0); |
38 | 1071 } |
1072 else | |
1073 { | |
1074 snprintf(text,6,"\f%.1fV",stateUsed->lifeData.battery_voltage); | |
1075 GFX_write_string(&FontT24,&t7voltage,text,0); | |
1076 } | |
1077 } | |
1078 else | |
1079 { | |
1080 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_BatteryStandard); | |
1081 | |
1082 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) | |
1083 { | |
1084 snprintf(text,16,"\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1085 // GFX_write_string(&FontT24,&t7batt,text,0); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1086 GFX_write_string(&FontT24,&t7voltage,text,0); |
38 | 1087 } |
1088 else | |
1089 { | |
1090 snprintf(text,6,"\f%.1fV",stateUsed->lifeData.battery_voltage); | |
1091 GFX_write_string(&FontT24,&t7voltage,text,0); | |
1092 } | |
1093 } | |
1094 } | |
1095 else | |
1096 { | |
1097 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_BatteryCharging); | |
1098 | |
1099 switch(stateUsed->chargeStatus) | |
1100 { | |
1101 case CHARGER_running: | |
1102 default: | |
1103 color = CLUT_BatteryStandard; | |
1104 break; | |
1105 case CHARGER_complete: | |
1106 color = CLUT_BatteryCharging; | |
1107 break; | |
1108 case CHARGER_lostConnection: | |
1109 color = CLUT_BatteryProblem; | |
1110 break; | |
1111 } | |
1112 text[0] = '4'; | |
1113 text[1] = 0; | |
1114 GFX_write_string_color(&Batt24,&t7charge,text,0,color); | |
1115 } | |
1116 | |
1117 | |
1118 | |
1119 customview_warnings = t7_test_customview_warnings_surface_mode(); | |
1120 if(customview_warnings && warning_count_high_time) | |
1121 t7_show_customview_warnings_surface_mode(); | |
1122 else | |
1123 t7_refresh_customview(); | |
1124 draw_frame(0,0, CLUT_pluginboxSurface, CLUT_Font020); | |
1125 } | |
1126 | |
1127 | |
1128 void t7_refresh_surface_debugmode_wireless_info(void) | |
1129 { | |
1130 char text[400]; | |
1131 uint8_t colorDataLost = 0; | |
1132 int txtPointer = 0; | |
1133 uint8_t numberOfBytes = 0; | |
1134 | |
1135 GFX_DrawCfgWindow textWindow = | |
1136 { | |
1137 .Image = &t7screen, | |
1138 .WindowNumberOfTextLines = 5, | |
1139 .WindowLineSpacing = 70, | |
1140 .WindowTab = 220, | |
1141 .WindowX0 = 10, | |
1142 .WindowX1 = 790, | |
1143 .WindowY0 = 10, | |
1144 .WindowY1 = 380 | |
1145 }; | |
1146 | |
1147 Gfx_write_label_var(&t7screen, 10,600, 10,&FontT42,CLUT_DiveMainLabel,"Wireless Data"); | |
1148 | |
1149 if(stateUsed->data_old__lost_connection_to_slave) | |
1150 { | |
1151 Gfx_write_label_var(&t7screen, 600,800,10,&FontT42,CLUT_Font020,"CPU2?"); | |
1152 colorDataLost = 1; | |
1153 } | |
1154 | |
1155 txtPointer = 0; | |
1156 for(int i=0;i<4;i++) | |
1157 { | |
1158 if((!stateUsed->lifeData.wireless_data[i].ageInMilliSeconds) || colorDataLost) | |
1159 text[txtPointer++] = '\021'; | |
1160 | |
1161 numberOfBytes = stateUsed->lifeData.wireless_data[i].numberOfBytes; | |
1162 if((numberOfBytes > 0) && (numberOfBytes <= 10)) | |
1163 { | |
1164 txtPointer += snprintf(&text[txtPointer],20,"%02u s %02u\t" | |
1165 ,(stateUsed->lifeData.wireless_data[i].ageInMilliSeconds)/1000 | |
1166 ,stateUsed->lifeData.wireless_data[i].status | |
1167 ); | |
1168 if(numberOfBytes > 8) ///< lifeData.wireless_data[i].data[j] has only size of 8 | |
1169 numberOfBytes = 8; | |
1170 for(int j=0;j<numberOfBytes;j++) | |
1171 { | |
1172 txtPointer += snprintf(&text[txtPointer],4," %02X" | |
1173 ,stateUsed->lifeData.wireless_data[i].data[j] | |
1174 ); | |
1175 } | |
1176 } | |
1177 text[txtPointer++] = '\n'; | |
1178 text[txtPointer++] = '\r'; | |
1179 text[txtPointer++] = '\020'; | |
1180 text[txtPointer] = 0; | |
1181 } | |
1182 GFX_write_string(&FontT48,&textWindow,text,1); | |
1183 | |
1184 } | |
1185 | |
1186 | |
1187 void t7_refresh_surface_debugmode(void) | |
1188 { | |
1189 if(selection_customview%2 == 1) | |
1190 { | |
1191 t7_refresh_surface_debugmode_wireless_info(); | |
1192 return; | |
1193 } | |
1194 | |
1195 // could be warning, now just to set RTE variables | |
1196 DataEX_check_RTE_version__needs_update(); | |
1197 | |
1198 | |
1199 char TextL1[4*TEXTSIZE]; | |
1200 uint32_t color; | |
1201 // uint8_t gasIdFirst; | |
1202 SSettings* pSettings = settingsGetPointer(); | |
1203 extern SDataExchangeSlaveToMaster dataIn; | |
1204 | |
1205 SWindowGimpStyle windowGimp; | |
1206 | |
1207 RTC_DateTypeDef Sdate; | |
1208 RTC_TimeTypeDef Stime; | |
1209 | |
1210 translateDate(stateUsed->lifeData.dateBinaryFormat, &Sdate); | |
1211 translateTime(stateUsed->lifeData.timeBinaryFormat, &Stime); | |
1212 | |
1213 | |
1214 if(stateUsed->data_old__lost_connection_to_slave) | |
1215 { | |
1216 Gfx_write_label_var(&t7screen, 500,800, 0,&FontT42,CLUT_DiveMainLabel,"old"); | |
1217 snprintf(TextL1,TEXTSIZE,"%X %X %X %X",dataIn.header.checkCode[0],dataIn.header.checkCode[1],dataIn.header.checkCode[2],dataIn.header.checkCode[3]); | |
1218 Gfx_write_label_var(&t7screen, 500,800, 45,&FontT48,CLUT_Font020,TextL1); | |
1219 } | |
1220 else | |
1221 if(DataEX_lost_connection_count()) | |
1222 { | |
1223 snprintf(TextL1,TEXTSIZE,"\002%i",DataEX_lost_connection_count()); | |
1224 Gfx_write_label_var(&t7screen, 600,800, 45,&FontT48,CLUT_Font020,TextL1); | |
1225 } | |
1226 | |
1227 snprintf(TextL1,TEXTSIZE,"\002%i",blockedFramesCount()); | |
1228 Gfx_write_label_var(&t7screen, 600,800, 0,&FontT48,CLUT_Font020,TextL1); | |
1229 | |
1230 if(stateUsed->lifeData.compass_DX_f | stateUsed->lifeData.compass_DY_f | stateUsed->lifeData.compass_DZ_f) | |
1231 { | |
1232 snprintf(TextL1,TEXTSIZE,"X %i",stateUsed->lifeData.compass_DX_f); | |
1233 Gfx_write_label_var(&t7screen, 0,400, 45,&FontT48,CLUT_Font020,TextL1); | |
1234 snprintf(TextL1,TEXTSIZE,"Y %i",stateUsed->lifeData.compass_DY_f); | |
1235 Gfx_write_label_var(&t7screen, 0,400,145,&FontT48,CLUT_Font020,TextL1); | |
1236 snprintf(TextL1,TEXTSIZE,"Z %i",stateUsed->lifeData.compass_DZ_f); | |
1237 Gfx_write_label_var(&t7screen, 0,400,255,&FontT48,CLUT_Font020,TextL1); | |
1238 return; | |
1239 } | |
103
f5d2f02dc73f
Generalize TEXT of pressure unit
Dmitry Romanov <kitt@bk.ru>
parents:
102
diff
changeset
|
1240 snprintf(TextL1,TEXTSIZE,"%01.0f %s",stateUsed->lifeData.pressure_ambient_bar * 1000.0f,TEXT_PRESSURE_UNIT); |
38 | 1241 Gfx_write_label_var(&t7screen, 0,400, 0,&FontT42,CLUT_DiveMainLabel,"Ambient Pressure"); |
1242 Gfx_write_label_var(&t7screen, 0,400, 45,&FontT48,CLUT_Font020,TextL1); | |
1243 | |
1244 snprintf(TextL1,TEXTSIZE,"%01.2f C",stateUsed->lifeData.temperature_celsius); | |
1245 Gfx_write_label_var(&t7screen, 0,400,100,&FontT42,CLUT_DiveMainLabel,"Temperature"); | |
1246 Gfx_write_label_var(&t7screen, 0,400,145,&FontT48,CLUT_Font020,TextL1); | |
1247 | |
1248 snprintf(TextL1,TEXTSIZE,"%03.0f %03.0f %03.0f",stateUsed->lifeData.compass_heading,stateUsed->lifeData.compass_roll,stateUsed->lifeData.compass_pitch); | |
1249 Gfx_write_label_var(&t7screen, 0,400,200,&FontT42,CLUT_DiveMainLabel,"Heading Roll Pitch"); | |
1250 Gfx_write_label_var(&t7screen, 0,400,255,&FontT48,CLUT_Font020,TextL1); | |
1251 | |
103
f5d2f02dc73f
Generalize TEXT of pressure unit
Dmitry Romanov <kitt@bk.ru>
parents:
102
diff
changeset
|
1252 snprintf(TextL1,TEXTSIZE,"%01.0f %s",stateUsed->lifeData.pressure_surface_bar * 1000.0f,TEXT_PRESSURE_UNIT); |
38 | 1253 Gfx_write_label_var(&t7screen, 0,400,310,&FontT42,CLUT_DiveMainLabel,"Surface Pressure"); |
1254 Gfx_write_label_var(&t7screen, 0,400,355,&FontT48,CLUT_Font020,TextL1); | |
1255 | |
1256 // gasIdFirst = stateUsed->lifeData.actualGas.GasIdInSettings; | |
1257 snprintf(TextL1,TEXTSIZE,"%u.%u",dataIn.RTE_VERSION_high,dataIn.RTE_VERSION_low); | |
1258 Gfx_write_label_var(&t7screen, 320,500,100,&FontT42,CLUT_DiveMainLabel,"RTE"); | |
1259 Gfx_write_label_var(&t7screen, 320,500,145,&FontT48,CLUT_Font020,TextL1); | |
1260 | |
1261 Gfx_write_label_var(&t7screen, 500,800,100,&FontT42,CLUT_DiveMainLabel,"Battery"); | |
1262 snprintf(TextL1,TEXTSIZE,"%01.4f V",stateUsed->lifeData.battery_voltage); | |
1263 Gfx_write_label_var(&t7screen, 500,800,145,&FontT48,CLUT_Font020,TextL1); | |
1264 snprintf(TextL1,TEXTSIZE,"%03.1f %%",stateUsed->lifeData.battery_charge); | |
1265 Gfx_write_label_var(&t7screen, 500,800,200,&FontT48,CLUT_Font020,TextL1); | |
1266 if(stateUsed->chargeStatus != CHARGER_off) | |
1267 { | |
1268 switch(stateUsed->chargeStatus) | |
1269 { | |
1270 case CHARGER_running: | |
1271 default: | |
1272 color = CLUT_BatteryStandard; | |
1273 break; | |
1274 case CHARGER_complete: | |
1275 color = CLUT_BatteryCharging; | |
1276 break; | |
1277 case CHARGER_lostConnection: | |
1278 color = CLUT_BatteryProblem; | |
1279 break; | |
1280 } | |
1281 TextL1[0] = '4'; | |
1282 TextL1[1] = 0; | |
1283 Gfx_write_label_var(&t7screen, 660,800,200,&Batt24,color,TextL1); | |
1284 } | |
1285 | |
1286 extern uint32_t base_tempLightLevel; | |
1287 | |
1288 snprintf(TextL1,TEXTSIZE,"# %u (%u)",stateUsed->lifeData.ambient_light_level, base_tempLightLevel); | |
1289 Gfx_write_label_var(&t7screen, 401,600,310,&FontT42,CLUT_DiveMainLabel,"Light"); | |
1290 Gfx_write_label_var(&t7screen, 401,800,355,&FontT48,CLUT_Font020,TextL1); | |
1291 | |
1292 // snprintf(TextL1,TEXTSIZE,"# %u",stateUsed->lifeData.ambient_light_level); | |
1293 // Gfx_write_label_var(&t7screen, 601,800,310,&FontT42,CLUT_DiveMainLabel,"Light"); | |
1294 // Gfx_write_label_var(&t7screen, 601,800,355,&FontT48,CLUT_Font020,TextL1); | |
1295 | |
1296 | |
1297 | |
1298 if(Sdate.Year < 15) | |
1299 { | |
1300 if(warning_count_high_time) | |
1301 { | |
1302 snprintf(TextL1,4*TEXTSIZE,"\017 %02d-%02d-%02d %02d:%02d:%02d", Sdate.Date, Sdate.Month, 2000 + Sdate.Year,Stime.Hours, Stime.Minutes, Stime.Seconds); | |
1303 Gfx_write_label_var(&t7screen, 0,800,420,&FontT48,CLUT_Font020,TextL1); | |
1304 } | |
1305 } | |
1306 else | |
1307 { | |
1308 if(pSettings->customtext[0]) | |
1309 { | |
1310 if(pSettings->customtext[59]) | |
1311 pSettings->customtext[59] = 0; | |
1312 Gfx_write_label_var(&t7screen, 0,400,420,&FontT24,CLUT_Font020,pSettings->customtext); | |
1313 } | |
1314 else | |
1315 { | |
1316 snprintf(TextL1,4*TEXTSIZE,"\017 %02d-%02d-%02d %02d:%02d:%02d Dives: %u", Sdate.Date, Sdate.Month, 2000 + Sdate.Year,Stime.Hours, Stime.Minutes, Stime.Seconds,pSettings->totalDiveCounter ); | |
1317 Gfx_write_label_var(&t7screen, 0,800,420,&FontT48,CLUT_Font020,TextL1); | |
1318 } | |
1319 } | |
1320 | |
1321 windowGimp.left = 400; | |
1322 windowGimp.top = 0; | |
1323 GFX_draw_image_monochrome(&t7screen, windowGimp, &ImgOSTC, 0); | |
1324 } | |
1325 | |
1326 /* CUSTOMVIEW | |
1327 * in the middle of the screen | |
1328 */ | |
1329 | |
1330 uint8_t t7_test_customview_warnings(void) | |
1331 { | |
1332 uint8_t count = 0; | |
1333 | |
1334 count = 0; | |
1335 count += stateUsed->warnings.decoMissed; | |
1336 count += stateUsed->warnings.ppO2Low; | |
1337 count += stateUsed->warnings.ppO2High; | |
1338 //count += stateUsed->warnings.lowBattery; | |
1339 count += stateUsed->warnings.sensorLinkLost; | |
1340 count += stateUsed->warnings.fallback; | |
1341 return count; | |
1342 } | |
1343 | |
1344 | |
1345 uint8_t t7_test_customview_warnings_surface_mode(void) | |
1346 { | |
1347 uint8_t count = 0; | |
1348 count = 0; | |
1349 count += stateUsed->cnsHigh_at_the_end_of_dive; | |
1350 count += stateUsed->decoMissed_at_the_end_of_dive; | |
1351 return count; | |
1352 } | |
1353 | |
1354 | |
1355 void t7_show_customview_warnings_surface_mode(void) | |
1356 { | |
1357 char text[256]; | |
1358 uint8_t textpointer, lineFree; | |
1359 | |
1360 text[0] = '\025'; | |
1361 text[1] = '\f'; | |
1362 text[2] = '\001'; | |
1363 text[3] = TXT_Warning; | |
1364 text[4] = 0; | |
1365 GFX_write_string(&FontT42,&t7cH,text,0); | |
1366 | |
1367 textpointer = 0; | |
1368 lineFree = 5; | |
1369 | |
1370 if(stateUsed->decoMissed_at_the_end_of_dive) | |
1371 { | |
1372 text[textpointer++] = TXT_2BYTE; | |
1373 text[textpointer++] = TXT2BYTE_WarnDecoMissed; | |
1374 text[textpointer++] = '\n'; | |
1375 text[textpointer++] = '\r'; | |
1376 text[textpointer] = 0; | |
1377 lineFree--; | |
1378 } | |
1379 | |
1380 if(stateUsed->cnsHigh_at_the_end_of_dive) | |
1381 { | |
1382 text[textpointer++] = TXT_2BYTE; | |
1383 text[textpointer++] = TXT2BYTE_WarnCnsHigh; | |
1384 text[textpointer++] = '\n'; | |
1385 text[textpointer++] = '\r'; | |
1386 text[textpointer] = 0; | |
1387 lineFree--; | |
1388 } | |
1389 if(textpointer != 0) | |
1390 GFX_write_string(&FontT48,&t7cW,text,1); | |
1391 } | |
1392 | |
1393 | |
1394 void t7_show_customview_warnings(void) | |
1395 { | |
1396 char text[256]; | |
1397 uint8_t textpointer, lineFree; | |
1398 | |
1399 text[0] = '\025'; | |
1400 text[1] = '\f'; | |
1401 text[2] = '\001'; | |
1402 text[3] = TXT_Warning; | |
1403 text[4] = 0; | |
1404 GFX_write_string(&FontT42,&t7cH,text,0); | |
1405 | |
1406 textpointer = 0; | |
1407 lineFree = 5; | |
1408 | |
1409 if(lineFree && stateUsed->warnings.decoMissed) | |
1410 { | |
1411 text[textpointer++] = TXT_2BYTE; | |
1412 text[textpointer++] = TXT2BYTE_WarnDecoMissed; | |
1413 text[textpointer++] = '\n'; | |
1414 text[textpointer++] = '\r'; | |
1415 text[textpointer] = 0; | |
1416 lineFree--; | |
1417 } | |
1418 | |
1419 if(lineFree && stateUsed->warnings.fallback) | |
1420 { | |
1421 text[textpointer++] = TXT_2BYTE; | |
1422 text[textpointer++] = TXT2BYTE_WarnFallback; | |
1423 text[textpointer++] = '\n'; | |
1424 text[textpointer++] = '\r'; | |
1425 text[textpointer] = 0; | |
1426 lineFree--; | |
1427 } | |
1428 | |
1429 if(lineFree && stateUsed->warnings.ppO2Low) | |
1430 { | |
1431 text[textpointer++] = TXT_2BYTE; | |
1432 text[textpointer++] = TXT2BYTE_WarnPPO2Low; | |
1433 text[textpointer++] = '\n'; | |
1434 text[textpointer++] = '\r'; | |
1435 text[textpointer] = 0; | |
1436 lineFree--; | |
1437 } | |
1438 | |
1439 if(lineFree && stateUsed->warnings.ppO2High) | |
1440 { | |
1441 text[textpointer++] = TXT_2BYTE; | |
1442 text[textpointer++] = TXT2BYTE_WarnPPO2High; | |
1443 text[textpointer++] = '\n'; | |
1444 text[textpointer++] = '\r'; | |
1445 text[textpointer] = 0; | |
1446 lineFree--; | |
1447 } | |
1448 | |
1449 if(lineFree && stateUsed->warnings.sensorLinkLost) | |
1450 { | |
1451 text[textpointer++] = TXT_2BYTE; | |
1452 text[textpointer++] = TXT2BYTE_WarnSensorLinkLost; | |
1453 text[textpointer++] = '\n'; | |
1454 text[textpointer++] = '\r'; | |
1455 text[textpointer] = 0; | |
1456 lineFree--; | |
1457 } | |
1458 /* | |
1459 if(lineFree && stateUsed->warnings.lowBattery) | |
1460 { | |
1461 text[textpointer++] = TXT_2BYTE; | |
1462 text[textpointer++] = TXT2BYTE_WarnBatteryLow; | |
1463 text[textpointer++] = '\n'; | |
1464 text[textpointer++] = '\r'; | |
1465 text[textpointer] = 0; | |
1466 lineFree--; | |
1467 } | |
1468 */ | |
1469 GFX_write_string(&FontT48,&t7cW,text,1); | |
1470 } | |
1471 | |
1472 | |
1473 void t7_set_customview_to_primary(void) | |
1474 { | |
1475 if(stateUsed->mode == MODE_DIVE) | |
1476 selection_customview = settingsGetPointer()->tX_customViewPrimary; | |
1477 } | |
1478 | |
1479 | |
1480 // for CVIEW_END is none_or_debug | |
1481 void t7_change_customview(void) | |
1482 { | |
1483 const uint8_t *pViews; | |
1484 _Bool cv_disabled = 0; | |
1485 | |
1486 if(stateUsed->mode == MODE_DIVE) | |
1487 pViews = customviewsDive; | |
1488 else | |
1489 pViews = customviewsSurface; | |
1490 | |
1491 while((*pViews != CVIEW_END) && (*pViews != selection_customview)) | |
1492 {pViews++;} | |
1493 | |
1494 if(*pViews < CVIEW_END) | |
1495 pViews++; | |
1496 | |
1497 | |
1498 if(*pViews == CVIEW_END) | |
1499 { | |
1500 if(stateUsed->mode == MODE_DIVE) | |
1501 pViews = customviewsDive; | |
1502 else | |
1503 pViews = customviewsSurface; | |
1504 } | |
1505 | |
1506 if(stateUsed->mode == MODE_DIVE) | |
1507 { | |
1508 do | |
1509 { | |
1510 cv_disabled = 0; | |
1511 for(int i=0;i<6;i++) | |
1512 { | |
1513 if((*pViews == cv_changelist[i]) && !CHECK_BIT_THOME(cv_configuration, cv_changelist[i])) | |
1514 { | |
1515 cv_disabled = 1; | |
1516 break; | |
1517 } | |
1518 } | |
1519 if(cv_disabled) | |
1520 { | |
1521 if(*pViews < CVIEW_END) | |
1522 { | |
1523 pViews++; | |
1524 } | |
1525 else | |
1526 { | |
1527 pViews = customviewsDive; | |
1528 } | |
1529 } | |
1530 } while(cv_disabled); | |
1531 } | |
1532 selection_customview = *pViews; | |
1533 } | |
1534 | |
1535 | |
1536 uint8_t t7_get_length_of_customtext(void) | |
1537 { | |
1538 uint8_t i = 0; | |
1539 settingsGetPointer()->customtext[60-1] = 0; | |
1540 while(settingsGetPointer()->customtext[i] > 0) | |
1541 i++; | |
1542 return i; | |
1543 } | |
1544 | |
1545 | |
1546 void t7_refresh_customview(void) | |
1547 { | |
1548 | |
1549 char text[256]; | |
1550 uint16_t textpointer = 0; | |
1551 int16_t start; | |
51
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
1552 uint8_t lineCountCustomtext = 0; |
38 | 1553 int16_t shiftWindowY0; |
1554 RTC_DateTypeDef Sdate; | |
1555 RTC_TimeTypeDef Stime; | |
1556 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth; // CVIEW_Gaslist | |
1557 const SGasLine * pGasLine; // CVIEW_Gaslist | |
1558 uint8_t oxygen, helium; // CVIEW_Gaslist | |
1559 float depth, surface, fraction_nitrogen, fraction_helium, ead, end; // CVIEW_EADTime | |
1560 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1561 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1562 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1563 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1564 if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1565 t7_change_customview(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1566 if((selection_customview == CVIEW_sensors_mV) &&(stateUsed->diveSettings.ccrOption == 0)) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1567 t7_change_customview(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1568 if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1569 t7_change_customview(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1570 |
38 | 1571 switch(selection_customview) |
1572 { | |
1573 case CVIEW_noneOrDebug: | |
1574 if(settingsGetPointer()->showDebugInfo) | |
1575 { | |
1576 // header | |
1577 strcpy(text,"\032\f\001Debug"); | |
1578 GFX_write_string(&FontT42,&t7cH,text,0); | |
1579 // content | |
1580 t7_debug(); | |
1581 } | |
1582 break; | |
1583 | |
1584 case CVIEW_SummaryOfLeftCorner: | |
1585 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Summary); | |
1586 GFX_write_string(&FontT42,&t7cH,text,0); | |
1587 // content | |
1588 t7_SummaryOfLeftCorner(); | |
1589 break; | |
1590 | |
1591 case CVIEW_CompassDebug: | |
1592 snprintf(text,100,"\032\f\001Compass raw"); | |
1593 GFX_write_string(&FontT42,&t7cH,text,0); | |
1594 /* | |
1595 pStateReal->lifeData.compass_heading = dataIn.data[dataIn.boolCompassData].compass_heading; | |
1596 pStateReal->lifeData.compass_roll = dataIn.data[dataIn.boolCompassData].compass_roll; | |
1597 pStateReal->lifeData.compass_pitch = dataIn.data[dataIn.boolCompassData].compass_pitch; | |
1598 | |
1599 pStateReal->lifeData.compass_DX_f = dataIn.data[dataIn.boolCompassData].compass_DX_f; | |
1600 pStateReal->lifeData.compass_DY_f = dataIn.data[dataIn.boolCompassData].compass_DY_f; | |
1601 pStateReal->lifeData.compass_DZ_f = dataIn.data[dataIn.boolCompassData].compass_DZ_f; | |
1602 */ | |
1603 snprintf(text,255,"%1.1f\n\r%1.1f\n\r%1.1f\n\r%i\n\r%i\n\r%i" | |
1604 ,stateUsed->lifeData.compass_heading | |
1605 ,stateUsed->lifeData.compass_roll | |
1606 ,stateUsed->lifeData.compass_pitch | |
1607 ,stateUsed->lifeData.compass_DX_f | |
1608 ,stateUsed->lifeData.compass_DY_f | |
1609 ,stateUsed->lifeData.compass_DZ_f | |
1610 ); | |
1611 | |
1612 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; | |
1613 t7cY0free.WindowLineSpacing = 48; | |
1614 t7cY0free.WindowNumberOfTextLines = 6; | |
1615 GFX_write_string(&FontT42, &t7cY0free, text, 1); | |
1616 break; | |
1617 | |
1618 case CVIEW_Hello: | |
1619 t7_logo_OSTC(); | |
1620 t7cC.WindowLineSpacing = 53; | |
1621 t7cC.WindowNumberOfTextLines = 5; | |
1622 shiftWindowY0 = 18; | |
1623 | |
1624 if(updateNecessary)//if(DataEX_check_RTE_version__needs_update() || font_update_required()) | |
1625 { | |
1626 if(warning_count_high_time) | |
1627 { | |
1628 shiftWindowY0 += 20; | |
1629 t7cC.WindowY0 -= shiftWindowY0; | |
1630 textpointer = 0; | |
1631 text[textpointer++] = TXT_2BYTE; | |
1632 text[textpointer++] = TXT2BYTE_PleaseUpdate; | |
1633 text[textpointer++] = '\n'; | |
1634 text[textpointer++] = '\r'; | |
1635 if(DataEX_check_RTE_version__needs_update()) | |
1636 { | |
1637 text[textpointer++] = TXT_2BYTE; | |
1638 text[textpointer++] = TXT2BYTE_RTE; | |
1639 text[textpointer++] = '\n'; | |
1640 text[textpointer++] = '\r'; | |
1641 } | |
1642 if(font_update_required()) | |
1643 { | |
1644 text[textpointer++] = TXT_2BYTE; | |
1645 text[textpointer++] = TXT2BYTE_Fonts; | |
1646 } | |
1647 text[textpointer++] = 0; | |
1648 GFX_write_string_color(&FontT42,&t7cC,text,1, CLUT_WarningRed); | |
1649 t7cC.WindowY0 += shiftWindowY0; | |
1650 } | |
1651 t7cC.WindowNumberOfTextLines = 3; | |
1652 } | |
1653 else // customtext | |
1654 { | |
1655 lineCountCustomtext = t7_customtextPrepare(text); | |
1656 if(lineCountCustomtext <= 2) | |
1657 shiftWindowY0 += 20+26; // nach unten | |
1658 else | |
1659 if(lineCountCustomtext <= 3) | |
1660 shiftWindowY0 += 20; // nach unten | |
1661 t7cC.WindowY0 -= shiftWindowY0; | |
1662 | |
1663 GFX_write_string(&FontT42,&t7cC,text,1); | |
1664 t7cC.WindowNumberOfTextLines = 3; | |
1665 t7cC.WindowY0 += shiftWindowY0; | |
1666 } | |
1667 if(lineCountCustomtext <= 4) | |
1668 { | |
1669 snprintf(text,100,"\001#%0u V%01u.%01u.%01u", | |
1670 settingsGetPointer()->serialLow + (256 * settingsGetPointer()->serialHigh), | |
1671 firmwareDataGetPointer()->versionFirst, | |
1672 firmwareDataGetPointer()->versionSecond, | |
1673 firmwareDataGetPointer()->versionThird | |
1674 ); | |
1675 GFX_write_string(&FontT24,&t7cC,text,0); | |
1676 } | |
1677 break; | |
1678 | |
1679 case CVIEW_Gaslist: | |
1680 // a lot of code taken from tMenuGas.c | |
1681 // header | |
1682 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Gaslist); | |
1683 GFX_write_string(&FontT42,&t7cH,text,0); | |
1684 // content | |
1685 textpointer = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1686 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1687 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1688 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1689 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1690 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1691 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1692 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1693 t7cY0free.WindowY1 = 400; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1694 } |
38 | 1695 t7cY0free.WindowLineSpacing = 48+9; |
1696 t7cY0free.WindowNumberOfTextLines = 5; // NUM_GASES == 5 | |
1697 t7cY0free.WindowTab = 420; | |
1698 | |
1699 pGasLine = settingsGetPointer()->gas; | |
1700 if(actualLeftMaxDepth(stateUsed)) | |
1701 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_deco) / 100; | |
1702 else | |
1703 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100; | |
1704 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100; | |
1705 for(int gasId=1;gasId<=NUM_GASES;gasId++) | |
1706 { | |
1707 textpointer = 0; | |
1708 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100; | |
1709 if(pGasLine[gasId].note.ub.active == 0) | |
1710 strcpy(&text[textpointer++],"\021"); | |
1711 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow)) | |
1712 strcpy(&text[textpointer++],"\025"); | |
1713 else | |
1714 strcpy(&text[textpointer++],"\030"); | |
1715 | |
1716 text[textpointer++] = ' '; | |
1717 oxygen = pGasLine[gasId].oxygen_percentage; | |
1718 helium = pGasLine[gasId].helium_percentage; | |
1719 textpointer += write_gas(&text[textpointer], oxygen, helium); | |
1720 // Wechseltiefe | |
1721 if(pGasLine[gasId].depth_meter) | |
1722 { | |
1723 textpointer += snprintf(&text[textpointer],7,"\t%u %c%c",unit_depth_integer(pGasLine[gasId].depth_meter), unit_depth_char1(), unit_depth_char2()); | |
1724 } | |
1725 GFX_write_string(&FontT42, &t7cY0free, text, gasId); | |
1726 } | |
1727 break; | |
1728 | |
1729 case CVIEW_EADTime: | |
1730 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Info ); | |
1731 GFX_write_string(&FontT42,&t7cH,text,0); | |
1732 textpointer = 0; | |
1733 | |
1734 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1735 if(pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1736 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1737 t7cY0free.WindowY1 = 400; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1738 } |
38 | 1739 t7cY0free.WindowLineSpacing = 48; |
1740 t7cY0free.WindowNumberOfTextLines = 6; | |
1741 | |
1742 // time | |
1743 snprintf(text,100,"\032\001%c%c",TXT_2BYTE,TXT2BYTE_Clock ); | |
1744 GFX_write_string(&FontT42, &t7cY0free, text, 1); | |
1745 | |
1746 translateDate(stateRealGetPointer()->lifeData.dateBinaryFormat, &Sdate); | |
1747 translateTime(stateRealGetPointer()->lifeData.timeBinaryFormat, &Stime); | |
1748 if(Stime.Seconds % 2) | |
1749 textpointer += snprintf(&text[textpointer],100,"\030\001%02d:%02d",Stime.Hours,Stime.Minutes); | |
1750 else | |
1751 textpointer += snprintf(&text[textpointer],100,"\030\001%02d\031:\030%02d",Stime.Hours,Stime.Minutes); | |
1752 GFX_write_string(&FontT42, &t7cY0free, text, 2); | |
1753 | |
1754 // EAD / END | |
1755 // The equivalent air depth can be calculated for depths in metres as follows: | |
1756 // EAD = (Depth + 10) � Fraction of N2 / 0.79 - 10 (wikipedia) | |
1757 // The equivalent narcotic depth can be calculated for depths in metres as follows: | |
1758 // END = (Depth + 10) � (1 - Fraction of helium) - 10 (wikipedia) | |
1759 decom_get_inert_gases((float)stateUsed->lifeData.pressure_ambient_bar,&(stateUsed->lifeData.actualGas),&fraction_nitrogen,&fraction_helium); | |
1760 depth = stateUsed->lifeData.pressure_ambient_bar; | |
1761 surface = stateUsed->lifeData.pressure_surface_bar; | |
1762 ead = 10.f * ((depth * fraction_nitrogen/0.79f) - surface); | |
1763 end = 10.0f * ((depth * (1.f - fraction_helium)) - surface); | |
1764 if(ead < 0) | |
1765 ead = 0; | |
1766 if(end < 0) | |
1767 end = 0; | |
1768 | |
1769 snprintf(text,100,"\032\001EAD"); | |
1770 GFX_write_string(&FontT42, &t7cY0free, text, 3); | |
1771 snprintf(text,100,"\030\001%01.1f %c%c" | |
1772 , unit_depth_float(ead) | |
1773 , unit_depth_char1() | |
1774 , unit_depth_char2() | |
1775 ); | |
1776 GFX_write_string(&FontT42, &t7cY0free, text, 4); | |
1777 | |
1778 snprintf(text,100,"\032\001END"); | |
1779 GFX_write_string(&FontT42, &t7cY0free, text, 5); | |
1780 snprintf(text,100,"\030\001%01.1f %c%c" | |
1781 , unit_depth_float(ead) | |
1782 , unit_depth_char1() | |
1783 , unit_depth_char2() | |
1784 ); | |
1785 GFX_write_string(&FontT42, &t7cY0free, text, 6); | |
1786 break; | |
1787 | |
1788 case CVIEW_Profile: | |
1789 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Profile); | |
1790 GFX_write_string(&FontT42,&t7cH,text,0); | |
1791 textpointer = 0; | |
1792 t7_miniLiveLogProfile(); | |
1793 break; | |
1794 | |
1795 case CVIEW_Tissues: | |
1796 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Tissues); | |
1797 GFX_write_string(&FontT42,&t7cH,text,0); | |
1798 textpointer = 0; | |
1799 t7_tissues(stateUsed); | |
1800 break; | |
1801 | |
1802 case CVIEW_sensors: | |
1803 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_O2monitor); | |
1804 GFX_write_string(&FontT42,&t7cH,text,0); | |
1805 textpointer = 0; | |
1806 text[textpointer++] = '\030'; // main color | |
1807 for(int i=0;i<3;i++) | |
1808 { | |
1809 if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) | |
1810 { | |
1811 text[textpointer++] = '\031'; // labelcolor | |
1812 text[textpointer++] = '\001'; | |
1813 text[textpointer++] = '-'; | |
1814 text[textpointer++] = '\n'; | |
1815 text[textpointer++] = '\r'; | |
1816 text[textpointer++] = '\030'; // main color | |
1817 text[textpointer] = 0; | |
1818 } | |
1819 else | |
1820 { | |
1821 if(stateUsed->warnings.sensorOutOfBounds[i]) | |
1822 text[textpointer++] = '\025'; // Warning Red | |
1823 textpointer += snprintf(&text[textpointer],100,"\001%01.2f\n\r\030",stateUsed->lifeData.ppO2Sensor_bar[i]); | |
1824 } | |
1825 } | |
1826 t7cC.WindowLineSpacing = 95; | |
1827 t7cC.WindowNumberOfTextLines = 3; | |
1828 text[textpointer] = 0; | |
1829 GFX_write_string(&FontT105,&t7cC,text,1); | |
1830 break; | |
1831 | |
1832 case CVIEW_sensors_mV: | |
1833 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_O2voltage); | |
1834 GFX_write_string(&FontT42,&t7cH,text,0); | |
1835 textpointer = 0; | |
1836 text[textpointer++] = '\030'; | |
1837 for(int i=0;i<3;i++) | |
1838 { | |
1839 if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) | |
1840 { | |
1841 text[textpointer++] = '\031'; | |
1842 text[textpointer++] = '\001'; | |
1843 text[textpointer++] = '-'; | |
1844 text[textpointer++] = '\n'; | |
1845 text[textpointer++] = '\r'; | |
1846 text[textpointer++] = '\030'; | |
1847 text[textpointer] = 0; | |
1848 } | |
1849 else | |
1850 { | |
1851 if(stateUsed->warnings.sensorOutOfBounds[i]) | |
1852 text[textpointer++] = '\025'; | |
1853 textpointer += snprintf(&text[textpointer],100,"\001%01.1f mV\n\r\030",(stateUsed->lifeData.sensorVoltage_mV[i])); | |
1854 } | |
1855 } | |
1856 t7cC.WindowLineSpacing = 95; | |
1857 t7cC.WindowNumberOfTextLines = 3; | |
1858 text[textpointer] = 0; | |
1859 GFX_write_string(&FontT48,&t7cC,text,1); | |
1860 break; | |
1861 | |
1862 case CVIEW_Compass: | |
1863 default: | |
1864 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE, TXT2BYTE_Compass); | |
1865 GFX_write_string(&FontT42,&t7cH,text,0); | |
1866 t7_compass((uint16_t)stateUsed->lifeData.compass_heading, stateUsed->diveSettings.compassHeading); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1867 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1868 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1869 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1870 t7cY0free.WindowX0 += 15; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1871 t7cY0free.WindowY0 = 230; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1872 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1873 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1874 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1875 t7cY0free.WindowX0 -= 15; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1876 t7cY0free.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1877 t7cY0free.WindowY1 = 250; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1878 } |
38 | 1879 snprintf(text,100,"\030\001%03i`",(uint16_t)stateUsed->lifeData.compass_heading); |
1880 GFX_write_string(&FontT54,&t7cY0free,text,0); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1881 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1882 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1883 t7cY0free.WindowX0 -= 15; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1884 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1885 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1886 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1887 t7cY0free.WindowX0 += 15; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1888 } |
38 | 1889 break; |
1890 | |
1891 case CVIEW_Decolist: | |
1892 snprintf(text,100,"\032\f\001 %c%c", TXT_2BYTE, TXT2BYTE_Decolist); | |
1893 GFX_write_string(&FontT42,&t7cH,text,0); | |
1894 | |
1895 const SDecoinfo * pDecoinfo; | |
1896 uint8_t depthNext, depthLast, depthSecond, depthInc; | |
1897 | |
1898 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
1899 pDecoinfo = &stateUsed->decolistBuehlmann; | |
1900 else | |
1901 pDecoinfo = &stateUsed->decolistVPM; | |
1902 | |
1903 depthLast = (uint8_t)(stateUsed->diveSettings.last_stop_depth_bar * 10); | |
1904 depthSecond = (uint8_t)(stateUsed->diveSettings.input_second_to_last_stop_depth_bar * 10); | |
1905 depthInc = (uint8_t)(stateUsed->diveSettings.input_next_stop_increment_depth_bar * 10); | |
1906 | |
1907 if(settingsGetPointer()->nonMetricalSystem) | |
1908 { | |
1909 depthLast = (uint8_t)unit_depth_integer(depthLast); | |
1910 depthSecond = (uint8_t)unit_depth_integer(depthSecond); | |
1911 depthInc = (uint8_t)unit_depth_integer(depthInc); | |
1912 } | |
1913 | |
1914 for(start=DECOINFO_STRUCT_MAX_STOPS-1; start>0; start--) | |
1915 if(pDecoinfo->output_stop_length_seconds[start]) break; | |
1916 start -= 6; | |
1917 if(start < 0) start = 0; | |
1918 | |
1919 textpointer = 0; | |
1920 for(int i=start;i<6+start;i++) | |
1921 { | |
1922 if(i == 0) | |
1923 depthNext = depthLast; | |
1924 else | |
1925 depthNext = depthSecond + (( i - 1 )* depthInc); | |
1926 | |
1927 if(pDecoinfo->output_stop_length_seconds[i]) | |
1928 textpointer += snprintf(&text[textpointer],20,"\030\034 %2u\016\016%c%c\017%3i'\n\r",depthNext, unit_depth_char1(), unit_depth_char2(), (pDecoinfo->output_stop_length_seconds[i]+59)/60); | |
1929 else | |
1930 textpointer += snprintf(&text[textpointer],20,"\031\034 %2u\016\016%c%c\017\n\r",depthNext, unit_depth_char1(), unit_depth_char2()); | |
1931 if(textpointer > 200) break; | |
1932 } | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1933 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1934 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1935 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1936 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1937 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1938 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1939 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1940 t7cY0free.WindowY1 = 400; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1941 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1942 |
38 | 1943 t7cY0free.WindowLineSpacing = 48; |
1944 t7cY0free.WindowNumberOfTextLines = 6; | |
1945 GFX_write_string(&FontT42, &t7cY0free, text, 1); | |
1946 break; | |
1947 } | |
1948 } | |
1949 | |
1950 | |
1951 | |
1952 /* DIVE MODE | |
1953 */ | |
1954 void t7_refresh_divemode(void) | |
1955 { | |
1956 char TextL1[TEXTSIZE]; | |
1957 char TextL2[TEXTSIZE]; | |
1958 | |
1959 char TextR1[TEXTSIZE]; | |
1960 char TextR2[TEXTSIZE]; | |
1961 char TextR3[TEXTSIZE]; | |
1962 | |
1963 char TextC1[2*TEXTSIZE]; | |
1964 char TextC2[TEXTSIZE]; | |
1965 uint8_t textPointer; | |
1966 | |
1967 point_t start, stop; | |
1968 uint8_t color; | |
1969 int textlength; | |
1970 | |
1971 uint16_t nextstopLengthSeconds = 0; | |
1972 uint8_t nextstopDepthMeter = 0; | |
1973 uint8_t oxygen_percentage = 0; | |
1974 SDivetime Divetime = {0,0,0, 0}; | |
1975 SDivetime SafetyStopTime = {0,0,0,0}; | |
1976 SDivetime TimeoutTime = {0,0,0,0}; | |
1977 uint8_t customview_warnings = 0; | |
1978 const SDecoinfo * pDecoinfo; | |
1979 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1980 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1981 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1982 |
38 | 1983 Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; |
1984 Divetime.Minutes = Divetime.Total / 60; | |
1985 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); | |
1986 | |
1987 SafetyStopTime.Total = timer_Safetystop_GetCountDown(); | |
1988 SafetyStopTime.Minutes = SafetyStopTime.Total / 60; | |
1989 SafetyStopTime.Seconds = SafetyStopTime.Total - (SafetyStopTime.Minutes * 60); | |
1990 | |
1991 TimeoutTime.Total = settingsGetPointer()->timeoutDiveReachedZeroDepth - stateUsed->lifeData.counterSecondsShallowDepth; | |
1992 if(TimeoutTime.Total > settingsGetPointer()->timeoutDiveReachedZeroDepth) | |
1993 { | |
1994 TimeoutTime.Total = 0; | |
1995 } | |
1996 TimeoutTime.Minutes = TimeoutTime.Total / 60; | |
1997 TimeoutTime.Seconds = TimeoutTime.Total - (TimeoutTime.Minutes * 60); | |
1998 | |
1999 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
2000 pDecoinfo = &stateUsed->decolistBuehlmann; | |
2001 else | |
2002 pDecoinfo = &stateUsed->decolistVPM; | |
2003 | |
2004 if(pDecoinfo->output_time_to_surface_seconds) | |
2005 { | |
2006 tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
2007 } | |
2008 else | |
2009 { | |
2010 nextstopDepthMeter = 0; | |
2011 nextstopLengthSeconds = 0; | |
2012 } | |
2013 | |
2014 /* depth */ | |
174
ecb71521d004
Bugfix: make max depth move with current depth (part 2)
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
2015 float depth = unit_depth_float(stateUsed->lifeData.depth_meter); |
38 | 2016 |
2017 if(depth <= 0.3f) | |
2018 depth = 0; | |
2019 | |
2020 if(settingsGetPointer()->nonMetricalSystem) | |
2021 snprintf(TextL1,TEXTSIZE,"\032\f[feet]"); | |
2022 else | |
2023 snprintf(TextL1,TEXTSIZE,"\032\f%c",TXT_Depth); | |
2024 GFX_write_string(&FontT24,&t7l1,TextL1,0); | |
2025 | |
2026 if((stateUsed->lifeData.ascent_rate_meter_per_min > 8) || (stateUsed->lifeData.ascent_rate_meter_per_min < -10)) | |
2027 { | |
2028 snprintf(TextL1,TEXTSIZE,"\f\002%.0f %c%c/min " | |
2029 , unit_depth_float(stateUsed->lifeData.ascent_rate_meter_per_min) | |
2030 , unit_depth_char1() | |
2031 , unit_depth_char2() | |
2032 ); | |
2033 GFX_write_string(&FontT24,&t7l1,TextL1,0); | |
2034 } | |
2035 | |
2036 if( depth < 100) | |
2037 snprintf(TextL1,TEXTSIZE,"\020%01.1f",depth); | |
2038 else | |
2039 snprintf(TextL1,TEXTSIZE,"\020%01.0f",depth); | |
2040 | |
2041 t7_colorscheme_mod(TextL1); | |
2042 GFX_write_string(&FontT144,&t7l1,TextL1,1); | |
2043 | |
2044 /* max depth */ | |
2045 snprintf(TextL2,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
2046 GFX_write_string(&FontT42,&t7l2,TextL2,0); | |
2047 | |
2048 if(unit_depth_float(stateUsed->lifeData.max_depth_meter) < 100) | |
2049 snprintf(TextL2,TEXTSIZE,"\020%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
2050 else | |
2051 snprintf(TextL2,TEXTSIZE,"\020%01.0f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
2052 | |
2053 t7_colorscheme_mod(TextL2); | |
2054 GFX_write_string(&FontT105,&t7l2,TextL2,1); | |
2055 | |
2056 /* ascentrate graph */ | |
2057 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) | |
2058 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2059 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2060 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2061 start.y = t7l1.WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2062 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2063 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2064 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2065 start.y = t7l3.WindowY0 - 25; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2066 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2067 |
38 | 2068 for(int i = 0; i<4;i++) |
2069 { | |
2070 start.y += 5*6; | |
2071 stop.y = start.y; | |
2072 start.x = CUSTOMBOX_LINE_LEFT - 1; | |
2073 stop.x = start.x - 17; | |
2074 GFX_draw_line(&t7screen, start, stop, 0); | |
2075 // start.x = CUSTOMBOX_LINE_RIGHT + 2; old right too | |
2076 // stop.x = start.x + 17; | |
2077 // GFX_draw_line(&t7screen, start, stop, 0); | |
2078 } | |
2079 // new thick bar design Sept. 2015 | |
2080 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 3 - 5; | |
2081 stop.x = start.x; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2082 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2083 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2084 start.y = t7l1.WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2085 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2086 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2087 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2088 start.y = t7l3.WindowY0 - 25; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2089 } |
38 | 2090 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 6); |
2091 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9 | |
2092 if(stop.y >= 470) | |
2093 stop.y = 470; | |
2094 start.y += 7; // starte etwas weiter oben | |
2095 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 10) | |
2096 color = CLUT_EverythingOkayGreen; | |
2097 else | |
2098 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 15) | |
2099 color = CLUT_WarningYellow; | |
2100 else | |
2101 color = CLUT_WarningRed; | |
2102 | |
2103 GFX_draw_thick_line(12,&t7screen, start, stop, color); | |
2104 } | |
2105 //snprintf(TextL2,TEXTSIZE,"\f%.1f m/min",stateUsed->lifeData.ascent_rate_meter_per_min); | |
2106 | |
2107 /* divetime */ | |
2108 if(stateUsed->lifeData.counterSecondsShallowDepth) | |
2109 { | |
2110 snprintf(TextR1,TEXTSIZE,"\f\002\136 %u:%02u",TimeoutTime.Minutes, TimeoutTime.Seconds); | |
2111 GFX_write_string(&FontT42,&t7r1,TextR1,0); | |
2112 } | |
2113 else | |
2114 { | |
2115 snprintf(TextR1,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
2116 GFX_write_string(&FontT42,&t7r1,TextR1,0); | |
2117 } | |
2118 | |
2119 if(Divetime.Minutes < 1000) | |
2120 snprintf(TextR1,TEXTSIZE,"\020\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds); | |
2121 else | |
2122 snprintf(TextR1,TEXTSIZE,"\020\016\002%u'",Divetime.Minutes); | |
2123 t7_colorscheme_mod(TextR1); | |
2124 GFX_write_string(&FontT105,&t7r1,TextR1,1); | |
2125 | |
2126 /* next deco stop */ | |
2127 if(nextstopDepthMeter) | |
2128 { | |
2129 snprintf(TextR2,TEXTSIZE,"\032\f\002%c",TXT_Decostop); | |
2130 GFX_write_string(&FontT42,&t7r2,TextR2,0); | |
2131 textlength = snprintf(TextR2,TEXTSIZE,"\020\002%u%c%c %u'" | |
2132 , unit_depth_integer(nextstopDepthMeter) | |
2133 , unit_depth_char1_T105() | |
2134 , unit_depth_char2_T105() | |
2135 , (nextstopLengthSeconds+59)/60); | |
2136 t7_colorscheme_mod(TextR2); | |
2137 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | |
2138 TextR2[0] = '\021'; | |
2139 if(textlength <= 9) | |
2140 GFX_write_string(&FontT105,&t7r2,TextR2,1); | |
2141 else | |
2142 GFX_write_string(&FontT54,&t7r2,TextR2,1); | |
2143 } | |
2144 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit())) | |
2145 { | |
2146 snprintf(TextR2,TEXTSIZE,"\032\f\002%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2); | |
2147 GFX_write_string(&FontT42,&t7r2,TextR2,0); | |
2148 snprintf(TextR2,TEXTSIZE,"\020\016\002%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds); | |
2149 t7_colorscheme_mod(TextR2); | |
2150 GFX_write_string(&FontT105,&t7r2,TextR2,1); | |
2151 } | |
2152 | |
2153 /* tts - option 1 | |
2154 * ndl - option 2 | |
2155 * empty - option 3 */ | |
2156 if(pDecoinfo->output_time_to_surface_seconds) | |
2157 { | |
2158 snprintf(TextR3,TEXTSIZE,"\032\f\002%c",TXT_TTS); | |
2159 GFX_write_string(&FontT42,&t7r3,TextR3,0); | |
2160 if(pDecoinfo->output_time_to_surface_seconds < 1000 * 60) | |
2161 snprintf(TextR3,TEXTSIZE,"\020\002%i'",(pDecoinfo->output_time_to_surface_seconds + 30)/ 60); | |
2162 else | |
2163 snprintf(TextR3,TEXTSIZE,"\020\002%ih",pDecoinfo->output_time_to_surface_seconds / 3600); | |
2164 t7_colorscheme_mod(TextR3); | |
2165 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | |
2166 TextR2[0] = '\021'; | |
2167 GFX_write_string(&FontT105,&t7r3,TextR3,1); | |
2168 } | |
2169 else if(pDecoinfo->output_ndl_seconds) | |
2170 { | |
2171 snprintf(TextR3,TEXTSIZE,"\032\f\002%c",TXT_Nullzeit); | |
2172 GFX_write_string(&FontT42,&t7r3,TextR3,0); | |
2173 if(pDecoinfo->output_ndl_seconds < 1000 * 60) | |
2174 snprintf(TextR3,TEXTSIZE,"\020\002%i'",pDecoinfo->output_ndl_seconds/60); | |
2175 else | |
2176 snprintf(TextR3,TEXTSIZE,"\020\002%ih",pDecoinfo->output_ndl_seconds/3600); | |
2177 t7_colorscheme_mod(TextR3); | |
2178 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | |
2179 TextR2[0] = '\021'; | |
2180 GFX_write_string(&FontT105,&t7r3,TextR3,1); | |
2181 } | |
2182 | |
2183 /* Menu Selection (and gas mix) */ | |
2184 if(get_globalState() == StDMGAS) | |
2185 { | |
2186 textPointer = 0; | |
2187 TextR1[textPointer++] = '\a'; | |
2188 // TextR1[textPointer++] = '\f'; | |
2189 TextR1[textPointer++] = '\001'; | |
2190 TextR1[textPointer++] = ' '; | |
2191 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[actualBetterGasId()].oxygen_percentage,stateUsed->diveSettings.gas[actualBetterGasId()].helium_percentage,&TextR1[textPointer]); | |
2192 TextR1[textPointer++] = '?'; | |
2193 TextR1[textPointer++] = ' '; | |
2194 TextR1[textPointer++] = 0; | |
2195 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2196 } | |
2197 else if(get_globalState() == StDMSPT) | |
2198 { | |
2199 textPointer = 0; | |
2200 TextR1[textPointer++] = '\a'; | |
2201 TextR1[textPointer++] = '\001'; | |
2202 TextR1[textPointer++] = ' '; | |
2203 textPointer += snprintf(&TextR1[textPointer],5,"%f01.2",((float)(stateUsed->diveSettings.setpoint[actualBetterSetpointId()].setpoint_cbar))/100); | |
2204 TextR1[textPointer++] = '?'; | |
2205 TextR1[textPointer++] = ' '; | |
2206 TextR1[textPointer++] = 0; | |
2207 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2208 } | |
2209 else if(get_globalState() == StDMENU) | |
2210 { | |
2211 snprintf(TextR1,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveMenuQ); | |
2212 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2213 } | |
2214 else if(get_globalState() == StDSIM1) | |
2215 { | |
2216 snprintf(TextR1,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveQuitQ); | |
2217 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2218 } | |
2219 else if(get_globalState() == StDSIM2) | |
2220 { | |
2221 if(settingsGetPointer()->nonMetricalSystem) | |
2222 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:-3.33ft "); | |
2223 else | |
2224 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:-1m "); | |
2225 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2226 | |
2227 snprintf(TextR1,TEXTSIZE,"\a\f %u %c%c" | |
2228 , unit_depth_integer(simulation_get_aim_depth()) | |
2229 , unit_depth_char1() | |
2230 , unit_depth_char2() | |
2231 ); | |
2232 GFX_write_string_color(&FontT42,&t7l1,TextR1,0,CLUT_WarningYellow); | |
2233 | |
2234 } | |
2235 else if(get_globalState() == StDSIM3) | |
2236 { | |
2237 if(settingsGetPointer()->nonMetricalSystem) | |
2238 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+3.33ft "); | |
2239 else | |
2240 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+1m "); | |
2241 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2242 snprintf(TextR1,TEXTSIZE,"\a\f %u %c%c" | |
2243 , unit_depth_integer(simulation_get_aim_depth()) | |
2244 , unit_depth_char1() | |
2245 , unit_depth_char2() | |
2246 ); | |
2247 GFX_write_string_color(&FontT42,&t7l1,TextR1,0,CLUT_WarningYellow); | |
2248 } | |
2249 else if(get_globalState() == StDSIM4) | |
2250 { | |
2251 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+5' "); | |
2252 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2253 snprintf(TextR1,TEXTSIZE,"\a\f %u %c%c" | |
2254 , unit_depth_integer(simulation_get_aim_depth()) | |
2255 , unit_depth_char1() | |
2256 , unit_depth_char2() | |
2257 ); | |
2258 GFX_write_string_color(&FontT42,&t7l1,TextR1,0,CLUT_WarningYellow); | |
2259 } | |
2260 else | |
2261 { | |
2262 /* gas mix */ | |
2263 oxygen_percentage = 100; | |
2264 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage; | |
2265 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage; | |
2266 | |
2267 textPointer = 0; | |
2268 TextC2[textPointer++] = '\020'; | |
2269 if(stateUsed->warnings.betterGas && warning_count_high_time) | |
2270 { | |
2271 TextC2[textPointer++] = '\a'; | |
2272 } | |
2273 else | |
2274 { | |
2275 float fPpO2limitHigh, fPpO2now; | |
2276 | |
2277 if(actualLeftMaxDepth(stateUsed)) | |
2278 fPpO2limitHigh = settingsGetPointer()->ppO2_max_deco; | |
2279 else | |
2280 fPpO2limitHigh = settingsGetPointer()->ppO2_max_std; | |
2281 | |
2282 fPpO2now = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * oxygen_percentage; | |
2283 | |
2284 if((fPpO2now > fPpO2limitHigh) || (fPpO2now < (float)(settingsGetPointer()->ppO2_min))) | |
2285 TextC2[textPointer++] = '\025'; | |
2286 } | |
2287 TextC2[textPointer++] = '\002'; | |
2288 textPointer += tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&TextC2[textPointer]); | |
2289 | |
2290 if(stateUsed->warnings.betterGas && warning_count_high_time) | |
2291 { | |
2292 if(TextC2[0] == '\020') | |
2293 { | |
2294 TextC2[0] = '\004'; // NOP | |
2295 } | |
2296 GFX_write_string_color(&FontT48,&t7c2,TextC2,0,CLUT_WarningYellow); | |
2297 } | |
2298 else | |
2299 { | |
2300 t7_colorscheme_mod(TextC2); | |
2301 GFX_write_string(&FontT48,&t7c2,TextC2,0); // T54 has only numbers | |
2302 } | |
2303 | |
2304 if(stateUsed->diveSettings.ccrOption) | |
2305 { | |
2306 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) | |
2307 { | |
2308 snprintf(TextC2,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); | |
2309 if(stateUsed->warnings.betterSetpoint && warning_count_high_time && (stateUsed->diveSettings.diveMode == DIVEMODE_CCR)) | |
2310 { | |
2311 TextC2[0] = '\a'; // inverse instead of color \020 | |
2312 GFX_write_string_color(&FontT48,&t7c2,TextC2,0,CLUT_WarningYellow); | |
2313 } | |
2314 else | |
2315 { | |
2316 t7_colorscheme_mod(TextC2); | |
2317 GFX_write_string(&FontT48,&t7c2,TextC2,0); | |
2318 } | |
2319 } | |
2320 } | |
2321 else if(settingsGetPointer()->alwaysShowPPO2) | |
2322 { | |
2323 snprintf(TextC2,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); | |
2324 t7_colorscheme_mod(TextC2); | |
2325 GFX_write_string(&FontT48,&t7c2,TextC2,0); | |
2326 } | |
2327 } | |
2328 | |
2329 /* algorithm, ccr, bailout and battery */ | |
2330 /* and permanent warnings (CNS) */ | |
2331 | |
2332 if((stateUsed->warnings.cnsHigh) && display_count_high_time) | |
2333 { | |
2334 TextC2[0] = '\f'; | |
2335 TextC2[1] = TXT_2BYTE; | |
2336 TextC2[2] = TXT2BYTE_WarnCnsHigh; | |
2337 TextC2[3] = 0; | |
2338 GFX_write_string_color(&FontT48,&t7c1,TextC2,0,CLUT_WarningRed); | |
2339 } | |
2340 else | |
2341 { | |
2342 if(stateUsed->warnings.aGf) | |
2343 { | |
2344 GFX_write_string_color(&FontT48,&t7c1,"\f" "aGF",0,CLUT_WarningYellow); | |
2345 } | |
2346 else if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
2347 { | |
2348 GFX_write_string(&FontT48,&t7c1,"\027\f" "GF",0); | |
2349 } | |
2350 else | |
2351 { | |
2352 GFX_write_string(&FontT48,&t7c1,"\027\f" "VPM",0); | |
2353 } | |
2354 | |
2355 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) | |
2356 GFX_write_string(&FontT24,&t7c1,"\027\f\002" "CCR",0); | |
2357 // GFX_write_string(&FontT24,&t7c1,"\f\177\177\x80" "CCR",0); | |
2358 else | |
2359 if(stateUsed->diveSettings.ccrOption) | |
2360 GFX_write_string(&FontT24,&t7c1,"\f\002\024" "Bailout",0); | |
2361 // GFX_write_string(&FontT24,&t7c1,"\f\177\177\x80\024" "Bailout",0); | |
2362 } | |
2363 TextC1[0] = '\020'; | |
2364 TextC1[1] = '3'; | |
2365 TextC1[2] = '1'; | |
2366 TextC1[3] = '1'; | |
2367 TextC1[4] = '1'; | |
2368 TextC1[5] = '1'; | |
2369 TextC1[6] = '1'; | |
2370 TextC1[7] = '1'; | |
2371 TextC1[8] = '1'; | |
2372 TextC1[9] = '1'; | |
2373 TextC1[10] = '1'; | |
2374 TextC1[11] = '1'; | |
2375 TextC1[12] = '0'; | |
2376 TextC1[13] = 0; | |
2377 | |
2378 for(int i=1;i<=10;i++) | |
2379 { | |
2380 if( stateUsed->lifeData.battery_charge > (9 * i)) | |
2381 TextC1[i+1] += 1; | |
2382 } | |
2383 | |
2384 if(stateUsed->warnings.lowBattery) | |
2385 { | |
2386 TextC1[0] = '\025'; | |
2387 if(warning_count_high_time) | |
2388 { | |
2389 for(int i=2;i<=11;i++) | |
2390 TextC1[i] = '1'; | |
2391 } | |
2392 else | |
2393 { | |
2394 TextC1[2] = '2'; | |
2395 } | |
2396 GFX_write_string(&Batt24,&t7batt,TextC1,0); | |
2397 | |
2398 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) | |
2399 { | |
2400 snprintf(TextC1,16,"\004\025\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); | |
2401 if(warning_count_high_time) | |
2402 TextC1[0] = '\a'; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2403 GFX_write_string(&FontT24,&t7voltage,TextC1,0); |
38 | 2404 } |
2405 } | |
2406 else | |
2407 { | |
2408 t7_colorscheme_mod(TextC1); | |
2409 GFX_write_string(&Batt24,&t7batt,TextC1,0); | |
2410 | |
2411 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) | |
2412 { | |
2413 snprintf(TextC1,16,"\020\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); | |
2414 t7_colorscheme_mod(TextC1); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2415 GFX_write_string(&FontT24,&t7voltage,TextC1,0); // t7batt |
38 | 2416 } |
2417 } | |
2418 | |
2419 /* customizable left lower corner */ | |
2420 t7_refresh_divemode_userselected_left_lower_corner(); | |
2421 | |
2422 | |
2423 /* customview - option 1 | |
2424 * warning - option 2 */ | |
2425 if(stateUsed->warnings.numWarnings) | |
2426 customview_warnings = t7_test_customview_warnings(); | |
2427 | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
2428 background.pointer = 0; |
38 | 2429 if(customview_warnings && warning_count_high_time) |
2430 t7_show_customview_warnings(); | |
2431 else | |
2432 t7_refresh_customview(); | |
2433 | |
2434 /* the frame */ | |
2435 draw_frame(1,1, CLUT_DIVE_pluginbox, CLUT_DIVE_FieldSeperatorLines); | |
2436 } | |
2437 | |
2438 void t7_set_field_to_primary(void) | |
2439 { | |
2440 if(stateUsed->mode == MODE_DIVE) | |
2441 selection_custom_field = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; | |
2442 } | |
2443 | |
2444 void t7_change_field(void) | |
2445 { | |
2446 const uint8_t minVal = 0; | |
2447 const uint8_t maxValGF = 8; | |
2448 const uint8_t maxValVPM = 7; | |
2449 uint8_t maxNow = maxValGF; | |
2450 | |
2451 selection_custom_field++; | |
2452 | |
2453 if(stateUsed->diveSettings.deco_type.ub.standard == VPM_MODE) | |
2454 maxNow = maxValVPM; | |
2455 | |
2456 if(selection_custom_field > maxNow) | |
2457 selection_custom_field = minVal; | |
2458 } | |
2459 | |
2460 | |
2461 void t7_refresh_divemode_userselected_left_lower_corner(void) | |
2462 { | |
2463 if(!selection_custom_field) | |
2464 return; | |
2465 | |
2466 char headerText[10]; | |
2467 char text[TEXTSIZE]; | |
2468 uint8_t textpointer = 0; | |
2469 _Bool tinyHeaderFont = 0; | |
2470 uint8_t line = 0; | |
2471 | |
2472 SDivetime Stopwatch = {0,0,0,0}; | |
2473 float fAverageDepth, fAverageDepthAbsolute; | |
2474 const SDecoinfo * pDecoinfoStandard; | |
2475 const SDecoinfo * pDecoinfoFuture; | |
2476 float fCNS; | |
2477 | |
2478 float temperatureThisCall; | |
2479 float temperature; | |
2480 | |
2481 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
2482 { | |
2483 pDecoinfoStandard = &stateUsed->decolistBuehlmann; | |
2484 pDecoinfoFuture = &stateUsed->decolistFutureBuehlmann; | |
2485 } | |
2486 else | |
2487 { | |
2488 pDecoinfoStandard = &stateUsed->decolistVPM; | |
2489 pDecoinfoFuture = &stateUsed->decolistFutureVPM; | |
2490 } | |
2491 | |
2492 Stopwatch.Total = timer_Stopwatch_GetTime(); | |
2493 Stopwatch.Minutes = Stopwatch.Total / 60; | |
2494 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
2495 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
2496 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
2497 | |
2498 headerText[0] = '\032'; | |
2499 headerText[1] = '\f'; | |
2500 | |
2501 switch(selection_custom_field) | |
2502 { | |
2503 /* Temperature */ | |
2504 case 1: | |
2505 default: | |
2506 // mean value | |
2507 temperatureThisCall = unit_temperature_float(stateUsed->lifeData.temperature_celsius); | |
2508 temperature = (temperatureThisCall + temperatureLastCall[0] + temperatureLastCall[1] + temperatureLastCall[2]) / 4.0f; | |
2509 idTemperatureLastCall++; | |
2510 if(idTemperatureLastCall >= 3) | |
2511 idTemperatureLastCall = 0; | |
2512 temperatureLastCall[idTemperatureLastCall] = temperatureThisCall; | |
2513 // output | |
2514 headerText[2] = TXT_Temperature; | |
2515 textpointer = snprintf(text,TEXTSIZE,"\020\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F | |
2516 if(settingsGetPointer()->nonMetricalSystem == 0) | |
2517 text[textpointer++] = 'C'; | |
2518 else | |
2519 text[textpointer++] = 'F'; | |
2520 text[textpointer++] = 0; | |
2521 tinyHeaderFont = 0; | |
2522 break; | |
2523 | |
2524 /* Average Depth */ | |
2525 case 2: | |
2526 headerText[2] = TXT_AvgDepth; | |
2527 if(settingsGetPointer()->nonMetricalSystem) | |
2528 snprintf(text,TEXTSIZE,"\020%01.0f",unit_depth_float(fAverageDepthAbsolute)); | |
2529 else | |
2530 snprintf(text,TEXTSIZE,"\020%01.1f",fAverageDepthAbsolute); | |
2531 break; | |
2532 | |
2533 /* ppO2 */ | |
2534 case 3: | |
2535 headerText[2] = TXT_ppO2; | |
2536 snprintf(text,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); | |
2537 break; | |
2538 | |
2539 /* Stop Uhr */ | |
2540 case 4: | |
2541 headerText[2] = TXT_Stopwatch; | |
2542 if(settingsGetPointer()->nonMetricalSystem) | |
2543 snprintf(text,TEXTSIZE,"\020\016\016%u:%02u\n\r%01.0f",Stopwatch.Minutes, Stopwatch.Seconds,unit_depth_float(fAverageDepth)); | |
2544 else | |
2545 snprintf(text,TEXTSIZE,"\020\016\016%u:%02u\n\r%01.1f",Stopwatch.Minutes, Stopwatch.Seconds,fAverageDepth); | |
2546 tinyHeaderFont = 1; | |
2547 line = 1; | |
2548 break; | |
2549 | |
2550 /* Ceiling */ | |
2551 case 5: | |
2552 headerText[2] = TXT_Ceiling; | |
2553 if((pDecoinfoStandard->output_ceiling_meter > 99.9f) || (settingsGetPointer()->nonMetricalSystem)) | |
2554 snprintf(text,TEXTSIZE,"\020%01.0f",unit_depth_float(pDecoinfoStandard->output_ceiling_meter)); | |
2555 else | |
2556 snprintf(text,TEXTSIZE,"\020%01.1f",pDecoinfoStandard->output_ceiling_meter); | |
2557 break; | |
2558 | |
2559 /* Future TTS */ | |
2560 case 6: | |
2561 headerText[2] = TXT_FutureTTS; | |
2562 snprintf(text,TEXTSIZE,"\020\016\016@+%u'\n\r" "%i' TTS",settingsGetPointer()->future_TTS, pDecoinfoFuture->output_time_to_surface_seconds / 60); | |
2563 tinyHeaderFont = 1; | |
2564 line = 1; | |
2565 break; | |
2566 | |
2567 /* CNS */ | |
2568 case 7: | |
2569 headerText[2] = TXT_CNS; | |
2570 fCNS = stateUsed->lifeData .cns; | |
2571 if(fCNS > 999) | |
2572 fCNS = 999; | |
2573 snprintf(text,TEXTSIZE,"\020%.0f\016\016%%\017",fCNS); | |
2574 break; | |
2575 | |
2576 /* actual GF */ | |
2577 case 8: | |
2578 headerText[2] = TXT_ActualGradient; | |
2579 snprintf(text,TEXTSIZE,"\020%.0f",100 * pDecoinfoStandard->output_relative_gradient); | |
2580 break; | |
2581 } | |
2582 headerText[3] = 0; | |
2583 | |
2584 if(tinyHeaderFont) | |
2585 GFX_write_string(&FontT24,&t7l3,headerText,0); | |
2586 else | |
2587 GFX_write_string(&FontT42,&t7l3,headerText,0); | |
2588 | |
2589 t7_colorscheme_mod(text); | |
2590 GFX_write_string(&FontT105,&t7l3,text,line); | |
2591 } | |
2592 | |
2593 /* Private functions ---------------------------------------------------------*/ | |
2594 | |
2595 uint8_t t7_customtextPrepare(char * text) | |
2596 { | |
2597 uint8_t i, j, textptr, lineCount; | |
2598 char nextChar; | |
2599 | |
2600 textptr = 0; | |
2601 lineCount = 0; | |
2602 | |
2603 text[textptr++] = TXT_MINIMAL; | |
2604 | |
2605 j = 0; | |
2606 i = 0; | |
2607 do | |
2608 { | |
2609 j += i; | |
2610 i = 0; | |
2611 do | |
2612 { | |
2613 nextChar = settingsGetPointer()->customtext[i+j]; | |
2614 i++; | |
2615 if((!nextChar) || (nextChar =='\n') || (nextChar =='\r')) | |
2616 break; | |
2617 text[textptr++] = nextChar; | |
2618 } while (i < 12); | |
2619 | |
2620 if(!nextChar) | |
2621 break; | |
2622 | |
2623 if(lineCount < 3) | |
2624 { | |
2625 text[textptr++] = '\n'; | |
2626 text[textptr++] = '\r'; | |
2627 } | |
2628 lineCount++; | |
2629 for(uint8_t k=0;k<2;k++) | |
2630 { | |
2631 nextChar = settingsGetPointer()->customtext[i+j+k]; | |
2632 if((nextChar =='\n') || (nextChar =='\r')) | |
2633 i++; | |
2634 else | |
2635 break; | |
2636 } | |
2637 | |
2638 } while (lineCount < 4); | |
2639 | |
2640 text[textptr] = 0; | |
2641 return lineCount; | |
2642 } | |
2643 | |
2644 /* could be extended to search for \020 inside | |
2645 */ | |
2646 void t7_colorscheme_mod(char *text) | |
2647 { | |
2648 if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard()) | |
2649 { | |
2650 text[0] = '\027'; | |
2651 } | |
2652 } | |
2653 | |
2654 | |
2655 void draw_frame(_Bool PluginBoxHeader, _Bool LinesOnTheSides, uint8_t colorBox, uint8_t colorLinesOnTheSide) | |
2656 { | |
2657 point_t LeftLow, WidthHeight; | |
2658 point_t start, stop; | |
2659 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2660 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2661 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2662 |
38 | 2663 // plugin box |
2664 LeftLow.x = CUSTOMBOX_LINE_LEFT; | |
2665 WidthHeight.x = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_LINE_LEFT; | |
2666 LeftLow.y = 60; | |
2667 WidthHeight.y = 440 - LeftLow.y; | |
2668 GFX_draw_box(&t7screen, LeftLow, WidthHeight, 1, colorBox); | |
2669 | |
2670 if(PluginBoxHeader) | |
2671 { | |
2672 // plugin box - header | |
2673 start.x = CUSTOMBOX_LINE_LEFT; | |
2674 stop.x = CUSTOMBOX_LINE_RIGHT; | |
2675 stop.y = start.y = 440 - 60; | |
2676 GFX_draw_line(&t7screen, start, stop, colorBox); | |
2677 } | |
2678 | |
2679 if(LinesOnTheSides) | |
2680 { | |
2681 // aufteilung links | |
2682 start.x = 0; | |
2683 stop.x = CUSTOMBOX_LINE_LEFT; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2684 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2685 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2686 stop.y = start.y = t7l1.WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2687 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2688 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2689 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2690 stop.y = start.y = 480 - t7l1.WindowY1 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2691 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2692 |
38 | 2693 GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide); |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2694 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2695 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2696 stop.y = start.y = t7l2.WindowY0 -1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2697 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2698 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2699 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2700 stop.y = start.y = 480 - t7l2.WindowY1 -1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2701 } |
38 | 2702 GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide); |
2703 | |
2704 // aufteilung rechts | |
2705 start.x = CUSTOMBOX_LINE_RIGHT; | |
2706 stop.x = 799; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2707 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2708 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2709 stop.y = start.y = t7l1.WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2710 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2711 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2712 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2713 stop.y = start.y = 480 - t7l1.WindowY1 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2714 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2715 |
38 | 2716 GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide); |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2717 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2718 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2719 stop.y = start.y = t7l2.WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2720 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2721 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2722 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2723 stop.y = start.y = 480 - t7l2.WindowY1 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2724 } |
38 | 2725 GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide); |
2726 } | |
2727 } | |
2728 | |
2729 | |
2730 /* Compass like TCOS shellfish | |
2731 * input is 0 to 359 | |
2732 * 2 px / 1 degree | |
2733 * Range is 148 degree with CUSTOMBOX_SPACE_INSIDE = 296 | |
2734 * one side is 74 degree (less than 90 degree) | |
2735 * internal 360 + 180 degree of freedom | |
2736 * use positive values only, shift by 360 below 90 mid position | |
2737 */ | |
2738 | |
2739 | |
2740 point_t t7_compass_circle(uint8_t id, uint16_t degree) | |
2741 { | |
2742 float fCos, fSin; | |
2743 const float piMult = ((2 * 3.14159) / 360); | |
2744 // const int radius[4] = {95,105,115,60}; | |
2745 const int radius[4] = {95,105,115,100}; | |
2746 const point_t offset = {.x = 400, .y = 250}; | |
2747 | |
2748 static point_t r[4][360] = { 0 }; | |
2749 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2750 if(r[0][0].y == 0) /* calc table at first call only */ |
38 | 2751 { |
2752 for(int i=0;i<360;i++) | |
2753 { | |
2754 fCos = cos(i * piMult); | |
2755 fSin = sin(i * piMult); | |
2756 for(int j=0;j<4;j++) | |
2757 { | |
2758 r[j][i].x = offset.x + (int)(fSin * radius[j]); | |
2759 r[j][i].y = offset.y + (int)(fCos * radius[j]); | |
2760 } | |
2761 } | |
2762 } | |
2763 if(id > 3) id = 0; | |
2764 if(degree > 359) degree = 0; | |
2765 return r[id][degree]; | |
2766 } | |
2767 | |
2768 /* range should be 0 to 30 bar if 300 meter with 100% of nitrogen or helium | |
2769 * T24 is 28 high | |
2770 */ | |
2771 void t7_tissues(const SDiveState * pState) | |
2772 { | |
2773 point_t start, change, stop; | |
2774 float value; | |
2775 uint16_t front, cns100pixel; | |
2776 char text[256]; | |
2777 uint8_t textpointer = 0; | |
2778 uint8_t color; | |
2779 | |
2780 float percent_N2; | |
2781 float percent_He; | |
2782 float partial_pressure_N2; | |
2783 float partial_pressure_He; | |
2784 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2785 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2786 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2787 |
38 | 2788 |
2789 /* N2 */ | |
2790 t7cY0free.WindowLineSpacing = 28 + 48 + 14; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2791 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2792 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2793 t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2794 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2795 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2796 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2797 t7cY0free.WindowY0 = t7cH.WindowY0 + 15; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2798 t7cY0free.WindowY1 = t7cY0free.WindowY0 + 250; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2799 } |
38 | 2800 t7cY0free.WindowNumberOfTextLines = 3; |
2801 | |
2802 text[textpointer++] = '\030'; | |
2803 text[textpointer++] = TXT_2BYTE; | |
2804 text[textpointer++] = TXT2BYTE_Nitrogen; | |
2805 text[textpointer++] = '\n'; | |
2806 text[textpointer++] = '\r'; | |
2807 text[textpointer++] = TXT_2BYTE; | |
2808 text[textpointer++] = TXT2BYTE_Helium; | |
2809 text[textpointer++] = '\n'; | |
2810 text[textpointer++] = '\r'; | |
2811 text[textpointer++] = TXT_2BYTE; | |
2812 text[textpointer++] = TXT2BYTE_CNS; | |
2813 text[textpointer++] = 0; | |
2814 | |
2815 GFX_write_string(&FontT24, &t7cY0free, text, 1); | |
2816 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2817 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2818 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2819 start.y = t7cH.WindowY0 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2820 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2821 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2822 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2823 start.y = t7cH.WindowY1 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2824 } |
38 | 2825 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
2826 stop.x = start.x + CUSTOMBOX_SPACE_INSIDE; | |
2827 | |
2828 for(int i=0;i<16;i++) | |
2829 { | |
2830 stop.y = start.y; | |
2831 change.y = start.y; | |
2832 | |
2833 value = pState->lifeData.tissue_nitrogen_bar[i] - 0.7512f; | |
2834 value *= 80;//20 | |
2835 | |
2836 if(value < 0) | |
2837 front = 0; | |
2838 else | |
2839 if(value > CUSTOMBOX_SPACE_INSIDE) | |
2840 front = CUSTOMBOX_SPACE_INSIDE; | |
2841 else | |
2842 front = (uint16_t)value; | |
2843 | |
2844 change.x = start.x + front; | |
2845 if(change.x != start.x) | |
2846 GFX_draw_thick_line(1,&t7screen, start, change, CLUT_Font030); | |
2847 if(change.x != stop.x) | |
2848 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font031); | |
2849 | |
2850 start.y -= 3; | |
2851 } | |
2852 | |
2853 /* He */ | |
2854 start.y -= 28 + 14; | |
2855 for(int i=0;i<16;i++) | |
2856 { | |
2857 stop.y = start.y; | |
2858 change.y = start.y; | |
2859 | |
2860 value = pState->lifeData.tissue_helium_bar[i]; | |
2861 value *= 80;//20 | |
2862 | |
2863 if(value < 0) | |
2864 front = 0; | |
2865 else if(value > CUSTOMBOX_SPACE_INSIDE) | |
2866 front = CUSTOMBOX_SPACE_INSIDE; | |
2867 else | |
2868 front = (uint16_t)value; | |
2869 | |
2870 change.x = start.x + front; | |
2871 if(change.x != start.x) | |
2872 GFX_draw_thick_line(1,&t7screen, start, change, CLUT_Font030); | |
2873 if(change.x != stop.x) | |
2874 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font031); | |
2875 | |
2876 start.y -= 3; | |
2877 } | |
2878 | |
2879 /* CNS == Oxygen */ | |
2880 start.y -= 28 + 14; | |
2881 | |
2882 cns100pixel = (8 * CUSTOMBOX_SPACE_INSIDE) / 10; | |
2883 value = pState->lifeData.cns; | |
2884 value *= cns100pixel; | |
2885 value /= 100; | |
2886 | |
2887 if(value < 0) | |
2888 front = 0; | |
2889 else if(value > CUSTOMBOX_SPACE_INSIDE) | |
2890 front = CUSTOMBOX_SPACE_INSIDE; | |
2891 else | |
2892 front = (uint16_t)value; | |
2893 | |
2894 if(pState->lifeData.cns < 95) | |
2895 color = CLUT_Font030; | |
2896 else if(pState->lifeData.cns < 100) | |
2897 color = CLUT_WarningYellow; | |
2898 else | |
2899 color = CLUT_WarningRed; | |
2900 | |
2901 for(int i=0;i<16;i++) | |
2902 { | |
2903 stop.y = start.y; | |
2904 change.y = start.y; | |
2905 | |
2906 change.x = start.x + front; | |
2907 if(change.x != start.x) | |
2908 GFX_draw_thick_line(1,&t7screen, start, change, color); | |
2909 if(change.x != stop.x) | |
2910 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font031); | |
2911 | |
2912 start.y -= 3; | |
2913 } | |
2914 | |
2915 /* where is the onload/offload limit for N2 and He */ | |
2916 decom_get_inert_gases(pState->lifeData.pressure_ambient_bar, &pState->lifeData.actualGas, &percent_N2, &percent_He); | |
2917 partial_pressure_N2 = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_N2; | |
2918 partial_pressure_He = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_He; | |
2919 | |
2920 // Nitrogen vertical bar | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2921 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2922 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2923 start.y = t7cH.WindowY0 + 1 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2924 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2925 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2926 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2927 start.y = t7cH.WindowY1 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2928 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2929 |
38 | 2930 stop.y = start.y - (3 * 15) - 1; |
2931 if((percent_N2 > 0) && (partial_pressure_N2 > 0.8f))//(0.8f + 0.5f))) | |
2932 { | |
2933 value = partial_pressure_N2; | |
2934 value *= 80;//20 | |
2935 | |
2936 if(value < 0) | |
2937 front = 3; | |
2938 else if(value + 5 > CUSTOMBOX_SPACE_INSIDE) | |
2939 front = CUSTOMBOX_SPACE_INSIDE - 3; | |
2940 else | |
2941 front = (uint16_t)value; | |
2942 } | |
2943 else | |
2944 { | |
2945 front = 1; | |
2946 } | |
2947 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + front; | |
2948 stop.x = start.x; | |
2949 GFX_draw_thick_line(2,&t7screen, start, stop, CLUT_EverythingOkayGreen); | |
2950 | |
2951 | |
2952 // Helium vertical bar | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2953 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2954 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2955 start.y = t7cH.WindowY0 + 1 - 5 - 3*16 - 28 - 14; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2956 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2957 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2958 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2959 start.y = t7cH.WindowY1 - 5 - 3*16 - 28 - 14; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2960 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2961 |
38 | 2962 stop.y = start.y - (3 * 15) - 1; |
2963 if((percent_He > 0) && (partial_pressure_He > 0.01f)) // 0.5f | |
2964 { | |
2965 | |
2966 value = partial_pressure_He; | |
2967 value *= 80;//20 | |
2968 | |
2969 if(value < 0) | |
2970 front = 3; | |
2971 else if(value + 5 > CUSTOMBOX_SPACE_INSIDE) | |
2972 front = CUSTOMBOX_SPACE_INSIDE - 3; | |
2973 else | |
2974 front = (uint16_t)value; | |
2975 } | |
2976 else | |
2977 { | |
2978 front = 1; | |
2979 } | |
2980 | |
2981 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + front; | |
2982 stop.x = start.x; | |
2983 GFX_draw_thick_line(2,&t7screen, start, stop, CLUT_EverythingOkayGreen); | |
2984 | |
2985 // Oxygen vertical bar | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2986 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2987 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2988 start.y = t7cH.WindowY0 + 1 - 5 - 6*16 - 2*28 - 2*14; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2989 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2990 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2991 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2992 start.y = t7cH.WindowY1 - 5 - 6*16 - 2*28 - 2*14; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2993 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2994 |
38 | 2995 stop.y = start.y - (3 * 15) - 1; |
2996 | |
2997 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + cns100pixel; | |
2998 stop.x = start.x; | |
2999 GFX_draw_thick_line(2, &t7screen, start, stop, CLUT_WarningRed); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3000 |
38 | 3001 } |
3002 | |
3003 | |
3004 void t7_debug(void) | |
3005 { | |
3006 char text[256+50]; | |
3007 uint8_t textpointer = 0; | |
3008 | |
3009 t7cY0free.WindowLineSpacing = 28 + 48 + 14; | |
3010 t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing; | |
3011 t7cY0free.WindowNumberOfTextLines = 3; | |
3012 | |
3013 textpointer += snprintf(&text[textpointer],50,"Ambient [bar]\n\r"); | |
3014 textpointer += snprintf(&text[textpointer],50,"Surface [bar] + salt\n\r"); | |
3015 // textpointer += snprintf(&text[textpointer],50,"Difference [mbar]\n\r"); | |
3016 textpointer += snprintf(&text[textpointer],50,"ShallowCounter [s]\n\r"); | |
3017 GFX_write_string(&FontT24, &t7cY0free, text, 1); | |
3018 | |
3019 t7cY0free.WindowY0 -= 52; | |
3020 // snprintf(text,60,"%0.2f\n\r%0.2f %u%%\n\r%0.0f",stateUsed->lifeData.pressure_ambient_bar, stateUsed->lifeData.pressure_surface_bar, settingsGetPointer()->salinity, 1000 * (stateUsed->lifeData.pressure_ambient_bar-stateUsed->lifeData.pressure_surface_bar)); | |
3021 snprintf(text,60, | |
3022 "%0.2f\n\r" | |
3023 "%0.2f %u%%\n\r" | |
3024 "%u" | |
3025 ,stateUsed->lifeData.pressure_ambient_bar | |
3026 ,stateUsed->lifeData.pressure_surface_bar | |
3027 ,settingsGetPointer()->salinity | |
3028 ,stateUsed->lifeData.counterSecondsShallowDepth); | |
3029 GFX_write_string(&FontT42, &t7cY0free, text, 1); | |
3030 } | |
3031 | |
3032 | |
3033 void t7_SummaryOfLeftCorner(void) | |
3034 { | |
3035 char text[256+60]; | |
3036 uint8_t textpointer = 0; | |
3037 | |
3038 const SDecoinfo * pDecoinfoStandard; | |
3039 const SDecoinfo * pDecoinfoFuture; | |
3040 float fCNS; | |
3041 | |
3042 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
3043 { | |
3044 pDecoinfoStandard = &stateUsed->decolistBuehlmann; | |
3045 pDecoinfoFuture = &stateUsed->decolistFutureBuehlmann; | |
3046 } | |
3047 else | |
3048 { | |
3049 pDecoinfoStandard = &stateUsed->decolistVPM; | |
3050 pDecoinfoFuture = &stateUsed->decolistFutureVPM; | |
3051 } | |
3052 | |
3053 fCNS = stateUsed->lifeData .cns; | |
3054 if(fCNS > 999) | |
3055 fCNS = 999; | |
3056 | |
3057 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; | |
3058 t7cY0free.WindowLineSpacing = 48; | |
3059 t7cY0free.WindowNumberOfTextLines = 6; | |
3060 t7cY0free.WindowTab = 420; | |
3061 | |
3062 // header | |
3063 textpointer = 0; | |
3064 text[textpointer++] = '\032'; | |
3065 text[textpointer++] = '\016'; | |
3066 text[textpointer++] = '\016'; | |
3067 text[textpointer++] = TXT_ppO2; | |
3068 text[textpointer++] = '\n'; | |
3069 text[textpointer++] = '\r'; | |
3070 text[textpointer++] = TXT_Ceiling; | |
3071 text[textpointer++] = '\n'; | |
3072 text[textpointer++] = '\r'; | |
3073 text[textpointer++] = TXT_ActualGradient; | |
3074 text[textpointer++] = '\n'; | |
3075 text[textpointer++] = '\r'; | |
3076 text[textpointer++] = TXT_CNS; | |
3077 text[textpointer++] = '\n'; | |
3078 text[textpointer++] = '\r'; | |
3079 text[textpointer++] = TXT_FutureTTS; | |
3080 text[textpointer++] = '\017'; | |
3081 text[textpointer++] = 0; | |
3082 t7cY0free.WindowX0 += 10; | |
3083 t7cY0free.WindowY0 += 10; | |
3084 GFX_write_string(&FontT24, &t7cY0free, text, 1); | |
3085 t7cY0free.WindowX0 -= 10; | |
3086 t7cY0free.WindowY0 -= 10; | |
3087 | |
3088 textpointer = 0; | |
3089 text[textpointer++] = '\t'; | |
3090 textpointer += snprintf(&text[textpointer],10,"\020%01.2f", stateUsed->lifeData.ppO2); | |
3091 text[textpointer++] = '\n'; | |
3092 text[textpointer++] = '\r'; | |
3093 text[textpointer++] = '\t'; | |
3094 if((pDecoinfoStandard->output_ceiling_meter > 99.9f) || (settingsGetPointer()->nonMetricalSystem)) | |
3095 textpointer += snprintf(&text[textpointer],10,"\020%01.1f",unit_depth_float(pDecoinfoStandard->output_ceiling_meter)); | |
3096 else | |
3097 textpointer += snprintf(&text[textpointer],10,"\020%01.0f",pDecoinfoStandard->output_ceiling_meter); | |
3098 text[textpointer++] = '\n'; | |
3099 text[textpointer++] = '\r'; | |
3100 text[textpointer++] = '\t'; | |
3101 textpointer += snprintf(&text[textpointer],10,"\020%.0f", 100 * pDecoinfoStandard->output_relative_gradient); | |
3102 text[textpointer++] = '\n'; | |
3103 text[textpointer++] = '\r'; | |
3104 text[textpointer++] = '\t'; | |
3105 textpointer += snprintf(&text[textpointer],10,"\020%.0f\016\016%%\017",fCNS); | |
3106 text[textpointer++] = '\n'; | |
3107 text[textpointer++] = '\r'; | |
3108 text[textpointer++] = '\t'; | |
3109 textpointer += snprintf(&text[textpointer],10,"\020%i'", pDecoinfoFuture->output_time_to_surface_seconds / 60); | |
3110 text[textpointer++] = 0; | |
3111 GFX_write_string(&FontT42, &t7cY0free, text, 1); | |
3112 } | |
3113 | |
3114 | |
3115 | |
3116 | |
3117 /* | |
3118 point_t start, change, stop; | |
3119 float value; | |
3120 uint16_t front; | |
3121 uint8_t color; | |
3122 | |
3123 | |
3124 start.y = t7cH.WindowY0 - 5; | |
3125 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
3126 stop.x = start.x + CUSTOMBOX_SPACE_INSIDE; | |
3127 | |
3128 | |
3129 for(int i=0;i<16;i++) | |
3130 { | |
3131 stop.y = start.y; | |
3132 change.y = start.y; | |
3133 | |
3134 value = pState->lifeData.tissue_nitrogen_bar[i] - 0.7512f; | |
3135 value *= 20; | |
3136 | |
3137 if(value < 0) | |
3138 front = 0; | |
3139 else | |
3140 if(value > CUSTOMBOX_SPACE_INSIDE) | |
3141 front = CUSTOMBOX_SPACE_INSIDE; | |
3142 else | |
3143 front = (uint16_t)value; | |
3144 | |
3145 change.x = start.x + front; | |
3146 if(change.x != start.x) | |
3147 GFX_draw_thick_line(1,&t7screen, start, change, CLUT_Font020); | |
3148 if(change.x != stop.x) | |
3149 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font021); | |
3150 | |
3151 start.y -= 3; | |
3152 } | |
3153 | |
3154 // He | |
3155 start.y -= 28 + 14; | |
3156 for(int i=0;i<16;i++) | |
3157 { | |
3158 stop.y = start.y; | |
3159 change.y = start.y; | |
3160 | |
3161 value = pState->lifeData.tissue_helium_bar[i]; | |
3162 value *= 20; | |
3163 | |
3164 if(value < 0) | |
3165 front = 0; | |
3166 else | |
3167 if(value > CUSTOMBOX_SPACE_INSIDE) | |
3168 front = CUSTOMBOX_SPACE_INSIDE; | |
3169 else | |
3170 front = (uint16_t)value; | |
3171 | |
3172 change.x = start.x + front; | |
3173 if(change.x != start.x) | |
3174 GFX_draw_thick_line(1,&t7screen, start, change, CLUT_Font020); | |
3175 if(change.x != stop.x) | |
3176 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font021); | |
3177 | |
3178 start.y -= 3; | |
3179 } | |
3180 | |
3181 // CNS == Oxygen | |
3182 start.y -= 28 + 14; | |
3183 | |
3184 value = pState->lifeData.cns; | |
3185 value *= (CUSTOMBOX_SPACE_INSIDE/2); | |
3186 value /= 100; | |
3187 | |
3188 if(value < 0) | |
3189 front = 0; | |
3190 else | |
3191 if(value > CUSTOMBOX_SPACE_INSIDE) | |
3192 front = CUSTOMBOX_SPACE_INSIDE; | |
3193 else | |
3194 front = (uint16_t)value; | |
3195 | |
3196 if(pState->lifeData.cns < 95) | |
3197 color = CLUT_Font020; | |
3198 else | |
3199 if(pState->lifeData.cns < 100) | |
3200 color = CLUT_WarningYellow; | |
3201 else | |
3202 color = CLUT_WarningRed; | |
3203 | |
3204 for(int i=0;i<16;i++) | |
3205 { | |
3206 stop.y = start.y; | |
3207 change.y = start.y; | |
3208 | |
3209 change.x = start.x + front; | |
3210 if(change.x != start.x) | |
3211 GFX_draw_thick_line(1,&t7screen, start, change, color); | |
3212 if(change.x != stop.x) | |
3213 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font021); | |
3214 | |
3215 start.y -= 3; | |
3216 } | |
3217 | |
3218 // where is the onload/offload limit for N2 and He | |
3219 decom_get_inert_gases(pState->lifeData.pressure_ambient_bar, &pState->lifeData.actualGas, &percent_N2, &percent_He); | |
3220 partial_pressure_N2 = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_N2; | |
3221 partial_pressure_He = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_He; | |
3222 | |
3223 if((percent_N2 > 0) && (partial_pressure_N2 > (0.8f + 0.5f))) | |
3224 { | |
3225 start.y = t7cH.WindowY0 + 1 - 5; | |
3226 stop.y = start.y - (3 * 15) - 1; | |
3227 | |
3228 value = partial_pressure_N2; | |
3229 value *= 20; | |
3230 | |
3231 if(value < 0) | |
3232 front = 3; | |
3233 else | |
3234 if(value + 5 > CUSTOMBOX_SPACE_INSIDE) | |
3235 front = CUSTOMBOX_SPACE_INSIDE - 3; | |
3236 else | |
3237 front = (uint16_t)value; | |
3238 | |
3239 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + front; | |
3240 stop.x = start.x; | |
3241 GFX_draw_thick_line(2,&t7screen, start, stop, CLUT_EverythingOkayGreen); | |
3242 } | |
3243 | |
3244 if((percent_He > 0) && (partial_pressure_He > 0.5f)) | |
3245 { | |
3246 start.y = t7cH.WindowY0 + 1 - 5 - 3*16 - 28 - 14; | |
3247 stop.y = start.y - (3 * 15) - 1; | |
3248 | |
3249 value = partial_pressure_He; | |
3250 value *= 20; | |
3251 | |
3252 if(value < 0) | |
3253 front = 3; | |
3254 else | |
3255 if(value + 5 > CUSTOMBOX_SPACE_INSIDE) | |
3256 front = CUSTOMBOX_SPACE_INSIDE - 3; | |
3257 else | |
3258 front = (uint16_t)value; | |
3259 | |
3260 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + front; | |
3261 stop.x = start.x; | |
3262 GFX_draw_thick_line(2,&t7screen, start, stop, CLUT_EverythingOkayGreen); | |
3263 } | |
3264 | |
3265 start.y = t7cH.WindowY0 + 1 - 5 - 6*16 - 2*28 - 2*14; | |
3266 stop.y = start.y - (3 * 15) - 1; | |
3267 | |
3268 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + CUSTOMBOX_SPACE_INSIDE/2; | |
3269 stop.x = start.x; | |
3270 GFX_draw_thick_line(2, &t7screen, start, stop, CLUT_WarningRed); | |
3271 */ | |
3272 | |
3273 /* | |
3274 void t7_clock(void) | |
3275 { | |
3276 point_t start, stop; | |
3277 | |
3278 | |
3279 for(uint16_t i=0;i<360;i+=30) | |
3280 { | |
3281 start = t7_compass_circle(1,i); | |
3282 stop = t7_compass_circle(2,i); | |
3283 start.x += 280; // standard center is 400, 250 | |
3284 stop.x += 280; | |
3285 GFX_draw_thick_line(5,&t7screen, start, stop, CLUT_CompassSubTick); | |
3286 | |
3287 start.x = 400+280; | |
3288 start.y = 250; | |
3289 stop = t7_compass_circle(2,58); | |
3290 stop.x += 280; | |
3291 GFX_draw_thick_line(3,&t7screen, start, stop, CLUT_CompassNorthTick); | |
3292 stop = t7_compass_circle(0,302); | |
3293 stop.x += 280; | |
3294 GFX_draw_thick_line(3,&t7screen, start, stop, CLUT_CompassNorthTick); | |
3295 } | |
3296 } | |
3297 */ | |
3298 | |
3299 //static float testCC = 180; | |
3300 void t7_compass(uint16_t ActualHeading, uint16_t UserSetHeading) | |
3301 { | |
3302 | |
3303 /* | |
3304 static uint16_t lastHeading = 0; | |
3305 float differenceCompass, resultKalman; | |
3306 | |
3307 if(testCC > lastHeading) | |
3308 differenceCompass = testCC - lastHeading; | |
3309 else | |
3310 differenceCompass = lastHeading - testCC; | |
3311 | |
3312 resultKalman = Kalman_getAngle(differenceCompass, 2, 0.1); | |
3313 if(testCC > lastHeading) | |
3314 ActualHeading = lastHeading + resultKalman; | |
3315 else | |
3316 ActualHeading = lastHeading - resultKalman; | |
3317 | |
3318 lastHeading = ActualHeading; | |
3319 */ | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3320 uint16_t ActualHeadingRose; |
38 | 3321 uint16_t LeftBorderHeading, LineHeading; |
3322 uint32_t offsetPicture; | |
3323 point_t start, stop, center; | |
3324 static int32_t LastHeading = 0; | |
3325 int32_t newHeading = 0; | |
3326 int32_t diff = 0; | |
3327 int32_t diff2 = 0; | |
3328 | |
3329 int32_t diffAbs = 0; | |
3330 int32_t diffAbs2 = 0; | |
3331 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3332 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3333 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3334 |
38 | 3335 newHeading = ActualHeading; |
3336 | |
3337 diff = newHeading - LastHeading; | |
3338 | |
3339 if(newHeading < LastHeading) | |
3340 diff2 = newHeading + 360 - LastHeading; | |
3341 else | |
3342 diff2 = newHeading - 360 - LastHeading; | |
3343 | |
3344 diffAbs = diff; | |
3345 if(diffAbs < 0) | |
3346 diffAbs *= -1; | |
3347 | |
3348 diffAbs2 = diff2; | |
3349 if(diffAbs2 < 0) | |
3350 diffAbs2 *= -1; | |
3351 | |
3352 | |
3353 if(diffAbs <= diffAbs2) | |
3354 newHeading = LastHeading + (diff / 2); | |
3355 else | |
3356 newHeading = LastHeading + (diff2 / 2); | |
3357 | |
3358 if(newHeading < 0) | |
3359 newHeading += 360; | |
3360 else | |
3361 if(newHeading >= 360) | |
3362 newHeading -= 360; | |
3363 | |
3364 LastHeading = newHeading; | |
3365 ActualHeading = newHeading; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3366 ActualHeadingRose = ActualHeading; |
38 | 3367 /* |
3368 if (ActualHeading < 90) | |
3369 ActualHeading += 360; | |
3370 | |
3371 if(ActualHeading > LastHeading) | |
3372 { | |
3373 if((ActualHeading - LastHeading) < 25) | |
3374 ActualHeading = LastHeading + 1; | |
3375 } | |
3376 else | |
3377 if(ActualHeading < LastHeading) | |
3378 { | |
3379 if((LastHeading - ActualHeading) < 25) | |
3380 ActualHeading = LastHeading - 1; | |
3381 } | |
3382 */ | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3383 if(pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3384 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3385 ActualHeadingRose = 360 - ActualHeadingRose; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3386 if (ActualHeadingRose < 170) ActualHeadingRose += 360; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3387 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3388 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3389 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3390 if (ActualHeadingRose < 90) ActualHeadingRose += 360; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3391 ActualHeading = ActualHeadingRose; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3392 } |
38 | 3393 |
3394 // new hw 160822 | |
3395 // if (ActualHeading >= 360 + 90) | |
3396 // ActualHeading = 360; | |
3397 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3398 LeftBorderHeading = 2 * (ActualHeadingRose - (CUSTOMBOX_SPACE_INSIDE/4)); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3399 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3400 if(pSettings->FlipDisplay) /* add offset caused by mirrowed drawing */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3401 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3402 LeftBorderHeading += 2 * 80; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3403 } |
38 | 3404 |
3405 offsetPicture = LeftBorderHeading * t7screenCompass.ImageHeight * 2; | |
3406 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3407 /* the background is used to draw the rotating compass rose */ |
38 | 3408 background.pointer = t7screenCompass.FBStartAdress+offsetPicture; |
3409 background.x0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3410 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3411 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3412 background.y0 = 65; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3413 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3414 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3415 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3416 background.y0 = 480 - t7screenCompass.ImageHeight - 65; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3417 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3418 |
38 | 3419 background.width = CUSTOMBOX_SPACE_INSIDE; |
3420 background.height = t7screenCompass.ImageHeight; | |
3421 | |
3422 | |
3423 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + (CUSTOMBOX_SPACE_INSIDE/2); | |
3424 stop.x = start.x; | |
3425 start.y = 65; | |
3426 stop.y = start.y + 55; | |
3427 GFX_draw_line(&t7screen, start, stop, CLUT_Font030); | |
3428 | |
3429 | |
3430 center.x = start.x; | |
3431 center.y = 300; | |
3432 | |
3433 stop.x = center.x + 44; | |
3434 stop.y = center.y + 24; | |
3435 | |
3436 | |
3437 while(ActualHeading > 359) ActualHeading -= 360; | |
3438 | |
3439 LineHeading = 360 - ActualHeading; | |
3440 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(0,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font030); // North | |
3441 LineHeading += 90; | |
3442 if(LineHeading > 359) LineHeading -= 360; | |
3443 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); // Maintick | |
3444 LineHeading += 90; | |
3445 if(LineHeading > 359) LineHeading -= 360; | |
3446 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3447 LineHeading += 90; | |
3448 if(LineHeading > 359) LineHeading -= 360; | |
3449 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3450 | |
3451 LineHeading = 360 - ActualHeading; | |
3452 LineHeading += 45; | |
3453 if(LineHeading > 359) LineHeading -= 360; | |
3454 GFX_draw_thick_line(5,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); // Subtick | |
3455 LineHeading += 90; | |
3456 if(LineHeading > 359) LineHeading -= 360; | |
3457 GFX_draw_thick_line(5,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3458 LineHeading += 90; | |
3459 if(LineHeading > 359) LineHeading -= 360; | |
3460 GFX_draw_thick_line(5,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3461 LineHeading += 90; | |
3462 if(LineHeading > 359) LineHeading -= 360; | |
3463 GFX_draw_thick_line(5,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3464 | |
3465 LineHeading = 360 - ActualHeading; | |
3466 LineHeading += 22; | |
3467 if(LineHeading > 359) LineHeading -= 360; | |
3468 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); // Subtick | |
3469 LineHeading += 45; | |
3470 if(LineHeading > 359) LineHeading -= 360; | |
3471 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3472 LineHeading += 45; | |
3473 if(LineHeading > 359) LineHeading -= 360; | |
3474 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3475 LineHeading += 45; | |
3476 if(LineHeading > 359) LineHeading -= 360; | |
3477 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3478 LineHeading += 45; | |
3479 if(LineHeading > 359) LineHeading -= 360; | |
3480 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); // Subtick | |
3481 LineHeading += 45; | |
3482 if(LineHeading > 359) LineHeading -= 360; | |
3483 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3484 LineHeading += 45; | |
3485 if(LineHeading > 359) LineHeading -= 360; | |
3486 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3487 LineHeading += 45; | |
3488 if(LineHeading > 359) LineHeading -= 360; | |
3489 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3490 | |
3491 if(UserSetHeading) | |
3492 { | |
3493 LineHeading = UserSetHeading + 360 - ActualHeading; | |
3494 if(LineHeading > 359) LineHeading -= 360; | |
3495 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(3,LineHeading), t7_compass_circle(2,LineHeading), CLUT_CompassUserHeadingTick); | |
3496 | |
3497 // R�ckpeilung, User Back Heading | |
3498 LineHeading = UserSetHeading + 360 + 180 - ActualHeading; | |
3499 if(LineHeading > 359) LineHeading -= 360; | |
3500 if(LineHeading > 359) LineHeading -= 360; | |
3501 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(3,LineHeading), t7_compass_circle(2,LineHeading), CLUT_CompassUserBackHeadingTick); | |
3502 } | |
3503 | |
3504 center.x = start.x; | |
3505 center.y = 250; | |
3506 GFX_draw_circle(&t7screen, center, 116, CLUT_Font030); | |
3507 GFX_draw_circle(&t7screen, center, 118, CLUT_Font030); | |
3508 GFX_draw_circle(&t7screen, center, 117, CLUT_Font030); | |
3509 | |
3510 | |
3511 } | |
3512 | |
3513 | |
3514 /* Font_T42: N is 27 px, S is 20 px, W is 36 px, E is 23 px | |
3515 * max is NW with 63 px | |
3516 * Font_T24: N is 15 px, S is 12 px, W is 20 px, E is 13 px | |
3517 * max is NW with 35 px | |
3518 * NE is 28 px | |
3519 * SW is 32 px | |
3520 * SE is 25 px | |
3521 * space between each is 45 px * 2 | |
3522 * FirstItem List | |
3523 * \177 \177 prepare for size | |
3524 */ | |
3525 void init_t7_compass(void) | |
3526 { | |
3527 t7screenCompass.FBStartAdress = getFrame(21); | |
3528 | |
3529 char text[256]; | |
3530 uint8_t textpointer = 0; | |
3531 | |
3532 text[textpointer++] = '\030'; | |
3533 text[textpointer++] = '\177'; | |
3534 text[textpointer++] = '\177'; | |
3535 text[textpointer++] = 76; // 90 - 14 | |
3536 text[textpointer++] = '\016'; | |
3537 text[textpointer++] = '\016'; | |
3538 text[textpointer++] = 'N'; | |
3539 text[textpointer++] = 'E'; // 96 + 28 = 124 total | |
3540 text[textpointer++] = '\017'; | |
3541 text[textpointer++] = '\177'; | |
3542 text[textpointer++] = '\177'; | |
3543 text[textpointer++] = 64; // 90 - 14 - 12 | |
3544 text[textpointer++] = 'E'; // 124 + 74 + 23 = 221 total | |
3545 text[textpointer++] = '\177'; | |
3546 text[textpointer++] = '\177'; | |
3547 text[textpointer++] = 66; // 90 - 11 - 13 | |
3548 text[textpointer++] = '\016'; | |
3549 text[textpointer++] = '\016'; | |
3550 text[textpointer++] = 'S'; | |
3551 text[textpointer++] = 'E'; | |
3552 text[textpointer++] = '\017'; | |
3553 text[textpointer++] = '\177'; | |
3554 text[textpointer++] = '\177'; | |
3555 text[textpointer++] = 68; // 90 - 12 - 10 | |
3556 text[textpointer++] = 'S'; | |
3557 text[textpointer++] = '\177'; | |
3558 text[textpointer++] = '\177'; | |
3559 text[textpointer++] = 64; // 90 - 10 - 16 | |
3560 text[textpointer++] = '\016'; | |
3561 text[textpointer++] = '\016'; | |
3562 text[textpointer++] = 'S'; | |
3563 text[textpointer++] = 'W'; | |
3564 text[textpointer++] = '\017'; | |
3565 text[textpointer++] = '\177'; | |
3566 text[textpointer++] = '\177'; | |
3567 text[textpointer++] = 56; // 90 - 16 - 18 | |
3568 text[textpointer++] = 'W'; | |
3569 text[textpointer++] = '\177'; | |
3570 text[textpointer++] = '\177'; | |
3571 text[textpointer++] = 54; // 90 - 18 - 18 | |
3572 text[textpointer++] = '\016'; | |
3573 text[textpointer++] = '\016'; | |
3574 text[textpointer++] = 'N'; | |
3575 text[textpointer++] = 'W'; | |
3576 text[textpointer++] = '\017'; | |
3577 text[textpointer++] = '\177'; | |
3578 text[textpointer++] = '\177'; | |
3579 text[textpointer++] = 59; // 90 - 17 - 14 | |
3580 text[textpointer++] = 'N'; | |
3581 text[textpointer++] = '\177'; | |
3582 text[textpointer++] = '\177'; | |
3583 text[textpointer++] = 63; // 90 - 13 - 14 | |
3584 text[textpointer++] = '\016'; | |
3585 text[textpointer++] = '\016'; | |
3586 text[textpointer++] = 'N'; | |
3587 text[textpointer++] = 'E'; | |
3588 text[textpointer++] = '\017'; | |
3589 text[textpointer++] = '\177'; | |
3590 text[textpointer++] = '\177'; | |
3591 text[textpointer++] = 64; // 90 - 14 - 12 | |
3592 text[textpointer++] = 'E'; | |
3593 text[textpointer++] = '\177'; | |
3594 text[textpointer++] = '\177'; | |
3595 text[textpointer++] = 66; // 90 - 11 - 13 | |
3596 text[textpointer++] = '\016'; | |
3597 text[textpointer++] = '\016'; | |
3598 text[textpointer++] = 'S'; | |
3599 text[textpointer++] = 'E'; | |
3600 text[textpointer++] = '\017'; | |
3601 text[textpointer++] = '\177'; | |
3602 text[textpointer++] = '\177'; | |
3603 text[textpointer++] = 68; // 90 - 12 - 10 | |
3604 text[textpointer++] = 'S'; | |
3605 text[textpointer++] = '\177'; | |
3606 text[textpointer++] = '\177'; | |
3607 text[textpointer++] = 64; // 90 - 10 - 16 | |
3608 text[textpointer++] = '\016'; | |
3609 text[textpointer++] = '\016'; | |
3610 text[textpointer++] = 'S'; | |
3611 text[textpointer++] = 'W'; | |
3612 text[textpointer++] = '\017'; | |
3613 text[textpointer++] = 0; // end | |
3614 | |
3615 GFX_write_string(&FontT42,&t7pCompass,text,1); | |
3616 | |
3617 releaseAllFramesExcept(21,t7screenCompass.FBStartAdress); | |
3618 } | |
3619 | |
3620 | |
3621 void t7_miniLiveLogProfile(void) | |
3622 { | |
3623 SWindowGimpStyle wintemp; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3624 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3625 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3626 |
38 | 3627 wintemp.left = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
3628 wintemp.right = wintemp.left + CUSTOMBOX_SPACE_INSIDE; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3629 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3630 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3631 wintemp.top = 480 - t7l1.WindowY0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3632 wintemp.bottom = wintemp. top + 200; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3633 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3634 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3635 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3636 wintemp.top = t7l1.WindowY1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3637 wintemp.bottom = wintemp. top + 200; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3638 } |
38 | 3639 |
3640 uint16_t max_depth = (uint16_t)(stateUsed->lifeData.max_depth_meter * 10); | |
3641 | |
3642 GFX_graph_print(&t7screen, &wintemp, 0,1,0, max_depth, getMiniLiveLogbookPointerToData(), getMiniLiveLogbookActualDataLength(), CLUT_Font030, NULL); | |
3643 } | |
3644 | |
3645 void t7_logo_OSTC(void) | |
3646 { | |
3647 SWindowGimpStyle windowGimp; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3648 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3649 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3650 |
38 | 3651 /* OSTC logo */ |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3652 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3653 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3654 windowGimp.left = t7l1.WindowX1 + 32; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3655 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3656 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3657 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3658 windowGimp.left = t7r1.WindowX1 + 32; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3659 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3660 |
38 | 3661 windowGimp.top = 40 + 32; |
3662 GFX_draw_image_monochrome(&t7screen, windowGimp, &ImgOSTC, 0); | |
3663 } |