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