Mercurial > public > ostc4
annotate Discovery/Src/t7.c @ 169:842f57bbaaad cleanup-1
Bugfix: highlight the menu underline correctly on selected state
This fixes an optical bug. In dive and simulation mode, the
underline in the top menu was not highlighted correctly for the
DECO ans SYS submenu's. The check when to highlight simply was not
correct. And, yes, this part of the code is rather obfuscated, and
deserves some attention later on.
Reported-by: Matthias Heinrichs <matthias.heinrichs@heinrichsweikamp.com>
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Sun, 10 Mar 2019 10:09:58 +0100 |
parents | 255eedad4155 |
children | ecb71521d004 |
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 */ | |
2015 float depth = 0; | |
2016 float depthThisCall = unit_depth_float(stateUsed->lifeData.depth_meter); | |
2017 if(is_stateUsedSetToSim()) | |
2018 { | |
2019 depth = (depthThisCall + depthLastCall[0] + depthLastCall[1] + depthLastCall[2] + depthLastCall[3] + depthLastCall[4] + depthLastCall[5] + depthLastCall[6] + depthLastCall[7] + depthLastCall[8]) / 10.0f; | |
2020 | |
2021 idDepthLastCall++; | |
2022 if(idDepthLastCall >= 9) | |
2023 idDepthLastCall = 0; | |
2024 depthLastCall[idDepthLastCall] = depthThisCall; | |
2025 } | |
2026 else | |
2027 { | |
2028 depth = (depthThisCall + depthLastCall[0] + depthLastCall[1] + depthLastCall[2]) / 4.0f; | |
2029 | |
2030 idDepthLastCall++; | |
2031 if(idDepthLastCall >= 3) | |
2032 idDepthLastCall = 0; | |
2033 depthLastCall[idDepthLastCall] = depthThisCall; | |
2034 } | |
2035 | |
2036 if(depth <= 0.3f) | |
2037 depth = 0; | |
2038 | |
2039 if(settingsGetPointer()->nonMetricalSystem) | |
2040 snprintf(TextL1,TEXTSIZE,"\032\f[feet]"); | |
2041 else | |
2042 snprintf(TextL1,TEXTSIZE,"\032\f%c",TXT_Depth); | |
2043 GFX_write_string(&FontT24,&t7l1,TextL1,0); | |
2044 | |
2045 if((stateUsed->lifeData.ascent_rate_meter_per_min > 8) || (stateUsed->lifeData.ascent_rate_meter_per_min < -10)) | |
2046 { | |
2047 snprintf(TextL1,TEXTSIZE,"\f\002%.0f %c%c/min " | |
2048 , unit_depth_float(stateUsed->lifeData.ascent_rate_meter_per_min) | |
2049 , unit_depth_char1() | |
2050 , unit_depth_char2() | |
2051 ); | |
2052 GFX_write_string(&FontT24,&t7l1,TextL1,0); | |
2053 } | |
2054 | |
2055 if( depth < 100) | |
2056 snprintf(TextL1,TEXTSIZE,"\020%01.1f",depth); | |
2057 else | |
2058 snprintf(TextL1,TEXTSIZE,"\020%01.0f",depth); | |
2059 | |
2060 t7_colorscheme_mod(TextL1); | |
2061 GFX_write_string(&FontT144,&t7l1,TextL1,1); | |
2062 | |
2063 /* max depth */ | |
2064 snprintf(TextL2,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
2065 GFX_write_string(&FontT42,&t7l2,TextL2,0); | |
2066 | |
2067 if(unit_depth_float(stateUsed->lifeData.max_depth_meter) < 100) | |
2068 snprintf(TextL2,TEXTSIZE,"\020%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
2069 else | |
2070 snprintf(TextL2,TEXTSIZE,"\020%01.0f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
2071 | |
2072 t7_colorscheme_mod(TextL2); | |
2073 GFX_write_string(&FontT105,&t7l2,TextL2,1); | |
2074 | |
2075 /* ascentrate graph */ | |
2076 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) | |
2077 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2078 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2079 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2080 start.y = t7l1.WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2081 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2082 else |
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 = t7l3.WindowY0 - 25; |
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 |
38 | 2087 for(int i = 0; i<4;i++) |
2088 { | |
2089 start.y += 5*6; | |
2090 stop.y = start.y; | |
2091 start.x = CUSTOMBOX_LINE_LEFT - 1; | |
2092 stop.x = start.x - 17; | |
2093 GFX_draw_line(&t7screen, start, stop, 0); | |
2094 // start.x = CUSTOMBOX_LINE_RIGHT + 2; old right too | |
2095 // stop.x = start.x + 17; | |
2096 // GFX_draw_line(&t7screen, start, stop, 0); | |
2097 } | |
2098 // new thick bar design Sept. 2015 | |
2099 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 3 - 5; | |
2100 stop.x = start.x; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2101 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2102 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2103 start.y = t7l1.WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2104 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2105 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2106 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2107 start.y = t7l3.WindowY0 - 25; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2108 } |
38 | 2109 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 6); |
2110 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9 | |
2111 if(stop.y >= 470) | |
2112 stop.y = 470; | |
2113 start.y += 7; // starte etwas weiter oben | |
2114 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 10) | |
2115 color = CLUT_EverythingOkayGreen; | |
2116 else | |
2117 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 15) | |
2118 color = CLUT_WarningYellow; | |
2119 else | |
2120 color = CLUT_WarningRed; | |
2121 | |
2122 GFX_draw_thick_line(12,&t7screen, start, stop, color); | |
2123 } | |
2124 //snprintf(TextL2,TEXTSIZE,"\f%.1f m/min",stateUsed->lifeData.ascent_rate_meter_per_min); | |
2125 | |
2126 /* divetime */ | |
2127 if(stateUsed->lifeData.counterSecondsShallowDepth) | |
2128 { | |
2129 snprintf(TextR1,TEXTSIZE,"\f\002\136 %u:%02u",TimeoutTime.Minutes, TimeoutTime.Seconds); | |
2130 GFX_write_string(&FontT42,&t7r1,TextR1,0); | |
2131 } | |
2132 else | |
2133 { | |
2134 snprintf(TextR1,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
2135 GFX_write_string(&FontT42,&t7r1,TextR1,0); | |
2136 } | |
2137 | |
2138 if(Divetime.Minutes < 1000) | |
2139 snprintf(TextR1,TEXTSIZE,"\020\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds); | |
2140 else | |
2141 snprintf(TextR1,TEXTSIZE,"\020\016\002%u'",Divetime.Minutes); | |
2142 t7_colorscheme_mod(TextR1); | |
2143 GFX_write_string(&FontT105,&t7r1,TextR1,1); | |
2144 | |
2145 /* next deco stop */ | |
2146 if(nextstopDepthMeter) | |
2147 { | |
2148 snprintf(TextR2,TEXTSIZE,"\032\f\002%c",TXT_Decostop); | |
2149 GFX_write_string(&FontT42,&t7r2,TextR2,0); | |
2150 textlength = snprintf(TextR2,TEXTSIZE,"\020\002%u%c%c %u'" | |
2151 , unit_depth_integer(nextstopDepthMeter) | |
2152 , unit_depth_char1_T105() | |
2153 , unit_depth_char2_T105() | |
2154 , (nextstopLengthSeconds+59)/60); | |
2155 t7_colorscheme_mod(TextR2); | |
2156 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | |
2157 TextR2[0] = '\021'; | |
2158 if(textlength <= 9) | |
2159 GFX_write_string(&FontT105,&t7r2,TextR2,1); | |
2160 else | |
2161 GFX_write_string(&FontT54,&t7r2,TextR2,1); | |
2162 } | |
2163 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit())) | |
2164 { | |
2165 snprintf(TextR2,TEXTSIZE,"\032\f\002%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2); | |
2166 GFX_write_string(&FontT42,&t7r2,TextR2,0); | |
2167 snprintf(TextR2,TEXTSIZE,"\020\016\002%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds); | |
2168 t7_colorscheme_mod(TextR2); | |
2169 GFX_write_string(&FontT105,&t7r2,TextR2,1); | |
2170 } | |
2171 | |
2172 /* tts - option 1 | |
2173 * ndl - option 2 | |
2174 * empty - option 3 */ | |
2175 if(pDecoinfo->output_time_to_surface_seconds) | |
2176 { | |
2177 snprintf(TextR3,TEXTSIZE,"\032\f\002%c",TXT_TTS); | |
2178 GFX_write_string(&FontT42,&t7r3,TextR3,0); | |
2179 if(pDecoinfo->output_time_to_surface_seconds < 1000 * 60) | |
2180 snprintf(TextR3,TEXTSIZE,"\020\002%i'",(pDecoinfo->output_time_to_surface_seconds + 30)/ 60); | |
2181 else | |
2182 snprintf(TextR3,TEXTSIZE,"\020\002%ih",pDecoinfo->output_time_to_surface_seconds / 3600); | |
2183 t7_colorscheme_mod(TextR3); | |
2184 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | |
2185 TextR2[0] = '\021'; | |
2186 GFX_write_string(&FontT105,&t7r3,TextR3,1); | |
2187 } | |
2188 else if(pDecoinfo->output_ndl_seconds) | |
2189 { | |
2190 snprintf(TextR3,TEXTSIZE,"\032\f\002%c",TXT_Nullzeit); | |
2191 GFX_write_string(&FontT42,&t7r3,TextR3,0); | |
2192 if(pDecoinfo->output_ndl_seconds < 1000 * 60) | |
2193 snprintf(TextR3,TEXTSIZE,"\020\002%i'",pDecoinfo->output_ndl_seconds/60); | |
2194 else | |
2195 snprintf(TextR3,TEXTSIZE,"\020\002%ih",pDecoinfo->output_ndl_seconds/3600); | |
2196 t7_colorscheme_mod(TextR3); | |
2197 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | |
2198 TextR2[0] = '\021'; | |
2199 GFX_write_string(&FontT105,&t7r3,TextR3,1); | |
2200 } | |
2201 | |
2202 /* Menu Selection (and gas mix) */ | |
2203 if(get_globalState() == StDMGAS) | |
2204 { | |
2205 textPointer = 0; | |
2206 TextR1[textPointer++] = '\a'; | |
2207 // TextR1[textPointer++] = '\f'; | |
2208 TextR1[textPointer++] = '\001'; | |
2209 TextR1[textPointer++] = ' '; | |
2210 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[actualBetterGasId()].oxygen_percentage,stateUsed->diveSettings.gas[actualBetterGasId()].helium_percentage,&TextR1[textPointer]); | |
2211 TextR1[textPointer++] = '?'; | |
2212 TextR1[textPointer++] = ' '; | |
2213 TextR1[textPointer++] = 0; | |
2214 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2215 } | |
2216 else if(get_globalState() == StDMSPT) | |
2217 { | |
2218 textPointer = 0; | |
2219 TextR1[textPointer++] = '\a'; | |
2220 TextR1[textPointer++] = '\001'; | |
2221 TextR1[textPointer++] = ' '; | |
2222 textPointer += snprintf(&TextR1[textPointer],5,"%f01.2",((float)(stateUsed->diveSettings.setpoint[actualBetterSetpointId()].setpoint_cbar))/100); | |
2223 TextR1[textPointer++] = '?'; | |
2224 TextR1[textPointer++] = ' '; | |
2225 TextR1[textPointer++] = 0; | |
2226 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2227 } | |
2228 else if(get_globalState() == StDMENU) | |
2229 { | |
2230 snprintf(TextR1,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveMenuQ); | |
2231 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2232 } | |
2233 else if(get_globalState() == StDSIM1) | |
2234 { | |
2235 snprintf(TextR1,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveQuitQ); | |
2236 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2237 } | |
2238 else if(get_globalState() == StDSIM2) | |
2239 { | |
2240 if(settingsGetPointer()->nonMetricalSystem) | |
2241 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:-3.33ft "); | |
2242 else | |
2243 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:-1m "); | |
2244 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2245 | |
2246 snprintf(TextR1,TEXTSIZE,"\a\f %u %c%c" | |
2247 , unit_depth_integer(simulation_get_aim_depth()) | |
2248 , unit_depth_char1() | |
2249 , unit_depth_char2() | |
2250 ); | |
2251 GFX_write_string_color(&FontT42,&t7l1,TextR1,0,CLUT_WarningYellow); | |
2252 | |
2253 } | |
2254 else if(get_globalState() == StDSIM3) | |
2255 { | |
2256 if(settingsGetPointer()->nonMetricalSystem) | |
2257 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+3.33ft "); | |
2258 else | |
2259 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+1m "); | |
2260 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2261 snprintf(TextR1,TEXTSIZE,"\a\f %u %c%c" | |
2262 , unit_depth_integer(simulation_get_aim_depth()) | |
2263 , unit_depth_char1() | |
2264 , unit_depth_char2() | |
2265 ); | |
2266 GFX_write_string_color(&FontT42,&t7l1,TextR1,0,CLUT_WarningYellow); | |
2267 } | |
2268 else if(get_globalState() == StDSIM4) | |
2269 { | |
2270 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+5' "); | |
2271 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2272 snprintf(TextR1,TEXTSIZE,"\a\f %u %c%c" | |
2273 , unit_depth_integer(simulation_get_aim_depth()) | |
2274 , unit_depth_char1() | |
2275 , unit_depth_char2() | |
2276 ); | |
2277 GFX_write_string_color(&FontT42,&t7l1,TextR1,0,CLUT_WarningYellow); | |
2278 } | |
2279 else | |
2280 { | |
2281 /* gas mix */ | |
2282 oxygen_percentage = 100; | |
2283 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage; | |
2284 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage; | |
2285 | |
2286 textPointer = 0; | |
2287 TextC2[textPointer++] = '\020'; | |
2288 if(stateUsed->warnings.betterGas && warning_count_high_time) | |
2289 { | |
2290 TextC2[textPointer++] = '\a'; | |
2291 } | |
2292 else | |
2293 { | |
2294 float fPpO2limitHigh, fPpO2now; | |
2295 | |
2296 if(actualLeftMaxDepth(stateUsed)) | |
2297 fPpO2limitHigh = settingsGetPointer()->ppO2_max_deco; | |
2298 else | |
2299 fPpO2limitHigh = settingsGetPointer()->ppO2_max_std; | |
2300 | |
2301 fPpO2now = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * oxygen_percentage; | |
2302 | |
2303 if((fPpO2now > fPpO2limitHigh) || (fPpO2now < (float)(settingsGetPointer()->ppO2_min))) | |
2304 TextC2[textPointer++] = '\025'; | |
2305 } | |
2306 TextC2[textPointer++] = '\002'; | |
2307 textPointer += tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&TextC2[textPointer]); | |
2308 | |
2309 if(stateUsed->warnings.betterGas && warning_count_high_time) | |
2310 { | |
2311 if(TextC2[0] == '\020') | |
2312 { | |
2313 TextC2[0] = '\004'; // NOP | |
2314 } | |
2315 GFX_write_string_color(&FontT48,&t7c2,TextC2,0,CLUT_WarningYellow); | |
2316 } | |
2317 else | |
2318 { | |
2319 t7_colorscheme_mod(TextC2); | |
2320 GFX_write_string(&FontT48,&t7c2,TextC2,0); // T54 has only numbers | |
2321 } | |
2322 | |
2323 if(stateUsed->diveSettings.ccrOption) | |
2324 { | |
2325 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) | |
2326 { | |
2327 snprintf(TextC2,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); | |
2328 if(stateUsed->warnings.betterSetpoint && warning_count_high_time && (stateUsed->diveSettings.diveMode == DIVEMODE_CCR)) | |
2329 { | |
2330 TextC2[0] = '\a'; // inverse instead of color \020 | |
2331 GFX_write_string_color(&FontT48,&t7c2,TextC2,0,CLUT_WarningYellow); | |
2332 } | |
2333 else | |
2334 { | |
2335 t7_colorscheme_mod(TextC2); | |
2336 GFX_write_string(&FontT48,&t7c2,TextC2,0); | |
2337 } | |
2338 } | |
2339 } | |
2340 else if(settingsGetPointer()->alwaysShowPPO2) | |
2341 { | |
2342 snprintf(TextC2,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); | |
2343 t7_colorscheme_mod(TextC2); | |
2344 GFX_write_string(&FontT48,&t7c2,TextC2,0); | |
2345 } | |
2346 } | |
2347 | |
2348 /* algorithm, ccr, bailout and battery */ | |
2349 /* and permanent warnings (CNS) */ | |
2350 | |
2351 if((stateUsed->warnings.cnsHigh) && display_count_high_time) | |
2352 { | |
2353 TextC2[0] = '\f'; | |
2354 TextC2[1] = TXT_2BYTE; | |
2355 TextC2[2] = TXT2BYTE_WarnCnsHigh; | |
2356 TextC2[3] = 0; | |
2357 GFX_write_string_color(&FontT48,&t7c1,TextC2,0,CLUT_WarningRed); | |
2358 } | |
2359 else | |
2360 { | |
2361 if(stateUsed->warnings.aGf) | |
2362 { | |
2363 GFX_write_string_color(&FontT48,&t7c1,"\f" "aGF",0,CLUT_WarningYellow); | |
2364 } | |
2365 else if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
2366 { | |
2367 GFX_write_string(&FontT48,&t7c1,"\027\f" "GF",0); | |
2368 } | |
2369 else | |
2370 { | |
2371 GFX_write_string(&FontT48,&t7c1,"\027\f" "VPM",0); | |
2372 } | |
2373 | |
2374 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) | |
2375 GFX_write_string(&FontT24,&t7c1,"\027\f\002" "CCR",0); | |
2376 // GFX_write_string(&FontT24,&t7c1,"\f\177\177\x80" "CCR",0); | |
2377 else | |
2378 if(stateUsed->diveSettings.ccrOption) | |
2379 GFX_write_string(&FontT24,&t7c1,"\f\002\024" "Bailout",0); | |
2380 // GFX_write_string(&FontT24,&t7c1,"\f\177\177\x80\024" "Bailout",0); | |
2381 } | |
2382 TextC1[0] = '\020'; | |
2383 TextC1[1] = '3'; | |
2384 TextC1[2] = '1'; | |
2385 TextC1[3] = '1'; | |
2386 TextC1[4] = '1'; | |
2387 TextC1[5] = '1'; | |
2388 TextC1[6] = '1'; | |
2389 TextC1[7] = '1'; | |
2390 TextC1[8] = '1'; | |
2391 TextC1[9] = '1'; | |
2392 TextC1[10] = '1'; | |
2393 TextC1[11] = '1'; | |
2394 TextC1[12] = '0'; | |
2395 TextC1[13] = 0; | |
2396 | |
2397 for(int i=1;i<=10;i++) | |
2398 { | |
2399 if( stateUsed->lifeData.battery_charge > (9 * i)) | |
2400 TextC1[i+1] += 1; | |
2401 } | |
2402 | |
2403 if(stateUsed->warnings.lowBattery) | |
2404 { | |
2405 TextC1[0] = '\025'; | |
2406 if(warning_count_high_time) | |
2407 { | |
2408 for(int i=2;i<=11;i++) | |
2409 TextC1[i] = '1'; | |
2410 } | |
2411 else | |
2412 { | |
2413 TextC1[2] = '2'; | |
2414 } | |
2415 GFX_write_string(&Batt24,&t7batt,TextC1,0); | |
2416 | |
2417 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) | |
2418 { | |
2419 snprintf(TextC1,16,"\004\025\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); | |
2420 if(warning_count_high_time) | |
2421 TextC1[0] = '\a'; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2422 GFX_write_string(&FontT24,&t7voltage,TextC1,0); |
38 | 2423 } |
2424 } | |
2425 else | |
2426 { | |
2427 t7_colorscheme_mod(TextC1); | |
2428 GFX_write_string(&Batt24,&t7batt,TextC1,0); | |
2429 | |
2430 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) | |
2431 { | |
2432 snprintf(TextC1,16,"\020\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); | |
2433 t7_colorscheme_mod(TextC1); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2434 GFX_write_string(&FontT24,&t7voltage,TextC1,0); // t7batt |
38 | 2435 } |
2436 } | |
2437 | |
2438 /* customizable left lower corner */ | |
2439 t7_refresh_divemode_userselected_left_lower_corner(); | |
2440 | |
2441 | |
2442 /* customview - option 1 | |
2443 * warning - option 2 */ | |
2444 if(stateUsed->warnings.numWarnings) | |
2445 customview_warnings = t7_test_customview_warnings(); | |
2446 | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
2447 background.pointer = 0; |
38 | 2448 if(customview_warnings && warning_count_high_time) |
2449 t7_show_customview_warnings(); | |
2450 else | |
2451 t7_refresh_customview(); | |
2452 | |
2453 /* the frame */ | |
2454 draw_frame(1,1, CLUT_DIVE_pluginbox, CLUT_DIVE_FieldSeperatorLines); | |
2455 } | |
2456 | |
2457 void t7_set_field_to_primary(void) | |
2458 { | |
2459 if(stateUsed->mode == MODE_DIVE) | |
2460 selection_custom_field = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; | |
2461 } | |
2462 | |
2463 void t7_change_field(void) | |
2464 { | |
2465 const uint8_t minVal = 0; | |
2466 const uint8_t maxValGF = 8; | |
2467 const uint8_t maxValVPM = 7; | |
2468 uint8_t maxNow = maxValGF; | |
2469 | |
2470 selection_custom_field++; | |
2471 | |
2472 if(stateUsed->diveSettings.deco_type.ub.standard == VPM_MODE) | |
2473 maxNow = maxValVPM; | |
2474 | |
2475 if(selection_custom_field > maxNow) | |
2476 selection_custom_field = minVal; | |
2477 } | |
2478 | |
2479 | |
2480 void t7_refresh_divemode_userselected_left_lower_corner(void) | |
2481 { | |
2482 if(!selection_custom_field) | |
2483 return; | |
2484 | |
2485 char headerText[10]; | |
2486 char text[TEXTSIZE]; | |
2487 uint8_t textpointer = 0; | |
2488 _Bool tinyHeaderFont = 0; | |
2489 uint8_t line = 0; | |
2490 | |
2491 SDivetime Stopwatch = {0,0,0,0}; | |
2492 float fAverageDepth, fAverageDepthAbsolute; | |
2493 const SDecoinfo * pDecoinfoStandard; | |
2494 const SDecoinfo * pDecoinfoFuture; | |
2495 float fCNS; | |
2496 | |
2497 float temperatureThisCall; | |
2498 float temperature; | |
2499 | |
2500 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
2501 { | |
2502 pDecoinfoStandard = &stateUsed->decolistBuehlmann; | |
2503 pDecoinfoFuture = &stateUsed->decolistFutureBuehlmann; | |
2504 } | |
2505 else | |
2506 { | |
2507 pDecoinfoStandard = &stateUsed->decolistVPM; | |
2508 pDecoinfoFuture = &stateUsed->decolistFutureVPM; | |
2509 } | |
2510 | |
2511 Stopwatch.Total = timer_Stopwatch_GetTime(); | |
2512 Stopwatch.Minutes = Stopwatch.Total / 60; | |
2513 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
2514 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
2515 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
2516 | |
2517 headerText[0] = '\032'; | |
2518 headerText[1] = '\f'; | |
2519 | |
2520 switch(selection_custom_field) | |
2521 { | |
2522 /* Temperature */ | |
2523 case 1: | |
2524 default: | |
2525 // mean value | |
2526 temperatureThisCall = unit_temperature_float(stateUsed->lifeData.temperature_celsius); | |
2527 temperature = (temperatureThisCall + temperatureLastCall[0] + temperatureLastCall[1] + temperatureLastCall[2]) / 4.0f; | |
2528 idTemperatureLastCall++; | |
2529 if(idTemperatureLastCall >= 3) | |
2530 idTemperatureLastCall = 0; | |
2531 temperatureLastCall[idTemperatureLastCall] = temperatureThisCall; | |
2532 // output | |
2533 headerText[2] = TXT_Temperature; | |
2534 textpointer = snprintf(text,TEXTSIZE,"\020\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F | |
2535 if(settingsGetPointer()->nonMetricalSystem == 0) | |
2536 text[textpointer++] = 'C'; | |
2537 else | |
2538 text[textpointer++] = 'F'; | |
2539 text[textpointer++] = 0; | |
2540 tinyHeaderFont = 0; | |
2541 break; | |
2542 | |
2543 /* Average Depth */ | |
2544 case 2: | |
2545 headerText[2] = TXT_AvgDepth; | |
2546 if(settingsGetPointer()->nonMetricalSystem) | |
2547 snprintf(text,TEXTSIZE,"\020%01.0f",unit_depth_float(fAverageDepthAbsolute)); | |
2548 else | |
2549 snprintf(text,TEXTSIZE,"\020%01.1f",fAverageDepthAbsolute); | |
2550 break; | |
2551 | |
2552 /* ppO2 */ | |
2553 case 3: | |
2554 headerText[2] = TXT_ppO2; | |
2555 snprintf(text,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); | |
2556 break; | |
2557 | |
2558 /* Stop Uhr */ | |
2559 case 4: | |
2560 headerText[2] = TXT_Stopwatch; | |
2561 if(settingsGetPointer()->nonMetricalSystem) | |
2562 snprintf(text,TEXTSIZE,"\020\016\016%u:%02u\n\r%01.0f",Stopwatch.Minutes, Stopwatch.Seconds,unit_depth_float(fAverageDepth)); | |
2563 else | |
2564 snprintf(text,TEXTSIZE,"\020\016\016%u:%02u\n\r%01.1f",Stopwatch.Minutes, Stopwatch.Seconds,fAverageDepth); | |
2565 tinyHeaderFont = 1; | |
2566 line = 1; | |
2567 break; | |
2568 | |
2569 /* Ceiling */ | |
2570 case 5: | |
2571 headerText[2] = TXT_Ceiling; | |
2572 if((pDecoinfoStandard->output_ceiling_meter > 99.9f) || (settingsGetPointer()->nonMetricalSystem)) | |
2573 snprintf(text,TEXTSIZE,"\020%01.0f",unit_depth_float(pDecoinfoStandard->output_ceiling_meter)); | |
2574 else | |
2575 snprintf(text,TEXTSIZE,"\020%01.1f",pDecoinfoStandard->output_ceiling_meter); | |
2576 break; | |
2577 | |
2578 /* Future TTS */ | |
2579 case 6: | |
2580 headerText[2] = TXT_FutureTTS; | |
2581 snprintf(text,TEXTSIZE,"\020\016\016@+%u'\n\r" "%i' TTS",settingsGetPointer()->future_TTS, pDecoinfoFuture->output_time_to_surface_seconds / 60); | |
2582 tinyHeaderFont = 1; | |
2583 line = 1; | |
2584 break; | |
2585 | |
2586 /* CNS */ | |
2587 case 7: | |
2588 headerText[2] = TXT_CNS; | |
2589 fCNS = stateUsed->lifeData .cns; | |
2590 if(fCNS > 999) | |
2591 fCNS = 999; | |
2592 snprintf(text,TEXTSIZE,"\020%.0f\016\016%%\017",fCNS); | |
2593 break; | |
2594 | |
2595 /* actual GF */ | |
2596 case 8: | |
2597 headerText[2] = TXT_ActualGradient; | |
2598 snprintf(text,TEXTSIZE,"\020%.0f",100 * pDecoinfoStandard->output_relative_gradient); | |
2599 break; | |
2600 } | |
2601 headerText[3] = 0; | |
2602 | |
2603 if(tinyHeaderFont) | |
2604 GFX_write_string(&FontT24,&t7l3,headerText,0); | |
2605 else | |
2606 GFX_write_string(&FontT42,&t7l3,headerText,0); | |
2607 | |
2608 t7_colorscheme_mod(text); | |
2609 GFX_write_string(&FontT105,&t7l3,text,line); | |
2610 } | |
2611 | |
2612 /* Private functions ---------------------------------------------------------*/ | |
2613 | |
2614 uint8_t t7_customtextPrepare(char * text) | |
2615 { | |
2616 uint8_t i, j, textptr, lineCount; | |
2617 char nextChar; | |
2618 | |
2619 textptr = 0; | |
2620 lineCount = 0; | |
2621 | |
2622 text[textptr++] = TXT_MINIMAL; | |
2623 | |
2624 j = 0; | |
2625 i = 0; | |
2626 do | |
2627 { | |
2628 j += i; | |
2629 i = 0; | |
2630 do | |
2631 { | |
2632 nextChar = settingsGetPointer()->customtext[i+j]; | |
2633 i++; | |
2634 if((!nextChar) || (nextChar =='\n') || (nextChar =='\r')) | |
2635 break; | |
2636 text[textptr++] = nextChar; | |
2637 } while (i < 12); | |
2638 | |
2639 if(!nextChar) | |
2640 break; | |
2641 | |
2642 if(lineCount < 3) | |
2643 { | |
2644 text[textptr++] = '\n'; | |
2645 text[textptr++] = '\r'; | |
2646 } | |
2647 lineCount++; | |
2648 for(uint8_t k=0;k<2;k++) | |
2649 { | |
2650 nextChar = settingsGetPointer()->customtext[i+j+k]; | |
2651 if((nextChar =='\n') || (nextChar =='\r')) | |
2652 i++; | |
2653 else | |
2654 break; | |
2655 } | |
2656 | |
2657 } while (lineCount < 4); | |
2658 | |
2659 text[textptr] = 0; | |
2660 return lineCount; | |
2661 } | |
2662 | |
2663 /* could be extended to search for \020 inside | |
2664 */ | |
2665 void t7_colorscheme_mod(char *text) | |
2666 { | |
2667 if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard()) | |
2668 { | |
2669 text[0] = '\027'; | |
2670 } | |
2671 } | |
2672 | |
2673 | |
2674 void draw_frame(_Bool PluginBoxHeader, _Bool LinesOnTheSides, uint8_t colorBox, uint8_t colorLinesOnTheSide) | |
2675 { | |
2676 point_t LeftLow, WidthHeight; | |
2677 point_t start, stop; | |
2678 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2679 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2680 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2681 |
38 | 2682 // plugin box |
2683 LeftLow.x = CUSTOMBOX_LINE_LEFT; | |
2684 WidthHeight.x = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_LINE_LEFT; | |
2685 LeftLow.y = 60; | |
2686 WidthHeight.y = 440 - LeftLow.y; | |
2687 GFX_draw_box(&t7screen, LeftLow, WidthHeight, 1, colorBox); | |
2688 | |
2689 if(PluginBoxHeader) | |
2690 { | |
2691 // plugin box - header | |
2692 start.x = CUSTOMBOX_LINE_LEFT; | |
2693 stop.x = CUSTOMBOX_LINE_RIGHT; | |
2694 stop.y = start.y = 440 - 60; | |
2695 GFX_draw_line(&t7screen, start, stop, colorBox); | |
2696 } | |
2697 | |
2698 if(LinesOnTheSides) | |
2699 { | |
2700 // aufteilung links | |
2701 start.x = 0; | |
2702 stop.x = CUSTOMBOX_LINE_LEFT; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2703 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2704 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2705 stop.y = start.y = t7l1.WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2706 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2707 else |
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 = 480 - t7l1.WindowY1 - 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 |
38 | 2712 GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide); |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2713 if(!pSettings->FlipDisplay) |
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 stop.y = start.y = t7l2.WindowY0 -1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2716 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2717 else |
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 = 480 - t7l2.WindowY1 -1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2720 } |
38 | 2721 GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide); |
2722 | |
2723 // aufteilung rechts | |
2724 start.x = CUSTOMBOX_LINE_RIGHT; | |
2725 stop.x = 799; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2726 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2727 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2728 stop.y = start.y = t7l1.WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2729 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2730 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2731 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2732 stop.y = start.y = 480 - t7l1.WindowY1 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2733 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2734 |
38 | 2735 GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide); |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2736 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2737 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2738 stop.y = start.y = t7l2.WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2739 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2740 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2741 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2742 stop.y = start.y = 480 - t7l2.WindowY1 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2743 } |
38 | 2744 GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide); |
2745 } | |
2746 } | |
2747 | |
2748 | |
2749 /* Compass like TCOS shellfish | |
2750 * input is 0 to 359 | |
2751 * 2 px / 1 degree | |
2752 * Range is 148 degree with CUSTOMBOX_SPACE_INSIDE = 296 | |
2753 * one side is 74 degree (less than 90 degree) | |
2754 * internal 360 + 180 degree of freedom | |
2755 * use positive values only, shift by 360 below 90 mid position | |
2756 */ | |
2757 | |
2758 | |
2759 point_t t7_compass_circle(uint8_t id, uint16_t degree) | |
2760 { | |
2761 float fCos, fSin; | |
2762 const float piMult = ((2 * 3.14159) / 360); | |
2763 // const int radius[4] = {95,105,115,60}; | |
2764 const int radius[4] = {95,105,115,100}; | |
2765 const point_t offset = {.x = 400, .y = 250}; | |
2766 | |
2767 static point_t r[4][360] = { 0 }; | |
2768 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2769 if(r[0][0].y == 0) /* calc table at first call only */ |
38 | 2770 { |
2771 for(int i=0;i<360;i++) | |
2772 { | |
2773 fCos = cos(i * piMult); | |
2774 fSin = sin(i * piMult); | |
2775 for(int j=0;j<4;j++) | |
2776 { | |
2777 r[j][i].x = offset.x + (int)(fSin * radius[j]); | |
2778 r[j][i].y = offset.y + (int)(fCos * radius[j]); | |
2779 } | |
2780 } | |
2781 } | |
2782 if(id > 3) id = 0; | |
2783 if(degree > 359) degree = 0; | |
2784 return r[id][degree]; | |
2785 } | |
2786 | |
2787 /* range should be 0 to 30 bar if 300 meter with 100% of nitrogen or helium | |
2788 * T24 is 28 high | |
2789 */ | |
2790 void t7_tissues(const SDiveState * pState) | |
2791 { | |
2792 point_t start, change, stop; | |
2793 float value; | |
2794 uint16_t front, cns100pixel; | |
2795 char text[256]; | |
2796 uint8_t textpointer = 0; | |
2797 uint8_t color; | |
2798 | |
2799 float percent_N2; | |
2800 float percent_He; | |
2801 float partial_pressure_N2; | |
2802 float partial_pressure_He; | |
2803 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2804 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2805 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2806 |
38 | 2807 |
2808 /* N2 */ | |
2809 t7cY0free.WindowLineSpacing = 28 + 48 + 14; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2810 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2811 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2812 t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2813 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2814 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2815 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2816 t7cY0free.WindowY0 = t7cH.WindowY0 + 15; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2817 t7cY0free.WindowY1 = t7cY0free.WindowY0 + 250; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2818 } |
38 | 2819 t7cY0free.WindowNumberOfTextLines = 3; |
2820 | |
2821 text[textpointer++] = '\030'; | |
2822 text[textpointer++] = TXT_2BYTE; | |
2823 text[textpointer++] = TXT2BYTE_Nitrogen; | |
2824 text[textpointer++] = '\n'; | |
2825 text[textpointer++] = '\r'; | |
2826 text[textpointer++] = TXT_2BYTE; | |
2827 text[textpointer++] = TXT2BYTE_Helium; | |
2828 text[textpointer++] = '\n'; | |
2829 text[textpointer++] = '\r'; | |
2830 text[textpointer++] = TXT_2BYTE; | |
2831 text[textpointer++] = TXT2BYTE_CNS; | |
2832 text[textpointer++] = 0; | |
2833 | |
2834 GFX_write_string(&FontT24, &t7cY0free, text, 1); | |
2835 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2836 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2837 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2838 start.y = t7cH.WindowY0 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2839 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2840 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2841 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2842 start.y = t7cH.WindowY1 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2843 } |
38 | 2844 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
2845 stop.x = start.x + CUSTOMBOX_SPACE_INSIDE; | |
2846 | |
2847 for(int i=0;i<16;i++) | |
2848 { | |
2849 stop.y = start.y; | |
2850 change.y = start.y; | |
2851 | |
2852 value = pState->lifeData.tissue_nitrogen_bar[i] - 0.7512f; | |
2853 value *= 80;//20 | |
2854 | |
2855 if(value < 0) | |
2856 front = 0; | |
2857 else | |
2858 if(value > CUSTOMBOX_SPACE_INSIDE) | |
2859 front = CUSTOMBOX_SPACE_INSIDE; | |
2860 else | |
2861 front = (uint16_t)value; | |
2862 | |
2863 change.x = start.x + front; | |
2864 if(change.x != start.x) | |
2865 GFX_draw_thick_line(1,&t7screen, start, change, CLUT_Font030); | |
2866 if(change.x != stop.x) | |
2867 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font031); | |
2868 | |
2869 start.y -= 3; | |
2870 } | |
2871 | |
2872 /* He */ | |
2873 start.y -= 28 + 14; | |
2874 for(int i=0;i<16;i++) | |
2875 { | |
2876 stop.y = start.y; | |
2877 change.y = start.y; | |
2878 | |
2879 value = pState->lifeData.tissue_helium_bar[i]; | |
2880 value *= 80;//20 | |
2881 | |
2882 if(value < 0) | |
2883 front = 0; | |
2884 else if(value > CUSTOMBOX_SPACE_INSIDE) | |
2885 front = CUSTOMBOX_SPACE_INSIDE; | |
2886 else | |
2887 front = (uint16_t)value; | |
2888 | |
2889 change.x = start.x + front; | |
2890 if(change.x != start.x) | |
2891 GFX_draw_thick_line(1,&t7screen, start, change, CLUT_Font030); | |
2892 if(change.x != stop.x) | |
2893 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font031); | |
2894 | |
2895 start.y -= 3; | |
2896 } | |
2897 | |
2898 /* CNS == Oxygen */ | |
2899 start.y -= 28 + 14; | |
2900 | |
2901 cns100pixel = (8 * CUSTOMBOX_SPACE_INSIDE) / 10; | |
2902 value = pState->lifeData.cns; | |
2903 value *= cns100pixel; | |
2904 value /= 100; | |
2905 | |
2906 if(value < 0) | |
2907 front = 0; | |
2908 else if(value > CUSTOMBOX_SPACE_INSIDE) | |
2909 front = CUSTOMBOX_SPACE_INSIDE; | |
2910 else | |
2911 front = (uint16_t)value; | |
2912 | |
2913 if(pState->lifeData.cns < 95) | |
2914 color = CLUT_Font030; | |
2915 else if(pState->lifeData.cns < 100) | |
2916 color = CLUT_WarningYellow; | |
2917 else | |
2918 color = CLUT_WarningRed; | |
2919 | |
2920 for(int i=0;i<16;i++) | |
2921 { | |
2922 stop.y = start.y; | |
2923 change.y = start.y; | |
2924 | |
2925 change.x = start.x + front; | |
2926 if(change.x != start.x) | |
2927 GFX_draw_thick_line(1,&t7screen, start, change, color); | |
2928 if(change.x != stop.x) | |
2929 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font031); | |
2930 | |
2931 start.y -= 3; | |
2932 } | |
2933 | |
2934 /* where is the onload/offload limit for N2 and He */ | |
2935 decom_get_inert_gases(pState->lifeData.pressure_ambient_bar, &pState->lifeData.actualGas, &percent_N2, &percent_He); | |
2936 partial_pressure_N2 = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_N2; | |
2937 partial_pressure_He = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_He; | |
2938 | |
2939 // Nitrogen vertical bar | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2940 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2941 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2942 start.y = t7cH.WindowY0 + 1 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2943 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2944 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2945 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2946 start.y = t7cH.WindowY1 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2947 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2948 |
38 | 2949 stop.y = start.y - (3 * 15) - 1; |
2950 if((percent_N2 > 0) && (partial_pressure_N2 > 0.8f))//(0.8f + 0.5f))) | |
2951 { | |
2952 value = partial_pressure_N2; | |
2953 value *= 80;//20 | |
2954 | |
2955 if(value < 0) | |
2956 front = 3; | |
2957 else if(value + 5 > CUSTOMBOX_SPACE_INSIDE) | |
2958 front = CUSTOMBOX_SPACE_INSIDE - 3; | |
2959 else | |
2960 front = (uint16_t)value; | |
2961 } | |
2962 else | |
2963 { | |
2964 front = 1; | |
2965 } | |
2966 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + front; | |
2967 stop.x = start.x; | |
2968 GFX_draw_thick_line(2,&t7screen, start, stop, CLUT_EverythingOkayGreen); | |
2969 | |
2970 | |
2971 // Helium vertical bar | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2972 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2973 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2974 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
|
2975 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2976 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2977 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2978 start.y = t7cH.WindowY1 - 5 - 3*16 - 28 - 14; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2979 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2980 |
38 | 2981 stop.y = start.y - (3 * 15) - 1; |
2982 if((percent_He > 0) && (partial_pressure_He > 0.01f)) // 0.5f | |
2983 { | |
2984 | |
2985 value = partial_pressure_He; | |
2986 value *= 80;//20 | |
2987 | |
2988 if(value < 0) | |
2989 front = 3; | |
2990 else if(value + 5 > CUSTOMBOX_SPACE_INSIDE) | |
2991 front = CUSTOMBOX_SPACE_INSIDE - 3; | |
2992 else | |
2993 front = (uint16_t)value; | |
2994 } | |
2995 else | |
2996 { | |
2997 front = 1; | |
2998 } | |
2999 | |
3000 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + front; | |
3001 stop.x = start.x; | |
3002 GFX_draw_thick_line(2,&t7screen, start, stop, CLUT_EverythingOkayGreen); | |
3003 | |
3004 // Oxygen vertical bar | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3005 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3006 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3007 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
|
3008 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3009 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3010 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3011 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
|
3012 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3013 |
38 | 3014 stop.y = start.y - (3 * 15) - 1; |
3015 | |
3016 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + cns100pixel; | |
3017 stop.x = start.x; | |
3018 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
|
3019 |
38 | 3020 } |
3021 | |
3022 | |
3023 void t7_debug(void) | |
3024 { | |
3025 char text[256+50]; | |
3026 uint8_t textpointer = 0; | |
3027 | |
3028 t7cY0free.WindowLineSpacing = 28 + 48 + 14; | |
3029 t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing; | |
3030 t7cY0free.WindowNumberOfTextLines = 3; | |
3031 | |
3032 textpointer += snprintf(&text[textpointer],50,"Ambient [bar]\n\r"); | |
3033 textpointer += snprintf(&text[textpointer],50,"Surface [bar] + salt\n\r"); | |
3034 // textpointer += snprintf(&text[textpointer],50,"Difference [mbar]\n\r"); | |
3035 textpointer += snprintf(&text[textpointer],50,"ShallowCounter [s]\n\r"); | |
3036 GFX_write_string(&FontT24, &t7cY0free, text, 1); | |
3037 | |
3038 t7cY0free.WindowY0 -= 52; | |
3039 // 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)); | |
3040 snprintf(text,60, | |
3041 "%0.2f\n\r" | |
3042 "%0.2f %u%%\n\r" | |
3043 "%u" | |
3044 ,stateUsed->lifeData.pressure_ambient_bar | |
3045 ,stateUsed->lifeData.pressure_surface_bar | |
3046 ,settingsGetPointer()->salinity | |
3047 ,stateUsed->lifeData.counterSecondsShallowDepth); | |
3048 GFX_write_string(&FontT42, &t7cY0free, text, 1); | |
3049 } | |
3050 | |
3051 | |
3052 void t7_SummaryOfLeftCorner(void) | |
3053 { | |
3054 char text[256+60]; | |
3055 uint8_t textpointer = 0; | |
3056 | |
3057 const SDecoinfo * pDecoinfoStandard; | |
3058 const SDecoinfo * pDecoinfoFuture; | |
3059 float fCNS; | |
3060 | |
3061 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
3062 { | |
3063 pDecoinfoStandard = &stateUsed->decolistBuehlmann; | |
3064 pDecoinfoFuture = &stateUsed->decolistFutureBuehlmann; | |
3065 } | |
3066 else | |
3067 { | |
3068 pDecoinfoStandard = &stateUsed->decolistVPM; | |
3069 pDecoinfoFuture = &stateUsed->decolistFutureVPM; | |
3070 } | |
3071 | |
3072 fCNS = stateUsed->lifeData .cns; | |
3073 if(fCNS > 999) | |
3074 fCNS = 999; | |
3075 | |
3076 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; | |
3077 t7cY0free.WindowLineSpacing = 48; | |
3078 t7cY0free.WindowNumberOfTextLines = 6; | |
3079 t7cY0free.WindowTab = 420; | |
3080 | |
3081 // header | |
3082 textpointer = 0; | |
3083 text[textpointer++] = '\032'; | |
3084 text[textpointer++] = '\016'; | |
3085 text[textpointer++] = '\016'; | |
3086 text[textpointer++] = TXT_ppO2; | |
3087 text[textpointer++] = '\n'; | |
3088 text[textpointer++] = '\r'; | |
3089 text[textpointer++] = TXT_Ceiling; | |
3090 text[textpointer++] = '\n'; | |
3091 text[textpointer++] = '\r'; | |
3092 text[textpointer++] = TXT_ActualGradient; | |
3093 text[textpointer++] = '\n'; | |
3094 text[textpointer++] = '\r'; | |
3095 text[textpointer++] = TXT_CNS; | |
3096 text[textpointer++] = '\n'; | |
3097 text[textpointer++] = '\r'; | |
3098 text[textpointer++] = TXT_FutureTTS; | |
3099 text[textpointer++] = '\017'; | |
3100 text[textpointer++] = 0; | |
3101 t7cY0free.WindowX0 += 10; | |
3102 t7cY0free.WindowY0 += 10; | |
3103 GFX_write_string(&FontT24, &t7cY0free, text, 1); | |
3104 t7cY0free.WindowX0 -= 10; | |
3105 t7cY0free.WindowY0 -= 10; | |
3106 | |
3107 textpointer = 0; | |
3108 text[textpointer++] = '\t'; | |
3109 textpointer += snprintf(&text[textpointer],10,"\020%01.2f", stateUsed->lifeData.ppO2); | |
3110 text[textpointer++] = '\n'; | |
3111 text[textpointer++] = '\r'; | |
3112 text[textpointer++] = '\t'; | |
3113 if((pDecoinfoStandard->output_ceiling_meter > 99.9f) || (settingsGetPointer()->nonMetricalSystem)) | |
3114 textpointer += snprintf(&text[textpointer],10,"\020%01.1f",unit_depth_float(pDecoinfoStandard->output_ceiling_meter)); | |
3115 else | |
3116 textpointer += snprintf(&text[textpointer],10,"\020%01.0f",pDecoinfoStandard->output_ceiling_meter); | |
3117 text[textpointer++] = '\n'; | |
3118 text[textpointer++] = '\r'; | |
3119 text[textpointer++] = '\t'; | |
3120 textpointer += snprintf(&text[textpointer],10,"\020%.0f", 100 * pDecoinfoStandard->output_relative_gradient); | |
3121 text[textpointer++] = '\n'; | |
3122 text[textpointer++] = '\r'; | |
3123 text[textpointer++] = '\t'; | |
3124 textpointer += snprintf(&text[textpointer],10,"\020%.0f\016\016%%\017",fCNS); | |
3125 text[textpointer++] = '\n'; | |
3126 text[textpointer++] = '\r'; | |
3127 text[textpointer++] = '\t'; | |
3128 textpointer += snprintf(&text[textpointer],10,"\020%i'", pDecoinfoFuture->output_time_to_surface_seconds / 60); | |
3129 text[textpointer++] = 0; | |
3130 GFX_write_string(&FontT42, &t7cY0free, text, 1); | |
3131 } | |
3132 | |
3133 | |
3134 | |
3135 | |
3136 /* | |
3137 point_t start, change, stop; | |
3138 float value; | |
3139 uint16_t front; | |
3140 uint8_t color; | |
3141 | |
3142 | |
3143 start.y = t7cH.WindowY0 - 5; | |
3144 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
3145 stop.x = start.x + CUSTOMBOX_SPACE_INSIDE; | |
3146 | |
3147 | |
3148 for(int i=0;i<16;i++) | |
3149 { | |
3150 stop.y = start.y; | |
3151 change.y = start.y; | |
3152 | |
3153 value = pState->lifeData.tissue_nitrogen_bar[i] - 0.7512f; | |
3154 value *= 20; | |
3155 | |
3156 if(value < 0) | |
3157 front = 0; | |
3158 else | |
3159 if(value > CUSTOMBOX_SPACE_INSIDE) | |
3160 front = CUSTOMBOX_SPACE_INSIDE; | |
3161 else | |
3162 front = (uint16_t)value; | |
3163 | |
3164 change.x = start.x + front; | |
3165 if(change.x != start.x) | |
3166 GFX_draw_thick_line(1,&t7screen, start, change, CLUT_Font020); | |
3167 if(change.x != stop.x) | |
3168 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font021); | |
3169 | |
3170 start.y -= 3; | |
3171 } | |
3172 | |
3173 // He | |
3174 start.y -= 28 + 14; | |
3175 for(int i=0;i<16;i++) | |
3176 { | |
3177 stop.y = start.y; | |
3178 change.y = start.y; | |
3179 | |
3180 value = pState->lifeData.tissue_helium_bar[i]; | |
3181 value *= 20; | |
3182 | |
3183 if(value < 0) | |
3184 front = 0; | |
3185 else | |
3186 if(value > CUSTOMBOX_SPACE_INSIDE) | |
3187 front = CUSTOMBOX_SPACE_INSIDE; | |
3188 else | |
3189 front = (uint16_t)value; | |
3190 | |
3191 change.x = start.x + front; | |
3192 if(change.x != start.x) | |
3193 GFX_draw_thick_line(1,&t7screen, start, change, CLUT_Font020); | |
3194 if(change.x != stop.x) | |
3195 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font021); | |
3196 | |
3197 start.y -= 3; | |
3198 } | |
3199 | |
3200 // CNS == Oxygen | |
3201 start.y -= 28 + 14; | |
3202 | |
3203 value = pState->lifeData.cns; | |
3204 value *= (CUSTOMBOX_SPACE_INSIDE/2); | |
3205 value /= 100; | |
3206 | |
3207 if(value < 0) | |
3208 front = 0; | |
3209 else | |
3210 if(value > CUSTOMBOX_SPACE_INSIDE) | |
3211 front = CUSTOMBOX_SPACE_INSIDE; | |
3212 else | |
3213 front = (uint16_t)value; | |
3214 | |
3215 if(pState->lifeData.cns < 95) | |
3216 color = CLUT_Font020; | |
3217 else | |
3218 if(pState->lifeData.cns < 100) | |
3219 color = CLUT_WarningYellow; | |
3220 else | |
3221 color = CLUT_WarningRed; | |
3222 | |
3223 for(int i=0;i<16;i++) | |
3224 { | |
3225 stop.y = start.y; | |
3226 change.y = start.y; | |
3227 | |
3228 change.x = start.x + front; | |
3229 if(change.x != start.x) | |
3230 GFX_draw_thick_line(1,&t7screen, start, change, color); | |
3231 if(change.x != stop.x) | |
3232 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font021); | |
3233 | |
3234 start.y -= 3; | |
3235 } | |
3236 | |
3237 // where is the onload/offload limit for N2 and He | |
3238 decom_get_inert_gases(pState->lifeData.pressure_ambient_bar, &pState->lifeData.actualGas, &percent_N2, &percent_He); | |
3239 partial_pressure_N2 = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_N2; | |
3240 partial_pressure_He = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_He; | |
3241 | |
3242 if((percent_N2 > 0) && (partial_pressure_N2 > (0.8f + 0.5f))) | |
3243 { | |
3244 start.y = t7cH.WindowY0 + 1 - 5; | |
3245 stop.y = start.y - (3 * 15) - 1; | |
3246 | |
3247 value = partial_pressure_N2; | |
3248 value *= 20; | |
3249 | |
3250 if(value < 0) | |
3251 front = 3; | |
3252 else | |
3253 if(value + 5 > CUSTOMBOX_SPACE_INSIDE) | |
3254 front = CUSTOMBOX_SPACE_INSIDE - 3; | |
3255 else | |
3256 front = (uint16_t)value; | |
3257 | |
3258 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + front; | |
3259 stop.x = start.x; | |
3260 GFX_draw_thick_line(2,&t7screen, start, stop, CLUT_EverythingOkayGreen); | |
3261 } | |
3262 | |
3263 if((percent_He > 0) && (partial_pressure_He > 0.5f)) | |
3264 { | |
3265 start.y = t7cH.WindowY0 + 1 - 5 - 3*16 - 28 - 14; | |
3266 stop.y = start.y - (3 * 15) - 1; | |
3267 | |
3268 value = partial_pressure_He; | |
3269 value *= 20; | |
3270 | |
3271 if(value < 0) | |
3272 front = 3; | |
3273 else | |
3274 if(value + 5 > CUSTOMBOX_SPACE_INSIDE) | |
3275 front = CUSTOMBOX_SPACE_INSIDE - 3; | |
3276 else | |
3277 front = (uint16_t)value; | |
3278 | |
3279 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + front; | |
3280 stop.x = start.x; | |
3281 GFX_draw_thick_line(2,&t7screen, start, stop, CLUT_EverythingOkayGreen); | |
3282 } | |
3283 | |
3284 start.y = t7cH.WindowY0 + 1 - 5 - 6*16 - 2*28 - 2*14; | |
3285 stop.y = start.y - (3 * 15) - 1; | |
3286 | |
3287 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + CUSTOMBOX_SPACE_INSIDE/2; | |
3288 stop.x = start.x; | |
3289 GFX_draw_thick_line(2, &t7screen, start, stop, CLUT_WarningRed); | |
3290 */ | |
3291 | |
3292 /* | |
3293 void t7_clock(void) | |
3294 { | |
3295 point_t start, stop; | |
3296 | |
3297 | |
3298 for(uint16_t i=0;i<360;i+=30) | |
3299 { | |
3300 start = t7_compass_circle(1,i); | |
3301 stop = t7_compass_circle(2,i); | |
3302 start.x += 280; // standard center is 400, 250 | |
3303 stop.x += 280; | |
3304 GFX_draw_thick_line(5,&t7screen, start, stop, CLUT_CompassSubTick); | |
3305 | |
3306 start.x = 400+280; | |
3307 start.y = 250; | |
3308 stop = t7_compass_circle(2,58); | |
3309 stop.x += 280; | |
3310 GFX_draw_thick_line(3,&t7screen, start, stop, CLUT_CompassNorthTick); | |
3311 stop = t7_compass_circle(0,302); | |
3312 stop.x += 280; | |
3313 GFX_draw_thick_line(3,&t7screen, start, stop, CLUT_CompassNorthTick); | |
3314 } | |
3315 } | |
3316 */ | |
3317 | |
3318 //static float testCC = 180; | |
3319 void t7_compass(uint16_t ActualHeading, uint16_t UserSetHeading) | |
3320 { | |
3321 | |
3322 /* | |
3323 static uint16_t lastHeading = 0; | |
3324 float differenceCompass, resultKalman; | |
3325 | |
3326 if(testCC > lastHeading) | |
3327 differenceCompass = testCC - lastHeading; | |
3328 else | |
3329 differenceCompass = lastHeading - testCC; | |
3330 | |
3331 resultKalman = Kalman_getAngle(differenceCompass, 2, 0.1); | |
3332 if(testCC > lastHeading) | |
3333 ActualHeading = lastHeading + resultKalman; | |
3334 else | |
3335 ActualHeading = lastHeading - resultKalman; | |
3336 | |
3337 lastHeading = ActualHeading; | |
3338 */ | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3339 uint16_t ActualHeadingRose; |
38 | 3340 uint16_t LeftBorderHeading, LineHeading; |
3341 uint32_t offsetPicture; | |
3342 point_t start, stop, center; | |
3343 static int32_t LastHeading = 0; | |
3344 int32_t newHeading = 0; | |
3345 int32_t diff = 0; | |
3346 int32_t diff2 = 0; | |
3347 | |
3348 int32_t diffAbs = 0; | |
3349 int32_t diffAbs2 = 0; | |
3350 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3351 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3352 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3353 |
38 | 3354 newHeading = ActualHeading; |
3355 | |
3356 diff = newHeading - LastHeading; | |
3357 | |
3358 if(newHeading < LastHeading) | |
3359 diff2 = newHeading + 360 - LastHeading; | |
3360 else | |
3361 diff2 = newHeading - 360 - LastHeading; | |
3362 | |
3363 diffAbs = diff; | |
3364 if(diffAbs < 0) | |
3365 diffAbs *= -1; | |
3366 | |
3367 diffAbs2 = diff2; | |
3368 if(diffAbs2 < 0) | |
3369 diffAbs2 *= -1; | |
3370 | |
3371 | |
3372 if(diffAbs <= diffAbs2) | |
3373 newHeading = LastHeading + (diff / 2); | |
3374 else | |
3375 newHeading = LastHeading + (diff2 / 2); | |
3376 | |
3377 if(newHeading < 0) | |
3378 newHeading += 360; | |
3379 else | |
3380 if(newHeading >= 360) | |
3381 newHeading -= 360; | |
3382 | |
3383 LastHeading = newHeading; | |
3384 ActualHeading = newHeading; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3385 ActualHeadingRose = ActualHeading; |
38 | 3386 /* |
3387 if (ActualHeading < 90) | |
3388 ActualHeading += 360; | |
3389 | |
3390 if(ActualHeading > LastHeading) | |
3391 { | |
3392 if((ActualHeading - LastHeading) < 25) | |
3393 ActualHeading = LastHeading + 1; | |
3394 } | |
3395 else | |
3396 if(ActualHeading < LastHeading) | |
3397 { | |
3398 if((LastHeading - ActualHeading) < 25) | |
3399 ActualHeading = LastHeading - 1; | |
3400 } | |
3401 */ | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3402 if(pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3403 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3404 ActualHeadingRose = 360 - ActualHeadingRose; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3405 if (ActualHeadingRose < 170) ActualHeadingRose += 360; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3406 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3407 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3408 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3409 if (ActualHeadingRose < 90) ActualHeadingRose += 360; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3410 ActualHeading = ActualHeadingRose; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3411 } |
38 | 3412 |
3413 // new hw 160822 | |
3414 // if (ActualHeading >= 360 + 90) | |
3415 // ActualHeading = 360; | |
3416 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3417 LeftBorderHeading = 2 * (ActualHeadingRose - (CUSTOMBOX_SPACE_INSIDE/4)); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3418 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3419 if(pSettings->FlipDisplay) /* add offset caused by mirrowed drawing */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3420 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3421 LeftBorderHeading += 2 * 80; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3422 } |
38 | 3423 |
3424 offsetPicture = LeftBorderHeading * t7screenCompass.ImageHeight * 2; | |
3425 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3426 /* the background is used to draw the rotating compass rose */ |
38 | 3427 background.pointer = t7screenCompass.FBStartAdress+offsetPicture; |
3428 background.x0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3429 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3430 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3431 background.y0 = 65; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3432 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3433 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3434 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3435 background.y0 = 480 - t7screenCompass.ImageHeight - 65; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3436 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3437 |
38 | 3438 background.width = CUSTOMBOX_SPACE_INSIDE; |
3439 background.height = t7screenCompass.ImageHeight; | |
3440 | |
3441 | |
3442 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + (CUSTOMBOX_SPACE_INSIDE/2); | |
3443 stop.x = start.x; | |
3444 start.y = 65; | |
3445 stop.y = start.y + 55; | |
3446 GFX_draw_line(&t7screen, start, stop, CLUT_Font030); | |
3447 | |
3448 | |
3449 center.x = start.x; | |
3450 center.y = 300; | |
3451 | |
3452 stop.x = center.x + 44; | |
3453 stop.y = center.y + 24; | |
3454 | |
3455 | |
3456 while(ActualHeading > 359) ActualHeading -= 360; | |
3457 | |
3458 LineHeading = 360 - ActualHeading; | |
3459 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(0,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font030); // North | |
3460 LineHeading += 90; | |
3461 if(LineHeading > 359) LineHeading -= 360; | |
3462 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); // Maintick | |
3463 LineHeading += 90; | |
3464 if(LineHeading > 359) LineHeading -= 360; | |
3465 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3466 LineHeading += 90; | |
3467 if(LineHeading > 359) LineHeading -= 360; | |
3468 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3469 | |
3470 LineHeading = 360 - ActualHeading; | |
3471 LineHeading += 45; | |
3472 if(LineHeading > 359) LineHeading -= 360; | |
3473 GFX_draw_thick_line(5,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); // Subtick | |
3474 LineHeading += 90; | |
3475 if(LineHeading > 359) LineHeading -= 360; | |
3476 GFX_draw_thick_line(5,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3477 LineHeading += 90; | |
3478 if(LineHeading > 359) LineHeading -= 360; | |
3479 GFX_draw_thick_line(5,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3480 LineHeading += 90; | |
3481 if(LineHeading > 359) LineHeading -= 360; | |
3482 GFX_draw_thick_line(5,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3483 | |
3484 LineHeading = 360 - ActualHeading; | |
3485 LineHeading += 22; | |
3486 if(LineHeading > 359) LineHeading -= 360; | |
3487 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); // Subtick | |
3488 LineHeading += 45; | |
3489 if(LineHeading > 359) LineHeading -= 360; | |
3490 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3491 LineHeading += 45; | |
3492 if(LineHeading > 359) LineHeading -= 360; | |
3493 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3494 LineHeading += 45; | |
3495 if(LineHeading > 359) LineHeading -= 360; | |
3496 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3497 LineHeading += 45; | |
3498 if(LineHeading > 359) LineHeading -= 360; | |
3499 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); // Subtick | |
3500 LineHeading += 45; | |
3501 if(LineHeading > 359) LineHeading -= 360; | |
3502 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3503 LineHeading += 45; | |
3504 if(LineHeading > 359) LineHeading -= 360; | |
3505 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3506 LineHeading += 45; | |
3507 if(LineHeading > 359) LineHeading -= 360; | |
3508 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
3509 | |
3510 if(UserSetHeading) | |
3511 { | |
3512 LineHeading = UserSetHeading + 360 - ActualHeading; | |
3513 if(LineHeading > 359) LineHeading -= 360; | |
3514 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(3,LineHeading), t7_compass_circle(2,LineHeading), CLUT_CompassUserHeadingTick); | |
3515 | |
3516 // R�ckpeilung, User Back Heading | |
3517 LineHeading = UserSetHeading + 360 + 180 - ActualHeading; | |
3518 if(LineHeading > 359) LineHeading -= 360; | |
3519 if(LineHeading > 359) LineHeading -= 360; | |
3520 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(3,LineHeading), t7_compass_circle(2,LineHeading), CLUT_CompassUserBackHeadingTick); | |
3521 } | |
3522 | |
3523 center.x = start.x; | |
3524 center.y = 250; | |
3525 GFX_draw_circle(&t7screen, center, 116, CLUT_Font030); | |
3526 GFX_draw_circle(&t7screen, center, 118, CLUT_Font030); | |
3527 GFX_draw_circle(&t7screen, center, 117, CLUT_Font030); | |
3528 | |
3529 | |
3530 } | |
3531 | |
3532 | |
3533 /* Font_T42: N is 27 px, S is 20 px, W is 36 px, E is 23 px | |
3534 * max is NW with 63 px | |
3535 * Font_T24: N is 15 px, S is 12 px, W is 20 px, E is 13 px | |
3536 * max is NW with 35 px | |
3537 * NE is 28 px | |
3538 * SW is 32 px | |
3539 * SE is 25 px | |
3540 * space between each is 45 px * 2 | |
3541 * FirstItem List | |
3542 * \177 \177 prepare for size | |
3543 */ | |
3544 void init_t7_compass(void) | |
3545 { | |
3546 t7screenCompass.FBStartAdress = getFrame(21); | |
3547 | |
3548 char text[256]; | |
3549 uint8_t textpointer = 0; | |
3550 | |
3551 text[textpointer++] = '\030'; | |
3552 text[textpointer++] = '\177'; | |
3553 text[textpointer++] = '\177'; | |
3554 text[textpointer++] = 76; // 90 - 14 | |
3555 text[textpointer++] = '\016'; | |
3556 text[textpointer++] = '\016'; | |
3557 text[textpointer++] = 'N'; | |
3558 text[textpointer++] = 'E'; // 96 + 28 = 124 total | |
3559 text[textpointer++] = '\017'; | |
3560 text[textpointer++] = '\177'; | |
3561 text[textpointer++] = '\177'; | |
3562 text[textpointer++] = 64; // 90 - 14 - 12 | |
3563 text[textpointer++] = 'E'; // 124 + 74 + 23 = 221 total | |
3564 text[textpointer++] = '\177'; | |
3565 text[textpointer++] = '\177'; | |
3566 text[textpointer++] = 66; // 90 - 11 - 13 | |
3567 text[textpointer++] = '\016'; | |
3568 text[textpointer++] = '\016'; | |
3569 text[textpointer++] = 'S'; | |
3570 text[textpointer++] = 'E'; | |
3571 text[textpointer++] = '\017'; | |
3572 text[textpointer++] = '\177'; | |
3573 text[textpointer++] = '\177'; | |
3574 text[textpointer++] = 68; // 90 - 12 - 10 | |
3575 text[textpointer++] = 'S'; | |
3576 text[textpointer++] = '\177'; | |
3577 text[textpointer++] = '\177'; | |
3578 text[textpointer++] = 64; // 90 - 10 - 16 | |
3579 text[textpointer++] = '\016'; | |
3580 text[textpointer++] = '\016'; | |
3581 text[textpointer++] = 'S'; | |
3582 text[textpointer++] = 'W'; | |
3583 text[textpointer++] = '\017'; | |
3584 text[textpointer++] = '\177'; | |
3585 text[textpointer++] = '\177'; | |
3586 text[textpointer++] = 56; // 90 - 16 - 18 | |
3587 text[textpointer++] = 'W'; | |
3588 text[textpointer++] = '\177'; | |
3589 text[textpointer++] = '\177'; | |
3590 text[textpointer++] = 54; // 90 - 18 - 18 | |
3591 text[textpointer++] = '\016'; | |
3592 text[textpointer++] = '\016'; | |
3593 text[textpointer++] = 'N'; | |
3594 text[textpointer++] = 'W'; | |
3595 text[textpointer++] = '\017'; | |
3596 text[textpointer++] = '\177'; | |
3597 text[textpointer++] = '\177'; | |
3598 text[textpointer++] = 59; // 90 - 17 - 14 | |
3599 text[textpointer++] = 'N'; | |
3600 text[textpointer++] = '\177'; | |
3601 text[textpointer++] = '\177'; | |
3602 text[textpointer++] = 63; // 90 - 13 - 14 | |
3603 text[textpointer++] = '\016'; | |
3604 text[textpointer++] = '\016'; | |
3605 text[textpointer++] = 'N'; | |
3606 text[textpointer++] = 'E'; | |
3607 text[textpointer++] = '\017'; | |
3608 text[textpointer++] = '\177'; | |
3609 text[textpointer++] = '\177'; | |
3610 text[textpointer++] = 64; // 90 - 14 - 12 | |
3611 text[textpointer++] = 'E'; | |
3612 text[textpointer++] = '\177'; | |
3613 text[textpointer++] = '\177'; | |
3614 text[textpointer++] = 66; // 90 - 11 - 13 | |
3615 text[textpointer++] = '\016'; | |
3616 text[textpointer++] = '\016'; | |
3617 text[textpointer++] = 'S'; | |
3618 text[textpointer++] = 'E'; | |
3619 text[textpointer++] = '\017'; | |
3620 text[textpointer++] = '\177'; | |
3621 text[textpointer++] = '\177'; | |
3622 text[textpointer++] = 68; // 90 - 12 - 10 | |
3623 text[textpointer++] = 'S'; | |
3624 text[textpointer++] = '\177'; | |
3625 text[textpointer++] = '\177'; | |
3626 text[textpointer++] = 64; // 90 - 10 - 16 | |
3627 text[textpointer++] = '\016'; | |
3628 text[textpointer++] = '\016'; | |
3629 text[textpointer++] = 'S'; | |
3630 text[textpointer++] = 'W'; | |
3631 text[textpointer++] = '\017'; | |
3632 text[textpointer++] = 0; // end | |
3633 | |
3634 GFX_write_string(&FontT42,&t7pCompass,text,1); | |
3635 | |
3636 releaseAllFramesExcept(21,t7screenCompass.FBStartAdress); | |
3637 } | |
3638 | |
3639 | |
3640 void t7_miniLiveLogProfile(void) | |
3641 { | |
3642 SWindowGimpStyle wintemp; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3643 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3644 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3645 |
38 | 3646 wintemp.left = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
3647 wintemp.right = wintemp.left + CUSTOMBOX_SPACE_INSIDE; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3648 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3649 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3650 wintemp.top = 480 - t7l1.WindowY0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3651 wintemp.bottom = wintemp. top + 200; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3652 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3653 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3654 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3655 wintemp.top = t7l1.WindowY1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3656 wintemp.bottom = wintemp. top + 200; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3657 } |
38 | 3658 |
3659 uint16_t max_depth = (uint16_t)(stateUsed->lifeData.max_depth_meter * 10); | |
3660 | |
3661 GFX_graph_print(&t7screen, &wintemp, 0,1,0, max_depth, getMiniLiveLogbookPointerToData(), getMiniLiveLogbookActualDataLength(), CLUT_Font030, NULL); | |
3662 } | |
3663 | |
3664 void t7_logo_OSTC(void) | |
3665 { | |
3666 SWindowGimpStyle windowGimp; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3667 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3668 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3669 |
38 | 3670 /* OSTC logo */ |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3671 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3672 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3673 windowGimp.left = t7l1.WindowX1 + 32; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3674 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3675 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3676 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3677 windowGimp.left = t7r1.WindowX1 + 32; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3678 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3679 |
38 | 3680 windowGimp.top = 40 + 32; |
3681 GFX_draw_image_monochrome(&t7screen, windowGimp, &ImgOSTC, 0); | |
3682 } |