Mercurial > public > ostc4
annotate Discovery/Src/t7.c @ 193:255326edf00b div-fixes-cleanup-1
Bugfix: show proper dive mode
The dive mode shown in the top line on the display was strange. It
could only show CCR and OC, and dive modes Apnea and Gauge where
shown as OC. With this commit, the proper dive mode is shown. Notice
that these strings/abbreviations where not localized, and are still
not localized with this commit. The localized names from the
corresponding menu lines are not really usable (as too long) to shown
in the header.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Sat, 16 Mar 2019 21:52:06 +0100 |
parents | 8b8074080d7b |
children | 2885628ab3ba |
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 | |
193
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
71 /* Imported function prototypes ---------------------------------------------*/ |
38 | 72 extern uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium); |
73 | |
74 /* Exported variables --------------------------------------------------------*/ | |
75 | |
76 /* Private variables ---------------------------------------------------------*/ | |
77 | |
78 GFX_DrawCfgScreen t7screen; | |
79 GFX_DrawCfgScreen t7screenCompass; | |
80 | |
81 /* left 3 fields | |
82 * right 3 fields | |
83 * centered one field on top of customview, one below | |
84 * customview header + customview + warning | |
85 */ | |
86 GFX_DrawCfgWindow t7l1, t7l2, t7l3; | |
87 GFX_DrawCfgWindow t7r1, t7r2, t7r3; | |
88 GFX_DrawCfgWindow t7c1, t7batt, t7c2, t7charge, t7voltage; | |
89 GFX_DrawCfgWindow t7cH, t7cC, t7cW, t7cY0free; | |
90 GFX_DrawCfgWindow t7pCompass; | |
91 GFX_DrawCfgWindow t7surfaceL, t7surfaceR; | |
92 | |
93 uint8_t selection_custom_field = 1; | |
94 uint8_t selection_customview = 1; | |
95 | |
96 uint8_t updateNecessary = 0; | |
97 | |
98 typedef struct{ | |
99 uint32_t pointer; | |
100 uint32_t x0; | |
101 uint32_t y0; | |
102 uint32_t width; | |
103 uint32_t height; | |
104 } SBackground; | |
105 | |
106 SBackground background = | |
107 { | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
108 .pointer = 0, |
38 | 109 }; |
110 | |
111 | |
112 /* Private types -------------------------------------------------------------*/ | |
113 const uint8_t customviewsDiveStandard[] = | |
114 { | |
115 CVIEW_sensors, | |
116 CVIEW_Compass, | |
117 CVIEW_Decolist, | |
118 CVIEW_Tissues, | |
119 CVIEW_Profile, | |
120 CVIEW_Gaslist, | |
121 CVIEW_sensors_mV, | |
122 CVIEW_EADTime, | |
123 CVIEW_SummaryOfLeftCorner, | |
124 CVIEW_noneOrDebug, | |
125 CVIEW_END, | |
126 CVIEW_END | |
127 }; | |
128 | |
129 const uint8_t customviewsSurfaceStandard[] = | |
130 { | |
131 // CVIEW_CompassDebug, | |
132 CVIEW_Hello, | |
133 CVIEW_sensors, | |
134 CVIEW_Compass, | |
135 CVIEW_Tissues, | |
136 CVIEW_sensors_mV, | |
137 CVIEW_END, | |
138 CVIEW_END | |
139 }; | |
140 | |
141 const uint8_t *customviewsDive = customviewsDiveStandard; | |
142 const uint8_t *customviewsSurface = customviewsSurfaceStandard; | |
143 | |
144 #define TEXTSIZE 16 | |
145 /* offset includes line: 2 = line +1 | |
146 * box (line) is 300 px | |
147 * inside is 296 px | |
148 * left of box are 249 px ( 0..248) | |
149 * right of box are 249 px (551 .. 799) | |
150 */ | |
151 | |
152 #define CUSTOMBOX_LINE_LEFT (250) | |
153 #define CUSTOMBOX_LINE_RIGHT (549) | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
154 #define CUSTOMBOX_LINE_TOP (0) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
155 #define CUSTOMBOX_LINE_MIDDLE (142) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
156 #define CUSTOMBOX_LINE_BOTTOM (318) |
38 | 157 #define CUSTOMBOX_INSIDE_OFFSET (2) |
158 #define CUSTOMBOX_OUTSIDE_OFFSET (2) | |
159 #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
|
160 #define TOP_LINE_HIGHT (25) |
38 | 161 |
162 /* Exported functions --------------------------------------------------------*/ | |
163 | |
164 void t7_init(void) | |
165 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
166 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
167 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
168 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
169 |
38 | 170 selection_custom_field = 1; |
171 selection_customview = customviewsSurface[0]; | |
172 | |
173 t7screen.FBStartAdress = 0; | |
174 t7screen.ImageHeight = 480; | |
175 t7screen.ImageWidth = 800; | |
176 t7screen.LayerIndex = 1; | |
177 | |
178 t7screenCompass.FBStartAdress = 0; | |
179 t7screenCompass.ImageHeight = 240; | |
180 t7screenCompass.ImageWidth = 1600; | |
181 t7screenCompass.LayerIndex = 0; | |
182 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
183 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
184 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
185 t7l1.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
186 t7l1.WindowNumberOfTextLines = 2; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
187 t7l1.WindowLineSpacing = 19; // Abstand von Y0 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
188 t7l1.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
189 t7l1.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
190 t7l1.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
191 t7l1.WindowY0 = 318; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
192 t7l1.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
193 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
194 t7l2.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
195 t7l2.WindowNumberOfTextLines = 2; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
196 t7l2.WindowLineSpacing = 22; // Abstand von Y0 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
197 t7l2.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
198 t7l2.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
199 t7l2.WindowX1 = t7l1.WindowX1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
200 t7l2.WindowY0 = 142; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
201 t7l2.WindowY1 = t7l1.WindowY0 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
202 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
203 t7l3.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
204 t7l3.WindowNumberOfTextLines = 2; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
205 t7l3.WindowLineSpacing = 58; // Abstand von Y0 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
206 t7l3.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
207 t7l3.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
208 t7l3.WindowX1 = t7l1.WindowX1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
209 t7l3.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
210 t7l3.WindowY1 = t7l2.WindowY0 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
211 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
212 t7r1.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
213 t7r1.WindowNumberOfTextLines = 2; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
214 t7r1.WindowLineSpacing = t7l1.WindowLineSpacing; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
215 t7r1.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
216 t7r1.WindowX0 = 550; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
217 t7r1.WindowX1 = 799; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
218 t7r1.WindowY0 = t7l1.WindowY0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
219 t7r1.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
220 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
221 t7r2.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
222 t7r2.WindowNumberOfTextLines = 2; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
223 t7r2.WindowLineSpacing = t7l2.WindowLineSpacing; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
224 t7r2.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
225 t7r2.WindowX0 = 550; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
226 t7r2.WindowX1 = 799; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
227 t7r2.WindowY0 = t7l2.WindowY0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
228 t7r2.WindowY1 = t7l2.WindowY1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
229 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
230 t7r3.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
231 t7r3.WindowNumberOfTextLines = 2; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
232 t7r3.WindowLineSpacing = 0;//t7l3.WindowLineSpacing; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
233 t7r3.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
234 t7r3.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
235 t7r3.WindowX1 = 799; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
236 t7r3.WindowY0 = t7l3.WindowY0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
237 t7r3.WindowY1 = t7l3.WindowY1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
238 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
239 t7cC.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
240 t7cC.WindowNumberOfTextLines = 3; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
241 t7cC.WindowLineSpacing = 95; // Abstand von Y0 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
242 t7cC.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
243 t7cC.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
244 t7cC.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
245 t7cC.WindowY0 = 90; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
246 t7cC.WindowY1 = 434 - 95; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
247 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
248 t7cH.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
249 t7cH.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
250 t7cH.WindowLineSpacing = 95; // Abstand von Y0 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
251 t7cH.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
252 t7cH.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
253 t7cH.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
254 t7cH.WindowY0 = 434 - 94; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
255 t7cH.WindowY1 = 434; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
256 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
257 t7cW.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
258 t7cW.WindowNumberOfTextLines = 3; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
259 t7cW.WindowLineSpacing = 95; // Abstand von Y0 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
260 t7cW.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
261 t7cW.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
262 t7cW.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
263 t7cW.WindowY0 = 90; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
264 t7cW.WindowY1 = 434 - 95; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
265 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
266 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
267 t7surfaceL.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
268 t7surfaceL.WindowNumberOfTextLines = 9; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
269 t7surfaceL.WindowLineSpacing = 53; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
270 t7surfaceL.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
271 t7surfaceL.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
272 t7surfaceL.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
273 t7surfaceL.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
274 t7surfaceL.WindowY1 = 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
275 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
276 t7surfaceR.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
277 t7surfaceR.WindowNumberOfTextLines = 9; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
278 t7surfaceR.WindowLineSpacing = 53; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
279 t7surfaceR.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
280 t7surfaceR.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
281 t7surfaceR.WindowX1 = 800; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
282 t7surfaceR.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
283 t7surfaceR.WindowY1 = 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
284 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
285 t7cY0free.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
286 t7cY0free.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
287 t7cY0free.WindowLineSpacing = 95; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
288 t7cY0free.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
289 t7cY0free.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
290 t7cY0free.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
291 t7cY0free.WindowY0 = 90; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
292 t7cY0free.WindowY1 = 434 - 95; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
293 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
294 t7batt.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
295 t7batt.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
296 t7batt.WindowLineSpacing = 10; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
297 t7batt.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
298 t7batt.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
299 t7batt.WindowX0 = t7batt.WindowX1 - (52+52); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
300 t7batt.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
301 t7batt.WindowY0 = t7batt.WindowY1 - 25; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
302 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
303 t7charge.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
304 t7charge.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
305 t7charge.WindowLineSpacing = 10; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
306 t7charge.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
307 t7charge.WindowX1 = t7batt.WindowX1 - 18; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
308 t7charge.WindowX0 = t7charge.WindowX1 - 14; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
309 t7charge.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
310 t7charge.WindowY0 = t7batt.WindowY1 - 25; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
311 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
312 t7voltage.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
313 t7voltage.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
314 t7voltage.WindowLineSpacing = 10; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
315 t7voltage.WindowTab = 100; |
145 | 316 t7voltage.WindowX0 = t7charge.WindowX0 - 10; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
317 t7voltage.WindowX1 = t7voltage.WindowX0 + (18*3)+ 9; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
318 t7voltage.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
319 t7voltage.WindowY0 = t7batt.WindowY1 - 25; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
320 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
321 t7c1.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
322 t7c1.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
323 t7c1.WindowLineSpacing = 10; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
324 t7c1.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
325 t7c1.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
326 t7c1.WindowX1 = t7batt.WindowX0 - 18; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
327 t7c1.WindowY0 = 435; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
328 t7c1.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
329 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
330 t7c2.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
331 t7c2.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
332 t7c2.WindowLineSpacing = 0; // Abstand von Y0 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
333 t7c2.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
334 t7c2.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
335 t7c2.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
336 t7c2.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
337 t7c2.WindowY1 = 69; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
338 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
339 t7pCompass.Image = &t7screenCompass; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
340 t7pCompass.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
341 t7pCompass.WindowLineSpacing = 100; // Abstand von Y0 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
342 t7pCompass.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
343 t7pCompass.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
344 t7pCompass.WindowX1 = 1600-1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
345 t7pCompass.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
346 t7pCompass.WindowY1 = 100-1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
347 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
348 else |
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 /* 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
|
351 |
38 | 352 t7l1.Image = &t7screen; |
353 t7l1.WindowNumberOfTextLines = 2; | |
354 t7l1.WindowLineSpacing = 19; // Abstand von Y0 | |
355 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
|
356 t7l1.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
357 t7l1.WindowX1 = 799; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
358 t7l1.WindowY0 = CUSTOMBOX_LINE_TOP; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
359 t7l1.WindowY1 = 150 + TOP_LINE_HIGHT; |
38 | 360 |
361 t7l2.Image = &t7screen; | |
362 t7l2.WindowNumberOfTextLines = 2; | |
363 t7l2.WindowLineSpacing = 22; // Abstand von Y0 | |
364 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
|
365 t7l2.WindowX0 = t7l1.WindowX0; |
38 | 366 t7l2.WindowX1 = t7l1.WindowX1; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
367 t7l2.WindowY0 = t7l1.WindowY1 + 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
368 t7l2.WindowY1 = t7l2.WindowY0 + 146; |
38 | 369 |
370 t7l3.Image = &t7screen; | |
371 t7l3.WindowNumberOfTextLines = 2; | |
372 t7l3.WindowLineSpacing = 58; // Abstand von Y0 | |
373 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
|
374 t7l3.WindowX0 = t7l1.WindowX0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
375 t7l3.WindowX1 = t7l1.WindowX1;; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
376 t7l3.WindowY0 = 479 - 150; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
377 t7l3.WindowY1 = 479; |
38 | 378 |
379 t7r1.Image = &t7screen; | |
380 t7r1.WindowNumberOfTextLines = 2; | |
381 t7r1.WindowLineSpacing = t7l1.WindowLineSpacing; | |
382 t7r1.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
383 t7r1.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
384 t7r1.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET; |
38 | 385 t7r1.WindowY0 = t7l1.WindowY0; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
386 t7r1.WindowY1 = t7l1.WindowY1; |
38 | 387 |
388 t7r2.Image = &t7screen; | |
389 t7r2.WindowNumberOfTextLines = 2; | |
390 t7r2.WindowLineSpacing = t7l2.WindowLineSpacing; | |
391 t7r2.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
392 t7r2.WindowX0 = t7r1.WindowX0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
393 t7r2.WindowX1 = t7r1.WindowX1; |
38 | 394 t7r2.WindowY0 = t7l2.WindowY0; |
395 t7r2.WindowY1 = t7l2.WindowY1; | |
396 | |
397 t7r3.Image = &t7screen; | |
398 t7r3.WindowNumberOfTextLines = 2; | |
399 t7r3.WindowLineSpacing = 0;//t7l3.WindowLineSpacing; | |
400 t7r3.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
401 t7r3.WindowX0 = t7r1.WindowX0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
402 t7r3.WindowX1 = t7r1.WindowX1; |
38 | 403 t7r3.WindowY0 = t7l3.WindowY0; |
404 t7r3.WindowY1 = t7l3.WindowY1; | |
405 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
406 /* screen for CustomText / serial number */ |
38 | 407 t7cC.Image = &t7screen; |
408 t7cC.WindowNumberOfTextLines = 3; | |
409 t7cC.WindowLineSpacing = 95; // Abstand von Y0 | |
410 t7cC.WindowTab = 100; | |
411 t7cC.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
412 t7cC.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
413 t7cC.WindowY0 = 165; //90; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
414 t7cC.WindowY1 = 415; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
415 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
416 /* used by warning message box */ |
38 | 417 t7cH.Image = &t7screen; |
418 t7cH.WindowNumberOfTextLines = 1; | |
419 t7cH.WindowLineSpacing = 95; // Abstand von Y0 | |
420 t7cH.WindowTab = 100; | |
421 t7cH.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
422 t7cH.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
423 t7cH.WindowY0 = 46; //480 - 434; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
424 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
|
425 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
426 /* used by warning custom box */ |
38 | 427 t7cW.Image = &t7screen; |
428 t7cW.WindowNumberOfTextLines = 3; | |
429 t7cW.WindowLineSpacing = 95; // Abstand von Y0 | |
430 t7cW.WindowTab = 100; | |
431 t7cW.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
432 t7cW.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
433 t7cW.WindowY0 = 480 - (434 - 90); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
434 t7cW.WindowY1 = 480 - 90; //434 - 95; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
435 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
436 /* time and environment */ |
38 | 437 t7surfaceL.Image = &t7screen; |
438 t7surfaceL.WindowNumberOfTextLines = 9; | |
439 t7surfaceL.WindowLineSpacing = 53; | |
440 t7surfaceL.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
441 t7surfaceL.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
442 t7surfaceL.WindowX1 = 799; |
38 | 443 t7surfaceL.WindowY0 = 0; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
444 t7surfaceL.WindowY1 = 479; |
38 | 445 |
446 t7surfaceR.Image = &t7screen; | |
447 t7surfaceR.WindowNumberOfTextLines = 9; | |
448 t7surfaceR.WindowLineSpacing = 53; | |
449 t7surfaceR.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
450 t7surfaceR.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
451 t7surfaceR.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET; |
38 | 452 t7surfaceR.WindowY0 = 0; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
453 t7surfaceR.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
454 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
455 /* info screen in the middle */ |
38 | 456 t7cY0free.Image = &t7screen; |
457 t7cY0free.WindowNumberOfTextLines = 1; | |
458 t7cY0free.WindowLineSpacing = 95; | |
459 t7cY0free.WindowTab = 100; | |
460 t7cY0free.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
461 t7cY0free.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
462 t7cY0free.WindowY0 = 115; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
463 t7cY0free.WindowY1 = 365; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
464 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
465 /* voltage value (V or %) */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
466 t7voltage.Image = &t7screen; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
467 t7voltage.WindowNumberOfTextLines = 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
468 t7voltage.WindowLineSpacing = 10; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
469 t7voltage.WindowTab = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
470 t7voltage.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
471 t7voltage.WindowX1 = t7voltage.WindowX0 + (18*3) +9; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
472 t7voltage.WindowY1 = TOP_LINE_HIGHT; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
473 t7voltage.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
474 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
475 /* battery symbol */ |
38 | 476 t7batt.Image = &t7screen; |
477 t7batt.WindowNumberOfTextLines = 1; | |
478 t7batt.WindowLineSpacing = 10; | |
479 t7batt.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
480 t7batt.WindowX0 = t7voltage.WindowX1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
481 t7batt.WindowX1 = t7batt.WindowX0 + (52); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
482 t7batt.WindowY1 = TOP_LINE_HIGHT; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
483 t7batt.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
484 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
485 /* charger symbol */ |
38 | 486 t7charge.Image = &t7screen; |
487 t7charge.WindowNumberOfTextLines = 1; | |
488 t7charge.WindowLineSpacing = 10; | |
489 t7charge.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
490 t7charge.WindowX1 = t7batt.WindowX0 - 18; |
38 | 491 t7charge.WindowX0 = t7charge.WindowX1 - 14; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
492 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
493 t7charge.WindowY1 = TOP_LINE_HIGHT; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
494 t7charge.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
495 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
496 /* show dive mode OC / CC */ |
38 | 497 t7c1.Image = &t7screen; |
498 t7c1.WindowNumberOfTextLines = 1; | |
499 t7c1.WindowLineSpacing = 10; | |
500 t7c1.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
501 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
|
502 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
|
503 t7c1.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
504 t7c1.WindowY1 = 479 - 435; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
505 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
506 /* Gas warnings and exit Sim*/ |
38 | 507 t7c2.Image = &t7screen; |
508 t7c2.WindowNumberOfTextLines = 1; | |
509 t7c2.WindowLineSpacing = 0; // Abstand von Y0 | |
510 t7c2.WindowTab = 100; | |
511 t7c2.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
512 t7c2.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
513 t7c2.WindowY0 = 480 - 69; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
514 t7c2.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
515 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
516 /* Rotating compass */ |
38 | 517 t7pCompass.Image = &t7screenCompass; |
518 t7pCompass.WindowNumberOfTextLines = 1; | |
519 t7pCompass.WindowLineSpacing = 100; // Abstand von Y0 | |
520 t7pCompass.WindowTab = 100; | |
521 t7pCompass.WindowX0 = 0; | |
522 t7pCompass.WindowX1 = 1600-1; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
523 t7pCompass.WindowY0 = 479 - 75; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
524 t7pCompass.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
525 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
526 } |
38 | 527 |
528 init_t7_compass(); | |
529 } | |
530 | |
531 | |
532 void t7_refresh_sleepmode_fun(void) | |
533 { | |
534 uint32_t oldScreen; | |
535 | |
536 oldScreen = t7screen.FBStartAdress; | |
537 t7screen.FBStartAdress = getFrame(22); | |
538 | |
539 t7_refresh_sleep_design_fun(); | |
540 | |
541 if(get_globalState() == StStop) | |
542 { | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
543 GFX_SetFramesTopBottom(t7screen.FBStartAdress, 0,480); |
38 | 544 } |
545 releaseFrame(22,oldScreen); | |
546 } | |
547 | |
548 | |
549 void t7_refresh(void) | |
550 { | |
551 static uint8_t last_mode = MODE_SURFACE; | |
552 | |
553 // uint32_t oldScreen;//, oldPlugin; | |
554 SStateList status; | |
555 get_globalStateList(&status); | |
556 | |
557 t7screen.FBStartAdress = getFrame(22); | |
558 | |
559 background.pointer = 0; | |
560 | |
561 if(stateUsed->mode == MODE_DIVE) | |
562 { | |
563 if(last_mode != MODE_DIVE) | |
564 { | |
565 last_mode = MODE_DIVE; | |
566 /* lower left corner primary */ | |
567 selection_custom_field = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; | |
568 /* custom view primary OR debug if automatic return is off */ | |
569 if((settingsGetPointer()->tX_customViewTimeout == 0) && (settingsGetPointer()->showDebugInfo)) | |
570 selection_customview = CVIEW_noneOrDebug; | |
571 else | |
572 selection_customview = settingsGetPointer()->tX_customViewPrimary; | |
573 } | |
574 | |
575 if(status.page == PageSurface) | |
576 set_globalState(StD); | |
577 | |
578 if(stateUsed->diveSettings.diveMode == DIVEMODE_Gauge) | |
579 { | |
580 settingsGetPointer()->design = 5; | |
581 releaseAllFramesExcept(22,t7screen.FBStartAdress); | |
582 releaseFrame(22,t7screen.FBStartAdress); | |
583 return; | |
584 } | |
585 else if(stateUsed->diveSettings.diveMode == DIVEMODE_Apnea) | |
586 { | |
587 settingsGetPointer()->design = 6; | |
588 releaseAllFramesExcept(22,t7screen.FBStartAdress); | |
589 releaseFrame(22,t7screen.FBStartAdress); | |
590 return; | |
591 } | |
592 else | |
593 { | |
594 t7_refresh_divemode(); | |
595 } | |
596 } | |
597 else // from if(stateUsed->mode == MODE_DIVE) | |
598 { | |
599 if(last_mode != MODE_SURFACE) | |
600 { | |
601 last_mode = MODE_SURFACE; | |
602 selection_customview = customviewsSurface[0]; | |
603 } | |
604 if(status.page == PageDive) | |
605 set_globalState(StS); | |
606 | |
607 if(settingsGetPointer()->showDebugInfo) | |
608 t7_refresh_surface_debugmode(); | |
609 else | |
610 t7_refresh_surface(); | |
611 } | |
612 | |
613 tHome_show_lost_connection_count(&t7screen); | |
614 | |
615 if(status.base == BaseHome) | |
616 { | |
617 if(background.pointer) | |
618 { | |
619 GFX_SetFrameTop(t7screen.FBStartAdress); | |
620 GFX_SetFrameBottom(background.pointer,background.x0 , background.y0, background.width, background.height); | |
621 } | |
622 else | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
623 GFX_SetFramesTopBottom(t7screen.FBStartAdress, 0,480); |
38 | 624 } |
625 | |
626 releaseAllFramesExcept(22,t7screen.FBStartAdress); | |
627 } | |
628 | |
629 /* Private functions ---------------------------------------------------------*/ | |
630 | |
631 void t7_fill_surfacetime_helper(SSurfacetime *outArray, uint32_t inputMinutes, uint32_t inputSeconds) | |
632 { | |
633 inputSeconds += inputMinutes * 60; | |
634 | |
635 outArray->Total = inputSeconds; | |
636 | |
637 outArray->Days = inputSeconds / 86400;// (24*60*60); | |
638 inputSeconds -= 86400 * (uint32_t)outArray->Days; | |
639 | |
640 outArray->Hours = inputSeconds / 3600;// (60*60); | |
641 inputSeconds -= 3600 * (uint32_t)outArray->Hours; | |
642 | |
643 outArray->Minutes = inputSeconds / 60;; | |
644 inputSeconds -= 60 * (uint32_t)outArray->Minutes; | |
645 | |
646 outArray->Seconds = inputSeconds; | |
647 } | |
648 | |
649 void t7_refresh_sleep_design_fun(void) | |
650 { | |
651 static uint16_t state = 0; | |
652 uint16_t ytop = 0; | |
653 | |
654 state +=1; | |
655 if(state > 800) | |
656 state = 1; | |
657 | |
658 if(state > 400) | |
659 ytop = 800 - state; | |
660 else | |
661 ytop = 0 + state; | |
178
d36596281501
Minor: Replace stupid "Sleep Sleep Sleep" message with something more meaningful
heinrichsweikamp
parents:
174
diff
changeset
|
662 Gfx_write_label_var(&t7screen, 300,800, ytop,&FontT48,CLUT_Font020,"Shutting down..."); |
38 | 663 } |
664 | |
665 void t7_refresh_surface(void) | |
666 { | |
667 char text[256]; | |
668 uint8_t date[3], year,month,day; | |
669 uint32_t color; | |
670 uint8_t customview_warnings = 0; | |
671 | |
672 RTC_DateTypeDef Sdate; | |
673 RTC_TimeTypeDef Stime; | |
674 RTC_DateTypeDef SdateFirmware; | |
675 | |
676 uint8_t dateNotSet = 0; | |
677 | |
678 uint8_t oxygen_percentage, gasOffset, actualGasID; | |
679 // uint16_t bottleFirstGas_bar; | |
680 point_t start, stop;//, other; | |
681 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
682 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
683 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
684 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
685 |
38 | 686 // update in all customview modes |
687 if(DataEX_check_RTE_version__needs_update() || font_update_required()) | |
688 updateNecessary = 1; | |
689 else | |
690 updateNecessary = 0; | |
691 | |
692 /* buttons */ | |
693 text[0] = TXT_2BYTE; | |
694 text[1] = TXT2BYTE_ButtonLogbook; | |
695 text[2] = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
696 write_content_simple(&t7screen, 0, 799, 479-TOP_LINE_HIGHT, &FontT24,text,CLUT_ButtonSurfaceScreen); |
38 | 697 |
698 text[0] = '\001'; | |
699 text[1] = TXT_2BYTE; | |
700 text[2] = TXT2BYTE_ButtonView; | |
701 text[3] = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
702 write_content_simple(&t7screen, 0, 799, 479-TOP_LINE_HIGHT, &FontT24,text,CLUT_ButtonSurfaceScreen); |
38 | 703 |
704 text[0] = '\002'; | |
705 text[1] = TXT_2BYTE; | |
706 text[2] = TXT2BYTE_ButtonMenu; | |
707 text[3] = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
708 write_content_simple(&t7screen, 0, 799, 479-TOP_LINE_HIGHT, &FontT24,text,CLUT_ButtonSurfaceScreen); |
38 | 709 |
710 /* was power on reset */ | |
711 //..... | |
712 /* removed hw 160802 in V1.1.1 | |
713 if(errorsInSettings) | |
714 { | |
715 sprintf(text,"Settings: %u",errorsInSettings); | |
716 GFX_write_string_color(&FontT42,&t7surfaceR,text,4,CLUT_WarningRed); | |
717 } | |
718 else | |
719 */ | |
720 if(DataEX_was_power_on()) | |
721 GFX_write_string_color(&FontT42,&t7surfaceR,"cold start",4,CLUT_WarningRed); | |
722 | |
723 /* time and date */ | |
724 translateDate(stateUsed->lifeData.dateBinaryFormat, &Sdate); | |
725 translateTime(stateUsed->lifeData.timeBinaryFormat, &Stime); | |
726 | |
727 firmwareGetDate(&SdateFirmware); | |
728 if(tHome_DateCode(&Sdate) < tHome_DateCode(&SdateFirmware)) | |
729 dateNotSet = 1; | |
730 else | |
731 dateNotSet = 0; | |
732 /* | |
733 if(Stime.Seconds % 2) | |
734 snprintf(text,255,"\001%02d:%02d",Stime.Hours,Stime.Minutes); | |
735 else | |
736 snprintf(text,255,"\001%02d\021:\020%02d",Stime.Hours,Stime.Minutes); | |
737 GFX_write_string(&FontT54,&t7surfaceR,text,3); | |
738 */ | |
739 // debug version: | |
740 if(Stime.Seconds % 2) | |
741 snprintf(text,255,"\001%02d:%02d:%02d",Stime.Hours,Stime.Minutes,Stime.Seconds); | |
742 else if(dateNotSet) | |
743 snprintf(text,255,"\001\021%02d:%02d:%02d\020",Stime.Hours,Stime.Minutes,Stime.Seconds); | |
744 else | |
745 snprintf(text,255,"\001%02d\021:\020%02d:%02d",Stime.Hours,Stime.Minutes,Stime.Seconds); | |
746 GFX_write_string(&FontT54,&t7surfaceR,text,3); | |
747 | |
748 if(settingsGetPointer()->date_format == DDMMYY) | |
749 { | |
750 day = 0; | |
751 month = 1; | |
752 year = 2; | |
753 } | |
754 else | |
755 if(settingsGetPointer()->date_format == MMDDYY) | |
756 { | |
757 day = 1; | |
758 month = 0; | |
759 year = 2; | |
760 } | |
761 else | |
762 { | |
763 day = 2; | |
764 month = 1; | |
765 year = 0; | |
766 } | |
767 date[day] = Sdate.Date; | |
768 date[month] = Sdate.Month; | |
769 date[year] = Sdate.Year; | |
770 | |
771 if((Stime.Seconds % 2) || (dateNotSet == 0)) | |
772 snprintf(text,255,"\001%02d.%02d.%02d",date[0],date[1],date[2]); | |
773 else | |
774 snprintf(text,255,"\001\021%02d.%02d.%02d",date[0],date[1],date[2]); | |
775 | |
776 GFX_write_string(&FontT54,&t7surfaceR,text,5); | |
777 | |
778 if(!DataEX_was_power_on() && !errorsInSettings) | |
779 { | |
780 text[0] = '\001'; | |
781 text[1] = '\004'; | |
782 text[2] = TXT_2BYTE; | |
783 text[3] = TXT2BYTE_Sunday; | |
784 text[4] = 0; | |
785 if(Sdate.WeekDay != RTC_WEEKDAY_SUNDAY) | |
786 text[3] += Sdate.WeekDay; | |
787 | |
788 if(!(Stime.Seconds % 2) && (dateNotSet == 1)) | |
789 text[1] = '\021'; | |
790 | |
791 GFX_write_string(&FontT24,&t7surfaceR,text,4); | |
792 } | |
793 | |
794 /* DEBUG uTick Pressure and Compass */ | |
795 /* | |
796 snprintf(text,255,"\001%u",stateRealGetPointer()->pressure_uTick_new - stateRealGetPointer()->pressure_uTick_old); | |
797 GFX_write_string(&FontT42,&t7surfaceR,text,1); | |
798 snprintf(text,255,"\001%u",HAL_GetTick() - stateRealGetPointer()->pressure_uTick_local_new); | |
799 GFX_write_string(&FontT42,&t7surfaceR,text,2); | |
800 | |
801 snprintf(text,255,"\001%u",stateRealGetPointer()->compass_uTick_new - stateRealGetPointer()->compass_uTick_old); | |
802 GFX_write_string(&FontT42,&t7surfaceR,text,6); | |
803 snprintf(text,255,"\001%u",HAL_GetTick() - stateRealGetPointer()->compass_uTick_local_new); | |
804 GFX_write_string(&FontT42,&t7surfaceR,text,7); | |
805 | |
806 static uint32_t bildschirmRefresh = 0; | |
807 snprintf(text,255,"\001%u",HAL_GetTick() - bildschirmRefresh); | |
808 GFX_write_string(&FontT42,&t7surfaceR,text,8); | |
809 bildschirmRefresh = HAL_GetTick(); | |
810 | |
811 static uint16_t bildschirmRefreshCount = 1; | |
812 if(bildschirmRefreshCount>10) | |
813 bildschirmRefreshCount = 1; | |
814 for(int i=0;i<bildschirmRefreshCount;i++) | |
815 text[i] = '.'; | |
816 text[bildschirmRefreshCount++] = 0; | |
817 GFX_write_string(&FontT42,&t7surfaceR,text,4); | |
818 */ | |
819 | |
820 /* noFlyTime or DesaturationTime */ | |
821 | |
822 if((!display_count_high_time) && (stateUsed->lifeData.no_fly_time_minutes)) | |
823 { | |
824 SSurfacetime NoFlyTime = {0,0,0,0}; | |
825 t7_fill_surfacetime_helper(&NoFlyTime,stateUsed->lifeData.no_fly_time_minutes, 0); | |
826 | |
827 if(NoFlyTime.Days) | |
828 { | |
829 snprintf(text,30,"\001%02d\016\016d\017 %02d\016\016h\017",NoFlyTime.Days, NoFlyTime.Hours); | |
830 } | |
831 else | |
832 { | |
833 snprintf(text,20,"\001%02d:%02d",NoFlyTime.Hours, NoFlyTime.Minutes); | |
834 } | |
835 | |
836 GFX_write_string(&FontT54,&t7surfaceR,text,7); | |
837 | |
838 text[0] = '\001'; | |
839 text[1] = '\022'; | |
840 text[2] = '\016'; | |
841 text[3] = '\016'; | |
842 text[4] = TXT_2BYTE; | |
843 text[5] = TXT2BYTE_noFly; | |
844 text[6] = 0; | |
845 GFX_write_string(&FontT48,&t7surfaceR,text,6); | |
846 } | |
847 else | |
848 if(stateUsed->lifeData.desaturation_time_minutes) | |
849 { | |
850 SSurfacetime DesatTime = {0,0,0,0}; | |
851 t7_fill_surfacetime_helper(&DesatTime,stateUsed->lifeData.desaturation_time_minutes, 0); | |
852 | |
853 if(DesatTime.Days) | |
854 { | |
855 snprintf(text,30,"\001%02d\016\016d\017 %02d\016\016h\017",DesatTime.Days, DesatTime.Hours); | |
856 } | |
857 else | |
858 { | |
859 snprintf(text,20,"\001%02d:%02d",DesatTime.Hours, DesatTime.Minutes); | |
860 } | |
861 GFX_write_string(&FontT54,&t7surfaceR,text,7); | |
862 | |
863 text[0] = '\001'; | |
864 text[1] = '\022'; | |
865 text[2] = '\016'; | |
866 text[3] = '\016'; | |
867 text[4] = TXT_2BYTE; | |
868 text[5] = TXT2BYTE_Desaturation; | |
869 text[6] = 0; | |
870 GFX_write_string(&FontT48,&t7surfaceR,text,6); | |
871 } | |
872 | |
873 /* Time since last dive */ | |
874 if(stateUsed->lifeData.surface_time_seconds) | |
875 { | |
876 SSurfacetime SurfTime = {0,0,0,0}; | |
877 t7_fill_surfacetime_helper(&SurfTime, 0, stateUsed->lifeData.surface_time_seconds); | |
878 | |
879 if(SurfTime.Days == 0) | |
880 { | |
881 snprintf(text,20,"\001\022%02d:%02d",SurfTime.Hours, SurfTime.Minutes); | |
882 } | |
883 else | |
884 { | |
885 snprintf(text,30,"\001\022%02d\016\016d\017 %02d\016\016h\017",SurfTime.Days, SurfTime.Hours); | |
886 } | |
887 | |
888 GFX_write_string(&FontT54,&t7surfaceR,text,2); | |
889 | |
890 | |
891 text[0] = '\001'; | |
892 text[1] = '\022'; | |
893 text[2] = '\016'; | |
894 text[3] = '\016'; | |
895 text[4] = TXT_2BYTE; | |
896 text[5] = TXT2BYTE_TimeSinceLastDive; | |
897 text[6] = 0; | |
898 GFX_write_string(&FontT48,&t7surfaceR,text,1); | |
899 } | |
900 | |
901 /* beta version */ | |
902 if( firmwareDataGetPointer()->versionBeta ) | |
903 { | |
904 snprintf(text,255,"\025 BETA"); | |
905 GFX_write_string(&FontT48,&t7surfaceL,text,2); | |
906 } | |
907 | |
908 /* surface pressure and temperature */ | |
909 if(stateUsed->sensorErrorsRTE == 0) | |
910 { | |
103
f5d2f02dc73f
Generalize TEXT of pressure unit
Dmitry Romanov <kitt@bk.ru>
parents:
102
diff
changeset
|
911 snprintf(text,30,"%01.0f\022\016\016 %s", stateUsed->lifeData.pressure_surface_bar * 1000.0f,TEXT_PRESSURE_UNIT); |
38 | 912 GFX_write_string(&FontT48,&t7surfaceL,text,3); |
913 | |
914 if(settingsGetPointer()->nonMetricalSystem) | |
915 snprintf(text,40,"%01.0f\140\022\016\016 fahrenheit",unit_temperature_float(stateUsed->lifeData.temperature_celsius)); | |
916 else | |
917 snprintf(text,30,"%01.0f\140\022\016\016 celsius",stateUsed->lifeData.temperature_celsius); | |
918 GFX_write_string(&FontT48,&t7surfaceL,text,4); | |
919 } | |
920 else | |
921 { | |
103
f5d2f02dc73f
Generalize TEXT of pressure unit
Dmitry Romanov <kitt@bk.ru>
parents:
102
diff
changeset
|
922 snprintf(text,30,"ERR\022\016\016 %s",TEXT_PRESSURE_UNIT); |
38 | 923 GFX_write_string(&FontT48,&t7surfaceL,text,3); |
924 | |
925 if(settingsGetPointer()->nonMetricalSystem) | |
926 snprintf(text,40,"ERR\022\016\016 fahrenheit"); | |
927 else | |
928 snprintf(text,30,"ERR\022\016\016 celsius"); | |
929 GFX_write_string(&FontT48,&t7surfaceL,text,4); | |
930 } | |
931 | |
932 | |
933 /* gas mix and selection */ | |
934 if((stateUsed->diveSettings.diveMode == DIVEMODE_Gauge) || (stateUsed->diveSettings.diveMode == DIVEMODE_Apnea)) | |
935 { | |
936 if(stateUsed->diveSettings.diveMode == DIVEMODE_Gauge) | |
937 text[0] = TXT_Gauge; | |
938 else | |
939 text[0] = TXT_Apnoe; | |
940 | |
941 text[1] = 0; | |
942 GFX_write_string(&FontT48,&t7surfaceL,text,6); | |
943 } | |
944 else | |
945 { | |
946 text[0] = '\021'; | |
947 text[1] = '1'; | |
948 text[2] = '\177'; | |
949 text[3] = '\177'; | |
950 text[4] = 10; | |
951 text[5] = '\021'; | |
952 text[6] = '2'; | |
953 text[7] = '\177'; | |
954 text[8] = '\177'; | |
955 text[9] = 10; | |
956 text[10] = '\021'; | |
957 text[11] = '3'; | |
958 text[12] = '\177'; | |
959 text[13] = '\177'; | |
960 text[14] = 10; | |
961 text[15] = '\021'; | |
962 text[16] = '4'; | |
963 text[17] = '\177'; | |
964 text[18] = '\177'; | |
965 text[19] = 10; | |
966 text[20] = '\021'; | |
967 text[21] = '5'; | |
968 text[22] = 0; | |
969 | |
970 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) | |
971 gasOffset = NUM_OFFSET_DILUENT; | |
972 else | |
973 gasOffset = 0; | |
974 for(int i=1;i<=5;i++) | |
975 { | |
976 if(stateUsed->diveSettings.gas[i+gasOffset].note.ub.active) | |
977 text[(i-1)*5] -= 1; | |
978 } | |
979 GFX_write_string(&FontT48,&t7surfaceL,text,6); | |
980 | |
981 | |
982 oxygen_percentage = 100; | |
983 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage; | |
984 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage; | |
985 | |
986 tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&text[0]); | |
987 GFX_write_string(&FontT48,&t7surfaceL,text,7); | |
988 | |
989 actualGasID = stateUsed->lifeData.actualGas.GasIdInSettings; | |
990 /* | |
991 bottleFirstGas_bar = stateUsed->lifeData.bottle_bar[actualGasID]; | |
992 if(bottleFirstGas_bar) | |
993 { | |
994 snprintf(text,255,"%3u\022\016\016 bar",bottleFirstGas_bar); | |
995 GFX_write_string(&FontT48,&t7surfaceL,text,8); | |
996 } | |
997 */ | |
998 // after gas name :-) | |
999 if(actualGasID > gasOffset) // security | |
1000 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1001 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1002 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1003 start.y = t7surfaceL.WindowY0 + (3 * t7surfaceL.WindowLineSpacing); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1004 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
|
1005 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1006 else |
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 start.y = t7surfaceR.WindowY0 + (3 * t7surfaceR.WindowLineSpacing); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1009 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
|
1010 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1011 |
38 | 1012 stop.x = start.x + 25; |
1013 stop.y = start.y + 52; | |
1014 GFX_draw_box2(&t7screen, start, stop, CLUT_Font020, 1); | |
1015 } | |
1016 } | |
1017 | |
1018 /* dive mode */ | |
193
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1019 switch (stateUsed->diveSettings.diveMode) { |
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1020 case DIVEMODE_CCR: |
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1021 GFX_write_string(&FontT24, &t7c1, "\f\002" "CCR", 0); |
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1022 break; |
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1023 case DIVEMODE_OC: |
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1024 GFX_write_string(&FontT24, &t7c1, "\f\002" "OC", 0); |
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1025 break; |
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1026 case DIVEMODE_Gauge: |
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1027 GFX_write_string(&FontT24, &t7c1, "\f\002" "Gauge", 0); |
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1028 break; |
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1029 case DIVEMODE_Apnea: |
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1030 GFX_write_string(&FontT24, &t7c1, "\f\002" "Apnea", 0); |
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1031 break; |
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1032 default: |
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1033 GFX_write_string(&FontT24, &t7c1, "\f\002" "OC", 0); |
255326edf00b
Bugfix: show proper dive mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1034 } |
38 | 1035 |
1036 /*battery */ | |
1037 | |
1038 text[0] = '3'; | |
1039 text[1] = '1'; | |
1040 text[2] = '1'; | |
1041 text[3] = '1'; | |
1042 text[4] = '1'; | |
1043 text[5] = '1'; | |
1044 text[6] = '1'; | |
1045 text[7] = '1'; | |
1046 text[8] = '1'; | |
1047 text[9] = '1'; | |
1048 text[10] = '1'; | |
1049 text[11] = '0'; | |
1050 text[12] = 0; | |
1051 | |
1052 for(int i=1;i<=10;i++) | |
1053 { | |
1054 if( stateUsed->lifeData.battery_charge > (9 * i)) | |
1055 text[i] += 1; | |
1056 } | |
1057 | |
1058 if(stateUsed->chargeStatus == CHARGER_off) | |
1059 { | |
1060 if(stateUsed->warnings.lowBattery) | |
1061 { | |
1062 if(warning_count_high_time) | |
1063 { | |
1064 for(int i=1;i<=10;i++) | |
1065 text[i] = '1'; | |
1066 } | |
1067 else | |
1068 { | |
1069 text[1] = '2'; | |
1070 } | |
1071 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_WarningRed); | |
1072 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) | |
1073 { | |
1074 snprintf(text,16,"\004\025\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); | |
1075 if(warning_count_high_time) | |
1076 text[0] = '\a'; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1077 GFX_write_string(&FontT24,&t7voltage,text,0); |
38 | 1078 } |
1079 else | |
1080 { | |
1081 snprintf(text,6,"\f%.1fV",stateUsed->lifeData.battery_voltage); | |
1082 GFX_write_string(&FontT24,&t7voltage,text,0); | |
1083 } | |
1084 } | |
1085 else | |
1086 { | |
1087 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_BatteryStandard); | |
1088 | |
1089 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) | |
1090 { | |
1091 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
|
1092 // GFX_write_string(&FontT24,&t7batt,text,0); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1093 GFX_write_string(&FontT24,&t7voltage,text,0); |
38 | 1094 } |
1095 else | |
1096 { | |
1097 snprintf(text,6,"\f%.1fV",stateUsed->lifeData.battery_voltage); | |
1098 GFX_write_string(&FontT24,&t7voltage,text,0); | |
1099 } | |
1100 } | |
1101 } | |
1102 else | |
1103 { | |
1104 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_BatteryCharging); | |
1105 | |
1106 switch(stateUsed->chargeStatus) | |
1107 { | |
1108 case CHARGER_running: | |
1109 default: | |
1110 color = CLUT_BatteryStandard; | |
1111 break; | |
1112 case CHARGER_complete: | |
1113 color = CLUT_BatteryCharging; | |
1114 break; | |
1115 case CHARGER_lostConnection: | |
1116 color = CLUT_BatteryProblem; | |
1117 break; | |
1118 } | |
1119 text[0] = '4'; | |
1120 text[1] = 0; | |
1121 GFX_write_string_color(&Batt24,&t7charge,text,0,color); | |
1122 } | |
1123 | |
1124 | |
1125 | |
1126 customview_warnings = t7_test_customview_warnings_surface_mode(); | |
1127 if(customview_warnings && warning_count_high_time) | |
1128 t7_show_customview_warnings_surface_mode(); | |
1129 else | |
1130 t7_refresh_customview(); | |
1131 draw_frame(0,0, CLUT_pluginboxSurface, CLUT_Font020); | |
1132 } | |
1133 | |
1134 | |
1135 void t7_refresh_surface_debugmode_wireless_info(void) | |
1136 { | |
1137 char text[400]; | |
1138 uint8_t colorDataLost = 0; | |
1139 int txtPointer = 0; | |
1140 uint8_t numberOfBytes = 0; | |
1141 | |
1142 GFX_DrawCfgWindow textWindow = | |
1143 { | |
1144 .Image = &t7screen, | |
1145 .WindowNumberOfTextLines = 5, | |
1146 .WindowLineSpacing = 70, | |
1147 .WindowTab = 220, | |
1148 .WindowX0 = 10, | |
1149 .WindowX1 = 790, | |
1150 .WindowY0 = 10, | |
1151 .WindowY1 = 380 | |
1152 }; | |
1153 | |
1154 Gfx_write_label_var(&t7screen, 10,600, 10,&FontT42,CLUT_DiveMainLabel,"Wireless Data"); | |
1155 | |
1156 if(stateUsed->data_old__lost_connection_to_slave) | |
1157 { | |
1158 Gfx_write_label_var(&t7screen, 600,800,10,&FontT42,CLUT_Font020,"CPU2?"); | |
1159 colorDataLost = 1; | |
1160 } | |
1161 | |
1162 txtPointer = 0; | |
1163 for(int i=0;i<4;i++) | |
1164 { | |
1165 if((!stateUsed->lifeData.wireless_data[i].ageInMilliSeconds) || colorDataLost) | |
1166 text[txtPointer++] = '\021'; | |
1167 | |
1168 numberOfBytes = stateUsed->lifeData.wireless_data[i].numberOfBytes; | |
1169 if((numberOfBytes > 0) && (numberOfBytes <= 10)) | |
1170 { | |
1171 txtPointer += snprintf(&text[txtPointer],20,"%02u s %02u\t" | |
1172 ,(stateUsed->lifeData.wireless_data[i].ageInMilliSeconds)/1000 | |
1173 ,stateUsed->lifeData.wireless_data[i].status | |
1174 ); | |
1175 if(numberOfBytes > 8) ///< lifeData.wireless_data[i].data[j] has only size of 8 | |
1176 numberOfBytes = 8; | |
1177 for(int j=0;j<numberOfBytes;j++) | |
1178 { | |
1179 txtPointer += snprintf(&text[txtPointer],4," %02X" | |
1180 ,stateUsed->lifeData.wireless_data[i].data[j] | |
1181 ); | |
1182 } | |
1183 } | |
1184 text[txtPointer++] = '\n'; | |
1185 text[txtPointer++] = '\r'; | |
1186 text[txtPointer++] = '\020'; | |
1187 text[txtPointer] = 0; | |
1188 } | |
1189 GFX_write_string(&FontT48,&textWindow,text,1); | |
1190 | |
1191 } | |
1192 | |
1193 | |
1194 void t7_refresh_surface_debugmode(void) | |
1195 { | |
1196 if(selection_customview%2 == 1) | |
1197 { | |
1198 t7_refresh_surface_debugmode_wireless_info(); | |
1199 return; | |
1200 } | |
1201 | |
1202 // could be warning, now just to set RTE variables | |
1203 DataEX_check_RTE_version__needs_update(); | |
1204 | |
1205 | |
1206 char TextL1[4*TEXTSIZE]; | |
1207 uint32_t color; | |
1208 // uint8_t gasIdFirst; | |
1209 SSettings* pSettings = settingsGetPointer(); | |
1210 extern SDataExchangeSlaveToMaster dataIn; | |
1211 | |
1212 SWindowGimpStyle windowGimp; | |
1213 | |
1214 RTC_DateTypeDef Sdate; | |
1215 RTC_TimeTypeDef Stime; | |
1216 | |
1217 translateDate(stateUsed->lifeData.dateBinaryFormat, &Sdate); | |
1218 translateTime(stateUsed->lifeData.timeBinaryFormat, &Stime); | |
1219 | |
1220 | |
1221 if(stateUsed->data_old__lost_connection_to_slave) | |
1222 { | |
1223 Gfx_write_label_var(&t7screen, 500,800, 0,&FontT42,CLUT_DiveMainLabel,"old"); | |
1224 snprintf(TextL1,TEXTSIZE,"%X %X %X %X",dataIn.header.checkCode[0],dataIn.header.checkCode[1],dataIn.header.checkCode[2],dataIn.header.checkCode[3]); | |
1225 Gfx_write_label_var(&t7screen, 500,800, 45,&FontT48,CLUT_Font020,TextL1); | |
1226 } | |
1227 else | |
1228 if(DataEX_lost_connection_count()) | |
1229 { | |
1230 snprintf(TextL1,TEXTSIZE,"\002%i",DataEX_lost_connection_count()); | |
1231 Gfx_write_label_var(&t7screen, 600,800, 45,&FontT48,CLUT_Font020,TextL1); | |
1232 } | |
1233 | |
1234 snprintf(TextL1,TEXTSIZE,"\002%i",blockedFramesCount()); | |
1235 Gfx_write_label_var(&t7screen, 600,800, 0,&FontT48,CLUT_Font020,TextL1); | |
1236 | |
1237 if(stateUsed->lifeData.compass_DX_f | stateUsed->lifeData.compass_DY_f | stateUsed->lifeData.compass_DZ_f) | |
1238 { | |
1239 snprintf(TextL1,TEXTSIZE,"X %i",stateUsed->lifeData.compass_DX_f); | |
1240 Gfx_write_label_var(&t7screen, 0,400, 45,&FontT48,CLUT_Font020,TextL1); | |
1241 snprintf(TextL1,TEXTSIZE,"Y %i",stateUsed->lifeData.compass_DY_f); | |
1242 Gfx_write_label_var(&t7screen, 0,400,145,&FontT48,CLUT_Font020,TextL1); | |
1243 snprintf(TextL1,TEXTSIZE,"Z %i",stateUsed->lifeData.compass_DZ_f); | |
1244 Gfx_write_label_var(&t7screen, 0,400,255,&FontT48,CLUT_Font020,TextL1); | |
1245 return; | |
1246 } | |
103
f5d2f02dc73f
Generalize TEXT of pressure unit
Dmitry Romanov <kitt@bk.ru>
parents:
102
diff
changeset
|
1247 snprintf(TextL1,TEXTSIZE,"%01.0f %s",stateUsed->lifeData.pressure_ambient_bar * 1000.0f,TEXT_PRESSURE_UNIT); |
38 | 1248 Gfx_write_label_var(&t7screen, 0,400, 0,&FontT42,CLUT_DiveMainLabel,"Ambient Pressure"); |
1249 Gfx_write_label_var(&t7screen, 0,400, 45,&FontT48,CLUT_Font020,TextL1); | |
1250 | |
1251 snprintf(TextL1,TEXTSIZE,"%01.2f C",stateUsed->lifeData.temperature_celsius); | |
1252 Gfx_write_label_var(&t7screen, 0,400,100,&FontT42,CLUT_DiveMainLabel,"Temperature"); | |
1253 Gfx_write_label_var(&t7screen, 0,400,145,&FontT48,CLUT_Font020,TextL1); | |
1254 | |
1255 snprintf(TextL1,TEXTSIZE,"%03.0f %03.0f %03.0f",stateUsed->lifeData.compass_heading,stateUsed->lifeData.compass_roll,stateUsed->lifeData.compass_pitch); | |
1256 Gfx_write_label_var(&t7screen, 0,400,200,&FontT42,CLUT_DiveMainLabel,"Heading Roll Pitch"); | |
1257 Gfx_write_label_var(&t7screen, 0,400,255,&FontT48,CLUT_Font020,TextL1); | |
1258 | |
103
f5d2f02dc73f
Generalize TEXT of pressure unit
Dmitry Romanov <kitt@bk.ru>
parents:
102
diff
changeset
|
1259 snprintf(TextL1,TEXTSIZE,"%01.0f %s",stateUsed->lifeData.pressure_surface_bar * 1000.0f,TEXT_PRESSURE_UNIT); |
38 | 1260 Gfx_write_label_var(&t7screen, 0,400,310,&FontT42,CLUT_DiveMainLabel,"Surface Pressure"); |
1261 Gfx_write_label_var(&t7screen, 0,400,355,&FontT48,CLUT_Font020,TextL1); | |
1262 | |
1263 // gasIdFirst = stateUsed->lifeData.actualGas.GasIdInSettings; | |
1264 snprintf(TextL1,TEXTSIZE,"%u.%u",dataIn.RTE_VERSION_high,dataIn.RTE_VERSION_low); | |
1265 Gfx_write_label_var(&t7screen, 320,500,100,&FontT42,CLUT_DiveMainLabel,"RTE"); | |
1266 Gfx_write_label_var(&t7screen, 320,500,145,&FontT48,CLUT_Font020,TextL1); | |
1267 | |
1268 Gfx_write_label_var(&t7screen, 500,800,100,&FontT42,CLUT_DiveMainLabel,"Battery"); | |
1269 snprintf(TextL1,TEXTSIZE,"%01.4f V",stateUsed->lifeData.battery_voltage); | |
1270 Gfx_write_label_var(&t7screen, 500,800,145,&FontT48,CLUT_Font020,TextL1); | |
1271 snprintf(TextL1,TEXTSIZE,"%03.1f %%",stateUsed->lifeData.battery_charge); | |
1272 Gfx_write_label_var(&t7screen, 500,800,200,&FontT48,CLUT_Font020,TextL1); | |
1273 if(stateUsed->chargeStatus != CHARGER_off) | |
1274 { | |
1275 switch(stateUsed->chargeStatus) | |
1276 { | |
1277 case CHARGER_running: | |
1278 default: | |
1279 color = CLUT_BatteryStandard; | |
1280 break; | |
1281 case CHARGER_complete: | |
1282 color = CLUT_BatteryCharging; | |
1283 break; | |
1284 case CHARGER_lostConnection: | |
1285 color = CLUT_BatteryProblem; | |
1286 break; | |
1287 } | |
1288 TextL1[0] = '4'; | |
1289 TextL1[1] = 0; | |
1290 Gfx_write_label_var(&t7screen, 660,800,200,&Batt24,color,TextL1); | |
1291 } | |
1292 | |
1293 extern uint32_t base_tempLightLevel; | |
1294 | |
1295 snprintf(TextL1,TEXTSIZE,"# %u (%u)",stateUsed->lifeData.ambient_light_level, base_tempLightLevel); | |
1296 Gfx_write_label_var(&t7screen, 401,600,310,&FontT42,CLUT_DiveMainLabel,"Light"); | |
1297 Gfx_write_label_var(&t7screen, 401,800,355,&FontT48,CLUT_Font020,TextL1); | |
1298 | |
1299 // snprintf(TextL1,TEXTSIZE,"# %u",stateUsed->lifeData.ambient_light_level); | |
1300 // Gfx_write_label_var(&t7screen, 601,800,310,&FontT42,CLUT_DiveMainLabel,"Light"); | |
1301 // Gfx_write_label_var(&t7screen, 601,800,355,&FontT48,CLUT_Font020,TextL1); | |
1302 | |
1303 | |
1304 | |
1305 if(Sdate.Year < 15) | |
1306 { | |
1307 if(warning_count_high_time) | |
1308 { | |
1309 snprintf(TextL1,4*TEXTSIZE,"\017 %02d-%02d-%02d %02d:%02d:%02d", Sdate.Date, Sdate.Month, 2000 + Sdate.Year,Stime.Hours, Stime.Minutes, Stime.Seconds); | |
1310 Gfx_write_label_var(&t7screen, 0,800,420,&FontT48,CLUT_Font020,TextL1); | |
1311 } | |
1312 } | |
1313 else | |
1314 { | |
1315 if(pSettings->customtext[0]) | |
1316 { | |
1317 if(pSettings->customtext[59]) | |
1318 pSettings->customtext[59] = 0; | |
1319 Gfx_write_label_var(&t7screen, 0,400,420,&FontT24,CLUT_Font020,pSettings->customtext); | |
1320 } | |
1321 else | |
1322 { | |
1323 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 ); | |
1324 Gfx_write_label_var(&t7screen, 0,800,420,&FontT48,CLUT_Font020,TextL1); | |
1325 } | |
1326 } | |
1327 | |
1328 windowGimp.left = 400; | |
1329 windowGimp.top = 0; | |
1330 GFX_draw_image_monochrome(&t7screen, windowGimp, &ImgOSTC, 0); | |
1331 } | |
1332 | |
1333 /* CUSTOMVIEW | |
1334 * in the middle of the screen | |
1335 */ | |
1336 | |
1337 uint8_t t7_test_customview_warnings(void) | |
1338 { | |
1339 uint8_t count = 0; | |
1340 | |
1341 count = 0; | |
1342 count += stateUsed->warnings.decoMissed; | |
1343 count += stateUsed->warnings.ppO2Low; | |
1344 count += stateUsed->warnings.ppO2High; | |
1345 //count += stateUsed->warnings.lowBattery; | |
1346 count += stateUsed->warnings.sensorLinkLost; | |
1347 count += stateUsed->warnings.fallback; | |
1348 return count; | |
1349 } | |
1350 | |
1351 | |
1352 uint8_t t7_test_customview_warnings_surface_mode(void) | |
1353 { | |
1354 uint8_t count = 0; | |
1355 count = 0; | |
1356 count += stateUsed->cnsHigh_at_the_end_of_dive; | |
1357 count += stateUsed->decoMissed_at_the_end_of_dive; | |
1358 return count; | |
1359 } | |
1360 | |
1361 | |
1362 void t7_show_customview_warnings_surface_mode(void) | |
1363 { | |
1364 char text[256]; | |
1365 uint8_t textpointer, lineFree; | |
1366 | |
1367 text[0] = '\025'; | |
1368 text[1] = '\f'; | |
1369 text[2] = '\001'; | |
1370 text[3] = TXT_Warning; | |
1371 text[4] = 0; | |
1372 GFX_write_string(&FontT42,&t7cH,text,0); | |
1373 | |
1374 textpointer = 0; | |
1375 lineFree = 5; | |
1376 | |
1377 if(stateUsed->decoMissed_at_the_end_of_dive) | |
1378 { | |
1379 text[textpointer++] = TXT_2BYTE; | |
1380 text[textpointer++] = TXT2BYTE_WarnDecoMissed; | |
1381 text[textpointer++] = '\n'; | |
1382 text[textpointer++] = '\r'; | |
1383 text[textpointer] = 0; | |
1384 lineFree--; | |
1385 } | |
1386 | |
1387 if(stateUsed->cnsHigh_at_the_end_of_dive) | |
1388 { | |
1389 text[textpointer++] = TXT_2BYTE; | |
1390 text[textpointer++] = TXT2BYTE_WarnCnsHigh; | |
1391 text[textpointer++] = '\n'; | |
1392 text[textpointer++] = '\r'; | |
1393 text[textpointer] = 0; | |
1394 lineFree--; | |
1395 } | |
1396 if(textpointer != 0) | |
1397 GFX_write_string(&FontT48,&t7cW,text,1); | |
1398 } | |
1399 | |
1400 | |
1401 void t7_show_customview_warnings(void) | |
1402 { | |
1403 char text[256]; | |
1404 uint8_t textpointer, lineFree; | |
1405 | |
1406 text[0] = '\025'; | |
1407 text[1] = '\f'; | |
1408 text[2] = '\001'; | |
1409 text[3] = TXT_Warning; | |
1410 text[4] = 0; | |
1411 GFX_write_string(&FontT42,&t7cH,text,0); | |
1412 | |
1413 textpointer = 0; | |
1414 lineFree = 5; | |
1415 | |
1416 if(lineFree && stateUsed->warnings.decoMissed) | |
1417 { | |
1418 text[textpointer++] = TXT_2BYTE; | |
1419 text[textpointer++] = TXT2BYTE_WarnDecoMissed; | |
1420 text[textpointer++] = '\n'; | |
1421 text[textpointer++] = '\r'; | |
1422 text[textpointer] = 0; | |
1423 lineFree--; | |
1424 } | |
1425 | |
1426 if(lineFree && stateUsed->warnings.fallback) | |
1427 { | |
1428 text[textpointer++] = TXT_2BYTE; | |
1429 text[textpointer++] = TXT2BYTE_WarnFallback; | |
1430 text[textpointer++] = '\n'; | |
1431 text[textpointer++] = '\r'; | |
1432 text[textpointer] = 0; | |
1433 lineFree--; | |
1434 } | |
1435 | |
1436 if(lineFree && stateUsed->warnings.ppO2Low) | |
1437 { | |
1438 text[textpointer++] = TXT_2BYTE; | |
1439 text[textpointer++] = TXT2BYTE_WarnPPO2Low; | |
1440 text[textpointer++] = '\n'; | |
1441 text[textpointer++] = '\r'; | |
1442 text[textpointer] = 0; | |
1443 lineFree--; | |
1444 } | |
1445 | |
1446 if(lineFree && stateUsed->warnings.ppO2High) | |
1447 { | |
1448 text[textpointer++] = TXT_2BYTE; | |
1449 text[textpointer++] = TXT2BYTE_WarnPPO2High; | |
1450 text[textpointer++] = '\n'; | |
1451 text[textpointer++] = '\r'; | |
1452 text[textpointer] = 0; | |
1453 lineFree--; | |
1454 } | |
1455 | |
1456 if(lineFree && stateUsed->warnings.sensorLinkLost) | |
1457 { | |
1458 text[textpointer++] = TXT_2BYTE; | |
1459 text[textpointer++] = TXT2BYTE_WarnSensorLinkLost; | |
1460 text[textpointer++] = '\n'; | |
1461 text[textpointer++] = '\r'; | |
1462 text[textpointer] = 0; | |
1463 lineFree--; | |
1464 } | |
1465 /* | |
1466 if(lineFree && stateUsed->warnings.lowBattery) | |
1467 { | |
1468 text[textpointer++] = TXT_2BYTE; | |
1469 text[textpointer++] = TXT2BYTE_WarnBatteryLow; | |
1470 text[textpointer++] = '\n'; | |
1471 text[textpointer++] = '\r'; | |
1472 text[textpointer] = 0; | |
1473 lineFree--; | |
1474 } | |
1475 */ | |
1476 GFX_write_string(&FontT48,&t7cW,text,1); | |
1477 } | |
1478 | |
1479 | |
1480 void t7_set_customview_to_primary(void) | |
1481 { | |
1482 if(stateUsed->mode == MODE_DIVE) | |
1483 selection_customview = settingsGetPointer()->tX_customViewPrimary; | |
1484 } | |
1485 | |
1486 | |
1487 // for CVIEW_END is none_or_debug | |
1488 void t7_change_customview(void) | |
1489 { | |
1490 const uint8_t *pViews; | |
1491 _Bool cv_disabled = 0; | |
1492 | |
1493 if(stateUsed->mode == MODE_DIVE) | |
1494 pViews = customviewsDive; | |
1495 else | |
1496 pViews = customviewsSurface; | |
1497 | |
1498 while((*pViews != CVIEW_END) && (*pViews != selection_customview)) | |
1499 {pViews++;} | |
1500 | |
1501 if(*pViews < CVIEW_END) | |
1502 pViews++; | |
1503 | |
1504 | |
1505 if(*pViews == CVIEW_END) | |
1506 { | |
1507 if(stateUsed->mode == MODE_DIVE) | |
1508 pViews = customviewsDive; | |
1509 else | |
1510 pViews = customviewsSurface; | |
1511 } | |
1512 | |
1513 if(stateUsed->mode == MODE_DIVE) | |
1514 { | |
1515 do | |
1516 { | |
1517 cv_disabled = 0; | |
1518 for(int i=0;i<6;i++) | |
1519 { | |
1520 if((*pViews == cv_changelist[i]) && !CHECK_BIT_THOME(cv_configuration, cv_changelist[i])) | |
1521 { | |
1522 cv_disabled = 1; | |
1523 break; | |
1524 } | |
1525 } | |
1526 if(cv_disabled) | |
1527 { | |
1528 if(*pViews < CVIEW_END) | |
1529 { | |
1530 pViews++; | |
1531 } | |
1532 else | |
1533 { | |
1534 pViews = customviewsDive; | |
1535 } | |
1536 } | |
1537 } while(cv_disabled); | |
1538 } | |
1539 selection_customview = *pViews; | |
1540 } | |
1541 | |
1542 | |
1543 uint8_t t7_get_length_of_customtext(void) | |
1544 { | |
1545 uint8_t i = 0; | |
1546 settingsGetPointer()->customtext[60-1] = 0; | |
1547 while(settingsGetPointer()->customtext[i] > 0) | |
1548 i++; | |
1549 return i; | |
1550 } | |
1551 | |
1552 | |
1553 void t7_refresh_customview(void) | |
1554 { | |
1555 | |
1556 char text[256]; | |
1557 uint16_t textpointer = 0; | |
1558 int16_t start; | |
51
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
1559 uint8_t lineCountCustomtext = 0; |
38 | 1560 int16_t shiftWindowY0; |
1561 RTC_DateTypeDef Sdate; | |
1562 RTC_TimeTypeDef Stime; | |
1563 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth; // CVIEW_Gaslist | |
1564 const SGasLine * pGasLine; // CVIEW_Gaslist | |
1565 uint8_t oxygen, helium; // CVIEW_Gaslist | |
1566 float depth, surface, fraction_nitrogen, fraction_helium, ead, end; // CVIEW_EADTime | |
1567 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1568 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1569 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1570 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1571 if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1572 t7_change_customview(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1573 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
|
1574 t7_change_customview(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1575 if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1576 t7_change_customview(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1577 |
38 | 1578 switch(selection_customview) |
1579 { | |
1580 case CVIEW_noneOrDebug: | |
1581 if(settingsGetPointer()->showDebugInfo) | |
1582 { | |
1583 // header | |
1584 strcpy(text,"\032\f\001Debug"); | |
1585 GFX_write_string(&FontT42,&t7cH,text,0); | |
1586 // content | |
1587 t7_debug(); | |
1588 } | |
1589 break; | |
1590 | |
1591 case CVIEW_SummaryOfLeftCorner: | |
1592 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Summary); | |
1593 GFX_write_string(&FontT42,&t7cH,text,0); | |
1594 // content | |
1595 t7_SummaryOfLeftCorner(); | |
1596 break; | |
1597 | |
1598 case CVIEW_CompassDebug: | |
1599 snprintf(text,100,"\032\f\001Compass raw"); | |
1600 GFX_write_string(&FontT42,&t7cH,text,0); | |
1601 /* | |
1602 pStateReal->lifeData.compass_heading = dataIn.data[dataIn.boolCompassData].compass_heading; | |
1603 pStateReal->lifeData.compass_roll = dataIn.data[dataIn.boolCompassData].compass_roll; | |
1604 pStateReal->lifeData.compass_pitch = dataIn.data[dataIn.boolCompassData].compass_pitch; | |
1605 | |
1606 pStateReal->lifeData.compass_DX_f = dataIn.data[dataIn.boolCompassData].compass_DX_f; | |
1607 pStateReal->lifeData.compass_DY_f = dataIn.data[dataIn.boolCompassData].compass_DY_f; | |
1608 pStateReal->lifeData.compass_DZ_f = dataIn.data[dataIn.boolCompassData].compass_DZ_f; | |
1609 */ | |
1610 snprintf(text,255,"%1.1f\n\r%1.1f\n\r%1.1f\n\r%i\n\r%i\n\r%i" | |
1611 ,stateUsed->lifeData.compass_heading | |
1612 ,stateUsed->lifeData.compass_roll | |
1613 ,stateUsed->lifeData.compass_pitch | |
1614 ,stateUsed->lifeData.compass_DX_f | |
1615 ,stateUsed->lifeData.compass_DY_f | |
1616 ,stateUsed->lifeData.compass_DZ_f | |
1617 ); | |
1618 | |
1619 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; | |
1620 t7cY0free.WindowLineSpacing = 48; | |
1621 t7cY0free.WindowNumberOfTextLines = 6; | |
1622 GFX_write_string(&FontT42, &t7cY0free, text, 1); | |
1623 break; | |
1624 | |
1625 case CVIEW_Hello: | |
1626 t7_logo_OSTC(); | |
1627 t7cC.WindowLineSpacing = 53; | |
1628 t7cC.WindowNumberOfTextLines = 5; | |
1629 shiftWindowY0 = 18; | |
1630 | |
1631 if(updateNecessary)//if(DataEX_check_RTE_version__needs_update() || font_update_required()) | |
1632 { | |
1633 if(warning_count_high_time) | |
1634 { | |
1635 shiftWindowY0 += 20; | |
1636 t7cC.WindowY0 -= shiftWindowY0; | |
1637 textpointer = 0; | |
1638 text[textpointer++] = TXT_2BYTE; | |
1639 text[textpointer++] = TXT2BYTE_PleaseUpdate; | |
1640 text[textpointer++] = '\n'; | |
1641 text[textpointer++] = '\r'; | |
1642 if(DataEX_check_RTE_version__needs_update()) | |
1643 { | |
1644 text[textpointer++] = TXT_2BYTE; | |
1645 text[textpointer++] = TXT2BYTE_RTE; | |
1646 text[textpointer++] = '\n'; | |
1647 text[textpointer++] = '\r'; | |
1648 } | |
1649 if(font_update_required()) | |
1650 { | |
1651 text[textpointer++] = TXT_2BYTE; | |
1652 text[textpointer++] = TXT2BYTE_Fonts; | |
1653 } | |
1654 text[textpointer++] = 0; | |
1655 GFX_write_string_color(&FontT42,&t7cC,text,1, CLUT_WarningRed); | |
1656 t7cC.WindowY0 += shiftWindowY0; | |
1657 } | |
1658 t7cC.WindowNumberOfTextLines = 3; | |
1659 } | |
1660 else // customtext | |
1661 { | |
1662 lineCountCustomtext = t7_customtextPrepare(text); | |
1663 if(lineCountCustomtext <= 2) | |
1664 shiftWindowY0 += 20+26; // nach unten | |
1665 else | |
1666 if(lineCountCustomtext <= 3) | |
1667 shiftWindowY0 += 20; // nach unten | |
1668 t7cC.WindowY0 -= shiftWindowY0; | |
1669 | |
1670 GFX_write_string(&FontT42,&t7cC,text,1); | |
1671 t7cC.WindowNumberOfTextLines = 3; | |
1672 t7cC.WindowY0 += shiftWindowY0; | |
1673 } | |
1674 if(lineCountCustomtext <= 4) | |
1675 { | |
1676 snprintf(text,100,"\001#%0u V%01u.%01u.%01u", | |
1677 settingsGetPointer()->serialLow + (256 * settingsGetPointer()->serialHigh), | |
1678 firmwareDataGetPointer()->versionFirst, | |
1679 firmwareDataGetPointer()->versionSecond, | |
1680 firmwareDataGetPointer()->versionThird | |
1681 ); | |
1682 GFX_write_string(&FontT24,&t7cC,text,0); | |
1683 } | |
1684 break; | |
1685 | |
1686 case CVIEW_Gaslist: | |
1687 // a lot of code taken from tMenuGas.c | |
1688 // header | |
1689 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Gaslist); | |
1690 GFX_write_string(&FontT42,&t7cH,text,0); | |
1691 // content | |
1692 textpointer = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1693 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1694 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1695 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1696 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1697 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1698 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1699 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1700 t7cY0free.WindowY1 = 400; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1701 } |
38 | 1702 t7cY0free.WindowLineSpacing = 48+9; |
1703 t7cY0free.WindowNumberOfTextLines = 5; // NUM_GASES == 5 | |
1704 t7cY0free.WindowTab = 420; | |
1705 | |
1706 pGasLine = settingsGetPointer()->gas; | |
1707 if(actualLeftMaxDepth(stateUsed)) | |
1708 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_deco) / 100; | |
1709 else | |
1710 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100; | |
1711 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100; | |
1712 for(int gasId=1;gasId<=NUM_GASES;gasId++) | |
1713 { | |
1714 textpointer = 0; | |
1715 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100; | |
1716 if(pGasLine[gasId].note.ub.active == 0) | |
1717 strcpy(&text[textpointer++],"\021"); | |
1718 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow)) | |
1719 strcpy(&text[textpointer++],"\025"); | |
1720 else | |
1721 strcpy(&text[textpointer++],"\030"); | |
1722 | |
1723 text[textpointer++] = ' '; | |
1724 oxygen = pGasLine[gasId].oxygen_percentage; | |
1725 helium = pGasLine[gasId].helium_percentage; | |
1726 textpointer += write_gas(&text[textpointer], oxygen, helium); | |
1727 // Wechseltiefe | |
1728 if(pGasLine[gasId].depth_meter) | |
1729 { | |
1730 textpointer += snprintf(&text[textpointer],7,"\t%u %c%c",unit_depth_integer(pGasLine[gasId].depth_meter), unit_depth_char1(), unit_depth_char2()); | |
1731 } | |
1732 GFX_write_string(&FontT42, &t7cY0free, text, gasId); | |
1733 } | |
1734 break; | |
1735 | |
1736 case CVIEW_EADTime: | |
1737 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Info ); | |
1738 GFX_write_string(&FontT42,&t7cH,text,0); | |
1739 textpointer = 0; | |
1740 | |
1741 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1742 if(pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1743 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1744 t7cY0free.WindowY1 = 400; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1745 } |
38 | 1746 t7cY0free.WindowLineSpacing = 48; |
1747 t7cY0free.WindowNumberOfTextLines = 6; | |
1748 | |
1749 // time | |
1750 snprintf(text,100,"\032\001%c%c",TXT_2BYTE,TXT2BYTE_Clock ); | |
1751 GFX_write_string(&FontT42, &t7cY0free, text, 1); | |
1752 | |
1753 translateDate(stateRealGetPointer()->lifeData.dateBinaryFormat, &Sdate); | |
1754 translateTime(stateRealGetPointer()->lifeData.timeBinaryFormat, &Stime); | |
1755 if(Stime.Seconds % 2) | |
1756 textpointer += snprintf(&text[textpointer],100,"\030\001%02d:%02d",Stime.Hours,Stime.Minutes); | |
1757 else | |
1758 textpointer += snprintf(&text[textpointer],100,"\030\001%02d\031:\030%02d",Stime.Hours,Stime.Minutes); | |
1759 GFX_write_string(&FontT42, &t7cY0free, text, 2); | |
1760 | |
1761 // EAD / END | |
1762 // The equivalent air depth can be calculated for depths in metres as follows: | |
1763 // EAD = (Depth + 10) � Fraction of N2 / 0.79 - 10 (wikipedia) | |
1764 // The equivalent narcotic depth can be calculated for depths in metres as follows: | |
1765 // END = (Depth + 10) � (1 - Fraction of helium) - 10 (wikipedia) | |
1766 decom_get_inert_gases((float)stateUsed->lifeData.pressure_ambient_bar,&(stateUsed->lifeData.actualGas),&fraction_nitrogen,&fraction_helium); | |
1767 depth = stateUsed->lifeData.pressure_ambient_bar; | |
1768 surface = stateUsed->lifeData.pressure_surface_bar; | |
1769 ead = 10.f * ((depth * fraction_nitrogen/0.79f) - surface); | |
1770 end = 10.0f * ((depth * (1.f - fraction_helium)) - surface); | |
1771 if(ead < 0) | |
1772 ead = 0; | |
1773 if(end < 0) | |
1774 end = 0; | |
1775 | |
1776 snprintf(text,100,"\032\001EAD"); | |
1777 GFX_write_string(&FontT42, &t7cY0free, text, 3); | |
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, 4); | |
1784 | |
1785 snprintf(text,100,"\032\001END"); | |
1786 GFX_write_string(&FontT42, &t7cY0free, text, 5); | |
1787 snprintf(text,100,"\030\001%01.1f %c%c" | |
1788 , unit_depth_float(ead) | |
1789 , unit_depth_char1() | |
1790 , unit_depth_char2() | |
1791 ); | |
1792 GFX_write_string(&FontT42, &t7cY0free, text, 6); | |
1793 break; | |
1794 | |
1795 case CVIEW_Profile: | |
1796 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Profile); | |
1797 GFX_write_string(&FontT42,&t7cH,text,0); | |
1798 textpointer = 0; | |
1799 t7_miniLiveLogProfile(); | |
1800 break; | |
1801 | |
1802 case CVIEW_Tissues: | |
1803 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Tissues); | |
1804 GFX_write_string(&FontT42,&t7cH,text,0); | |
1805 textpointer = 0; | |
1806 t7_tissues(stateUsed); | |
1807 break; | |
1808 | |
1809 case CVIEW_sensors: | |
1810 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_O2monitor); | |
1811 GFX_write_string(&FontT42,&t7cH,text,0); | |
1812 textpointer = 0; | |
1813 text[textpointer++] = '\030'; // main color | |
1814 for(int i=0;i<3;i++) | |
1815 { | |
1816 if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) | |
1817 { | |
1818 text[textpointer++] = '\031'; // labelcolor | |
1819 text[textpointer++] = '\001'; | |
1820 text[textpointer++] = '-'; | |
1821 text[textpointer++] = '\n'; | |
1822 text[textpointer++] = '\r'; | |
1823 text[textpointer++] = '\030'; // main color | |
1824 text[textpointer] = 0; | |
1825 } | |
1826 else | |
1827 { | |
1828 if(stateUsed->warnings.sensorOutOfBounds[i]) | |
1829 text[textpointer++] = '\025'; // Warning Red | |
1830 textpointer += snprintf(&text[textpointer],100,"\001%01.2f\n\r\030",stateUsed->lifeData.ppO2Sensor_bar[i]); | |
1831 } | |
1832 } | |
1833 t7cC.WindowLineSpacing = 95; | |
1834 t7cC.WindowNumberOfTextLines = 3; | |
1835 text[textpointer] = 0; | |
1836 GFX_write_string(&FontT105,&t7cC,text,1); | |
1837 break; | |
1838 | |
1839 case CVIEW_sensors_mV: | |
1840 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_O2voltage); | |
1841 GFX_write_string(&FontT42,&t7cH,text,0); | |
1842 textpointer = 0; | |
1843 text[textpointer++] = '\030'; | |
1844 for(int i=0;i<3;i++) | |
1845 { | |
1846 if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) | |
1847 { | |
1848 text[textpointer++] = '\031'; | |
1849 text[textpointer++] = '\001'; | |
1850 text[textpointer++] = '-'; | |
1851 text[textpointer++] = '\n'; | |
1852 text[textpointer++] = '\r'; | |
1853 text[textpointer++] = '\030'; | |
1854 text[textpointer] = 0; | |
1855 } | |
1856 else | |
1857 { | |
1858 if(stateUsed->warnings.sensorOutOfBounds[i]) | |
1859 text[textpointer++] = '\025'; | |
1860 textpointer += snprintf(&text[textpointer],100,"\001%01.1f mV\n\r\030",(stateUsed->lifeData.sensorVoltage_mV[i])); | |
1861 } | |
1862 } | |
1863 t7cC.WindowLineSpacing = 95; | |
1864 t7cC.WindowNumberOfTextLines = 3; | |
1865 text[textpointer] = 0; | |
1866 GFX_write_string(&FontT48,&t7cC,text,1); | |
1867 break; | |
1868 | |
1869 case CVIEW_Compass: | |
1870 default: | |
1871 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE, TXT2BYTE_Compass); | |
1872 GFX_write_string(&FontT42,&t7cH,text,0); | |
1873 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
|
1874 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1875 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1876 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1877 t7cY0free.WindowX0 += 15; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1878 t7cY0free.WindowY0 = 230; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1879 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1880 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1881 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1882 t7cY0free.WindowX0 -= 15; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1883 t7cY0free.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1884 t7cY0free.WindowY1 = 250; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1885 } |
38 | 1886 snprintf(text,100,"\030\001%03i`",(uint16_t)stateUsed->lifeData.compass_heading); |
1887 GFX_write_string(&FontT54,&t7cY0free,text,0); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1888 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1889 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1890 t7cY0free.WindowX0 -= 15; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1891 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1892 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1893 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1894 t7cY0free.WindowX0 += 15; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1895 } |
38 | 1896 break; |
1897 | |
1898 case CVIEW_Decolist: | |
1899 snprintf(text,100,"\032\f\001 %c%c", TXT_2BYTE, TXT2BYTE_Decolist); | |
1900 GFX_write_string(&FontT42,&t7cH,text,0); | |
1901 | |
1902 const SDecoinfo * pDecoinfo; | |
1903 uint8_t depthNext, depthLast, depthSecond, depthInc; | |
1904 | |
1905 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
1906 pDecoinfo = &stateUsed->decolistBuehlmann; | |
1907 else | |
1908 pDecoinfo = &stateUsed->decolistVPM; | |
1909 | |
1910 depthLast = (uint8_t)(stateUsed->diveSettings.last_stop_depth_bar * 10); | |
1911 depthSecond = (uint8_t)(stateUsed->diveSettings.input_second_to_last_stop_depth_bar * 10); | |
1912 depthInc = (uint8_t)(stateUsed->diveSettings.input_next_stop_increment_depth_bar * 10); | |
1913 | |
1914 if(settingsGetPointer()->nonMetricalSystem) | |
1915 { | |
1916 depthLast = (uint8_t)unit_depth_integer(depthLast); | |
1917 depthSecond = (uint8_t)unit_depth_integer(depthSecond); | |
1918 depthInc = (uint8_t)unit_depth_integer(depthInc); | |
1919 } | |
1920 | |
1921 for(start=DECOINFO_STRUCT_MAX_STOPS-1; start>0; start--) | |
1922 if(pDecoinfo->output_stop_length_seconds[start]) break; | |
1923 start -= 6; | |
1924 if(start < 0) start = 0; | |
1925 | |
1926 textpointer = 0; | |
1927 for(int i=start;i<6+start;i++) | |
1928 { | |
1929 if(i == 0) | |
1930 depthNext = depthLast; | |
1931 else | |
1932 depthNext = depthSecond + (( i - 1 )* depthInc); | |
1933 | |
1934 if(pDecoinfo->output_stop_length_seconds[i]) | |
1935 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); | |
1936 else | |
1937 textpointer += snprintf(&text[textpointer],20,"\031\034 %2u\016\016%c%c\017\n\r",depthNext, unit_depth_char1(), unit_depth_char2()); | |
1938 if(textpointer > 200) break; | |
1939 } | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1940 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1941 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1942 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1943 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1944 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1945 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1946 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1947 t7cY0free.WindowY1 = 400; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1948 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1949 |
38 | 1950 t7cY0free.WindowLineSpacing = 48; |
1951 t7cY0free.WindowNumberOfTextLines = 6; | |
1952 GFX_write_string(&FontT42, &t7cY0free, text, 1); | |
1953 break; | |
1954 } | |
1955 } | |
1956 | |
1957 | |
1958 | |
1959 /* DIVE MODE | |
1960 */ | |
1961 void t7_refresh_divemode(void) | |
1962 { | |
1963 char TextL1[TEXTSIZE]; | |
1964 char TextL2[TEXTSIZE]; | |
1965 | |
1966 char TextR1[TEXTSIZE]; | |
1967 char TextR2[TEXTSIZE]; | |
1968 char TextR3[TEXTSIZE]; | |
1969 | |
1970 char TextC1[2*TEXTSIZE]; | |
1971 char TextC2[TEXTSIZE]; | |
1972 uint8_t textPointer; | |
1973 | |
1974 point_t start, stop; | |
1975 uint8_t color; | |
1976 int textlength; | |
1977 | |
1978 uint16_t nextstopLengthSeconds = 0; | |
1979 uint8_t nextstopDepthMeter = 0; | |
1980 uint8_t oxygen_percentage = 0; | |
1981 SDivetime Divetime = {0,0,0, 0}; | |
1982 SDivetime SafetyStopTime = {0,0,0,0}; | |
1983 SDivetime TimeoutTime = {0,0,0,0}; | |
1984 uint8_t customview_warnings = 0; | |
1985 const SDecoinfo * pDecoinfo; | |
1986 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1987 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1988 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1989 |
38 | 1990 Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; |
1991 Divetime.Minutes = Divetime.Total / 60; | |
1992 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); | |
1993 | |
1994 SafetyStopTime.Total = timer_Safetystop_GetCountDown(); | |
1995 SafetyStopTime.Minutes = SafetyStopTime.Total / 60; | |
1996 SafetyStopTime.Seconds = SafetyStopTime.Total - (SafetyStopTime.Minutes * 60); | |
1997 | |
1998 TimeoutTime.Total = settingsGetPointer()->timeoutDiveReachedZeroDepth - stateUsed->lifeData.counterSecondsShallowDepth; | |
1999 if(TimeoutTime.Total > settingsGetPointer()->timeoutDiveReachedZeroDepth) | |
2000 { | |
2001 TimeoutTime.Total = 0; | |
2002 } | |
2003 TimeoutTime.Minutes = TimeoutTime.Total / 60; | |
2004 TimeoutTime.Seconds = TimeoutTime.Total - (TimeoutTime.Minutes * 60); | |
2005 | |
2006 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
2007 pDecoinfo = &stateUsed->decolistBuehlmann; | |
2008 else | |
2009 pDecoinfo = &stateUsed->decolistVPM; | |
2010 | |
2011 if(pDecoinfo->output_time_to_surface_seconds) | |
2012 { | |
2013 tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
2014 } | |
2015 else | |
2016 { | |
2017 nextstopDepthMeter = 0; | |
2018 nextstopLengthSeconds = 0; | |
2019 } | |
2020 | |
2021 /* depth */ | |
174
ecb71521d004
Bugfix: make max depth move with current depth (part 2)
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
2022 float depth = unit_depth_float(stateUsed->lifeData.depth_meter); |
38 | 2023 |
2024 if(depth <= 0.3f) | |
2025 depth = 0; | |
2026 | |
2027 if(settingsGetPointer()->nonMetricalSystem) | |
2028 snprintf(TextL1,TEXTSIZE,"\032\f[feet]"); | |
2029 else | |
2030 snprintf(TextL1,TEXTSIZE,"\032\f%c",TXT_Depth); | |
2031 GFX_write_string(&FontT24,&t7l1,TextL1,0); | |
2032 | |
2033 if((stateUsed->lifeData.ascent_rate_meter_per_min > 8) || (stateUsed->lifeData.ascent_rate_meter_per_min < -10)) | |
2034 { | |
2035 snprintf(TextL1,TEXTSIZE,"\f\002%.0f %c%c/min " | |
2036 , unit_depth_float(stateUsed->lifeData.ascent_rate_meter_per_min) | |
2037 , unit_depth_char1() | |
2038 , unit_depth_char2() | |
2039 ); | |
2040 GFX_write_string(&FontT24,&t7l1,TextL1,0); | |
2041 } | |
2042 | |
2043 if( depth < 100) | |
2044 snprintf(TextL1,TEXTSIZE,"\020%01.1f",depth); | |
2045 else | |
2046 snprintf(TextL1,TEXTSIZE,"\020%01.0f",depth); | |
2047 | |
2048 t7_colorscheme_mod(TextL1); | |
2049 GFX_write_string(&FontT144,&t7l1,TextL1,1); | |
2050 | |
2051 /* max depth */ | |
2052 snprintf(TextL2,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
2053 GFX_write_string(&FontT42,&t7l2,TextL2,0); | |
2054 | |
2055 if(unit_depth_float(stateUsed->lifeData.max_depth_meter) < 100) | |
2056 snprintf(TextL2,TEXTSIZE,"\020%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
2057 else | |
2058 snprintf(TextL2,TEXTSIZE,"\020%01.0f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
2059 | |
2060 t7_colorscheme_mod(TextL2); | |
2061 GFX_write_string(&FontT105,&t7l2,TextL2,1); | |
2062 | |
187
485c5135cf7f
cleanup: forgotten cleanup from 9da7dd50e2ec
Jan Mulder <jlmulder@xs4all.nl>
parents:
178
diff
changeset
|
2063 /* ascent rate graph */ |
38 | 2064 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) |
2065 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2066 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2067 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2068 start.y = t7l1.WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2069 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2070 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2071 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2072 start.y = t7l3.WindowY0 - 25; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2073 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2074 |
38 | 2075 for(int i = 0; i<4;i++) |
2076 { | |
2077 start.y += 5*6; | |
2078 stop.y = start.y; | |
2079 start.x = CUSTOMBOX_LINE_LEFT - 1; | |
2080 stop.x = start.x - 17; | |
2081 GFX_draw_line(&t7screen, start, stop, 0); | |
2082 // start.x = CUSTOMBOX_LINE_RIGHT + 2; old right too | |
2083 // stop.x = start.x + 17; | |
2084 // GFX_draw_line(&t7screen, start, stop, 0); | |
2085 } | |
2086 // new thick bar design Sept. 2015 | |
2087 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 3 - 5; | |
2088 stop.x = start.x; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2089 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2090 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2091 start.y = t7l1.WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2092 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2093 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2094 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2095 start.y = t7l3.WindowY0 - 25; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2096 } |
38 | 2097 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 6); |
2098 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9 | |
2099 if(stop.y >= 470) | |
2100 stop.y = 470; | |
2101 start.y += 7; // starte etwas weiter oben | |
2102 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 10) | |
2103 color = CLUT_EverythingOkayGreen; | |
2104 else | |
2105 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 15) | |
2106 color = CLUT_WarningYellow; | |
2107 else | |
2108 color = CLUT_WarningRed; | |
2109 | |
2110 GFX_draw_thick_line(12,&t7screen, start, stop, color); | |
2111 } | |
2112 //snprintf(TextL2,TEXTSIZE,"\f%.1f m/min",stateUsed->lifeData.ascent_rate_meter_per_min); | |
2113 | |
2114 /* divetime */ | |
2115 if(stateUsed->lifeData.counterSecondsShallowDepth) | |
2116 { | |
2117 snprintf(TextR1,TEXTSIZE,"\f\002\136 %u:%02u",TimeoutTime.Minutes, TimeoutTime.Seconds); | |
2118 GFX_write_string(&FontT42,&t7r1,TextR1,0); | |
2119 } | |
2120 else | |
2121 { | |
2122 snprintf(TextR1,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
2123 GFX_write_string(&FontT42,&t7r1,TextR1,0); | |
2124 } | |
2125 | |
2126 if(Divetime.Minutes < 1000) | |
2127 snprintf(TextR1,TEXTSIZE,"\020\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds); | |
2128 else | |
2129 snprintf(TextR1,TEXTSIZE,"\020\016\002%u'",Divetime.Minutes); | |
2130 t7_colorscheme_mod(TextR1); | |
2131 GFX_write_string(&FontT105,&t7r1,TextR1,1); | |
2132 | |
2133 /* next deco stop */ | |
2134 if(nextstopDepthMeter) | |
2135 { | |
2136 snprintf(TextR2,TEXTSIZE,"\032\f\002%c",TXT_Decostop); | |
2137 GFX_write_string(&FontT42,&t7r2,TextR2,0); | |
2138 textlength = snprintf(TextR2,TEXTSIZE,"\020\002%u%c%c %u'" | |
2139 , unit_depth_integer(nextstopDepthMeter) | |
2140 , unit_depth_char1_T105() | |
2141 , unit_depth_char2_T105() | |
2142 , (nextstopLengthSeconds+59)/60); | |
2143 t7_colorscheme_mod(TextR2); | |
2144 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | |
2145 TextR2[0] = '\021'; | |
2146 if(textlength <= 9) | |
2147 GFX_write_string(&FontT105,&t7r2,TextR2,1); | |
2148 else | |
2149 GFX_write_string(&FontT54,&t7r2,TextR2,1); | |
2150 } | |
2151 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit())) | |
2152 { | |
2153 snprintf(TextR2,TEXTSIZE,"\032\f\002%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2); | |
2154 GFX_write_string(&FontT42,&t7r2,TextR2,0); | |
2155 snprintf(TextR2,TEXTSIZE,"\020\016\002%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds); | |
2156 t7_colorscheme_mod(TextR2); | |
2157 GFX_write_string(&FontT105,&t7r2,TextR2,1); | |
2158 } | |
2159 | |
2160 /* tts - option 1 | |
2161 * ndl - option 2 | |
2162 * empty - option 3 */ | |
2163 if(pDecoinfo->output_time_to_surface_seconds) | |
2164 { | |
2165 snprintf(TextR3,TEXTSIZE,"\032\f\002%c",TXT_TTS); | |
2166 GFX_write_string(&FontT42,&t7r3,TextR3,0); | |
2167 if(pDecoinfo->output_time_to_surface_seconds < 1000 * 60) | |
2168 snprintf(TextR3,TEXTSIZE,"\020\002%i'",(pDecoinfo->output_time_to_surface_seconds + 30)/ 60); | |
2169 else | |
2170 snprintf(TextR3,TEXTSIZE,"\020\002%ih",pDecoinfo->output_time_to_surface_seconds / 3600); | |
2171 t7_colorscheme_mod(TextR3); | |
2172 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | |
2173 TextR2[0] = '\021'; | |
2174 GFX_write_string(&FontT105,&t7r3,TextR3,1); | |
2175 } | |
2176 else if(pDecoinfo->output_ndl_seconds) | |
2177 { | |
2178 snprintf(TextR3,TEXTSIZE,"\032\f\002%c",TXT_Nullzeit); | |
2179 GFX_write_string(&FontT42,&t7r3,TextR3,0); | |
2180 if(pDecoinfo->output_ndl_seconds < 1000 * 60) | |
2181 snprintf(TextR3,TEXTSIZE,"\020\002%i'",pDecoinfo->output_ndl_seconds/60); | |
2182 else | |
2183 snprintf(TextR3,TEXTSIZE,"\020\002%ih",pDecoinfo->output_ndl_seconds/3600); | |
2184 t7_colorscheme_mod(TextR3); | |
2185 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | |
2186 TextR2[0] = '\021'; | |
2187 GFX_write_string(&FontT105,&t7r3,TextR3,1); | |
2188 } | |
2189 | |
2190 /* Menu Selection (and gas mix) */ | |
2191 if(get_globalState() == StDMGAS) | |
2192 { | |
2193 textPointer = 0; | |
2194 TextR1[textPointer++] = '\a'; | |
2195 // TextR1[textPointer++] = '\f'; | |
2196 TextR1[textPointer++] = '\001'; | |
2197 TextR1[textPointer++] = ' '; | |
2198 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[actualBetterGasId()].oxygen_percentage,stateUsed->diveSettings.gas[actualBetterGasId()].helium_percentage,&TextR1[textPointer]); | |
2199 TextR1[textPointer++] = '?'; | |
2200 TextR1[textPointer++] = ' '; | |
2201 TextR1[textPointer++] = 0; | |
2202 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2203 } | |
2204 else if(get_globalState() == StDMSPT) | |
2205 { | |
2206 textPointer = 0; | |
2207 TextR1[textPointer++] = '\a'; | |
2208 TextR1[textPointer++] = '\001'; | |
2209 TextR1[textPointer++] = ' '; | |
2210 textPointer += snprintf(&TextR1[textPointer],5,"%f01.2",((float)(stateUsed->diveSettings.setpoint[actualBetterSetpointId()].setpoint_cbar))/100); | |
2211 TextR1[textPointer++] = '?'; | |
2212 TextR1[textPointer++] = ' '; | |
2213 TextR1[textPointer++] = 0; | |
2214 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2215 } | |
2216 else if(get_globalState() == StDMENU) | |
2217 { | |
2218 snprintf(TextR1,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveMenuQ); | |
2219 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2220 } | |
2221 else if(get_globalState() == StDSIM1) | |
2222 { | |
2223 snprintf(TextR1,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveQuitQ); | |
2224 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2225 } | |
2226 else if(get_globalState() == StDSIM2) | |
2227 { | |
2228 if(settingsGetPointer()->nonMetricalSystem) | |
2229 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:-3.33ft "); | |
2230 else | |
2231 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:-1m "); | |
2232 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2233 | |
2234 snprintf(TextR1,TEXTSIZE,"\a\f %u %c%c" | |
2235 , unit_depth_integer(simulation_get_aim_depth()) | |
2236 , unit_depth_char1() | |
2237 , unit_depth_char2() | |
2238 ); | |
2239 GFX_write_string_color(&FontT42,&t7l1,TextR1,0,CLUT_WarningYellow); | |
2240 | |
2241 } | |
2242 else if(get_globalState() == StDSIM3) | |
2243 { | |
2244 if(settingsGetPointer()->nonMetricalSystem) | |
2245 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+3.33ft "); | |
2246 else | |
2247 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+1m "); | |
2248 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2249 snprintf(TextR1,TEXTSIZE,"\a\f %u %c%c" | |
2250 , unit_depth_integer(simulation_get_aim_depth()) | |
2251 , unit_depth_char1() | |
2252 , unit_depth_char2() | |
2253 ); | |
2254 GFX_write_string_color(&FontT42,&t7l1,TextR1,0,CLUT_WarningYellow); | |
2255 } | |
2256 else if(get_globalState() == StDSIM4) | |
2257 { | |
2258 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+5' "); | |
2259 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
2260 snprintf(TextR1,TEXTSIZE,"\a\f %u %c%c" | |
2261 , unit_depth_integer(simulation_get_aim_depth()) | |
2262 , unit_depth_char1() | |
2263 , unit_depth_char2() | |
2264 ); | |
2265 GFX_write_string_color(&FontT42,&t7l1,TextR1,0,CLUT_WarningYellow); | |
2266 } | |
2267 else | |
2268 { | |
2269 /* gas mix */ | |
2270 oxygen_percentage = 100; | |
2271 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage; | |
2272 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage; | |
2273 | |
2274 textPointer = 0; | |
2275 TextC2[textPointer++] = '\020'; | |
2276 if(stateUsed->warnings.betterGas && warning_count_high_time) | |
2277 { | |
2278 TextC2[textPointer++] = '\a'; | |
2279 } | |
2280 else | |
2281 { | |
2282 float fPpO2limitHigh, fPpO2now; | |
2283 | |
2284 if(actualLeftMaxDepth(stateUsed)) | |
2285 fPpO2limitHigh = settingsGetPointer()->ppO2_max_deco; | |
2286 else | |
2287 fPpO2limitHigh = settingsGetPointer()->ppO2_max_std; | |
2288 | |
2289 fPpO2now = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * oxygen_percentage; | |
2290 | |
2291 if((fPpO2now > fPpO2limitHigh) || (fPpO2now < (float)(settingsGetPointer()->ppO2_min))) | |
2292 TextC2[textPointer++] = '\025'; | |
2293 } | |
2294 TextC2[textPointer++] = '\002'; | |
2295 textPointer += tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&TextC2[textPointer]); | |
2296 | |
2297 if(stateUsed->warnings.betterGas && warning_count_high_time) | |
2298 { | |
2299 if(TextC2[0] == '\020') | |
2300 { | |
2301 TextC2[0] = '\004'; // NOP | |
2302 } | |
2303 GFX_write_string_color(&FontT48,&t7c2,TextC2,0,CLUT_WarningYellow); | |
2304 } | |
2305 else | |
2306 { | |
2307 t7_colorscheme_mod(TextC2); | |
2308 GFX_write_string(&FontT48,&t7c2,TextC2,0); // T54 has only numbers | |
2309 } | |
2310 | |
2311 if(stateUsed->diveSettings.ccrOption) | |
2312 { | |
2313 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) | |
2314 { | |
2315 snprintf(TextC2,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); | |
2316 if(stateUsed->warnings.betterSetpoint && warning_count_high_time && (stateUsed->diveSettings.diveMode == DIVEMODE_CCR)) | |
2317 { | |
2318 TextC2[0] = '\a'; // inverse instead of color \020 | |
2319 GFX_write_string_color(&FontT48,&t7c2,TextC2,0,CLUT_WarningYellow); | |
2320 } | |
2321 else | |
2322 { | |
2323 t7_colorscheme_mod(TextC2); | |
2324 GFX_write_string(&FontT48,&t7c2,TextC2,0); | |
2325 } | |
2326 } | |
2327 } | |
2328 else if(settingsGetPointer()->alwaysShowPPO2) | |
2329 { | |
2330 snprintf(TextC2,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); | |
2331 t7_colorscheme_mod(TextC2); | |
2332 GFX_write_string(&FontT48,&t7c2,TextC2,0); | |
2333 } | |
2334 } | |
2335 | |
2336 /* algorithm, ccr, bailout and battery */ | |
2337 /* and permanent warnings (CNS) */ | |
2338 | |
2339 if((stateUsed->warnings.cnsHigh) && display_count_high_time) | |
2340 { | |
2341 TextC2[0] = '\f'; | |
2342 TextC2[1] = TXT_2BYTE; | |
2343 TextC2[2] = TXT2BYTE_WarnCnsHigh; | |
2344 TextC2[3] = 0; | |
2345 GFX_write_string_color(&FontT48,&t7c1,TextC2,0,CLUT_WarningRed); | |
2346 } | |
2347 else | |
2348 { | |
2349 if(stateUsed->warnings.aGf) | |
2350 { | |
2351 GFX_write_string_color(&FontT48,&t7c1,"\f" "aGF",0,CLUT_WarningYellow); | |
2352 } | |
2353 else if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
2354 { | |
2355 GFX_write_string(&FontT48,&t7c1,"\027\f" "GF",0); | |
2356 } | |
2357 else | |
2358 { | |
2359 GFX_write_string(&FontT48,&t7c1,"\027\f" "VPM",0); | |
2360 } | |
2361 | |
2362 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) | |
2363 GFX_write_string(&FontT24,&t7c1,"\027\f\002" "CCR",0); | |
2364 // GFX_write_string(&FontT24,&t7c1,"\f\177\177\x80" "CCR",0); | |
2365 else | |
2366 if(stateUsed->diveSettings.ccrOption) | |
2367 GFX_write_string(&FontT24,&t7c1,"\f\002\024" "Bailout",0); | |
2368 // GFX_write_string(&FontT24,&t7c1,"\f\177\177\x80\024" "Bailout",0); | |
2369 } | |
2370 TextC1[0] = '\020'; | |
2371 TextC1[1] = '3'; | |
2372 TextC1[2] = '1'; | |
2373 TextC1[3] = '1'; | |
2374 TextC1[4] = '1'; | |
2375 TextC1[5] = '1'; | |
2376 TextC1[6] = '1'; | |
2377 TextC1[7] = '1'; | |
2378 TextC1[8] = '1'; | |
2379 TextC1[9] = '1'; | |
2380 TextC1[10] = '1'; | |
2381 TextC1[11] = '1'; | |
2382 TextC1[12] = '0'; | |
2383 TextC1[13] = 0; | |
2384 | |
2385 for(int i=1;i<=10;i++) | |
2386 { | |
2387 if( stateUsed->lifeData.battery_charge > (9 * i)) | |
2388 TextC1[i+1] += 1; | |
2389 } | |
2390 | |
2391 if(stateUsed->warnings.lowBattery) | |
2392 { | |
2393 TextC1[0] = '\025'; | |
2394 if(warning_count_high_time) | |
2395 { | |
2396 for(int i=2;i<=11;i++) | |
2397 TextC1[i] = '1'; | |
2398 } | |
2399 else | |
2400 { | |
2401 TextC1[2] = '2'; | |
2402 } | |
2403 GFX_write_string(&Batt24,&t7batt,TextC1,0); | |
2404 | |
2405 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) | |
2406 { | |
2407 snprintf(TextC1,16,"\004\025\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); | |
2408 if(warning_count_high_time) | |
2409 TextC1[0] = '\a'; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2410 GFX_write_string(&FontT24,&t7voltage,TextC1,0); |
38 | 2411 } |
2412 } | |
2413 else | |
2414 { | |
2415 t7_colorscheme_mod(TextC1); | |
2416 GFX_write_string(&Batt24,&t7batt,TextC1,0); | |
2417 | |
2418 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) | |
2419 { | |
2420 snprintf(TextC1,16,"\020\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); | |
2421 t7_colorscheme_mod(TextC1); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2422 GFX_write_string(&FontT24,&t7voltage,TextC1,0); // t7batt |
38 | 2423 } |
2424 } | |
2425 | |
2426 /* customizable left lower corner */ | |
2427 t7_refresh_divemode_userselected_left_lower_corner(); | |
2428 | |
2429 | |
2430 /* customview - option 1 | |
2431 * warning - option 2 */ | |
2432 if(stateUsed->warnings.numWarnings) | |
2433 customview_warnings = t7_test_customview_warnings(); | |
2434 | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
2435 background.pointer = 0; |
38 | 2436 if(customview_warnings && warning_count_high_time) |
2437 t7_show_customview_warnings(); | |
2438 else | |
2439 t7_refresh_customview(); | |
2440 | |
2441 /* the frame */ | |
2442 draw_frame(1,1, CLUT_DIVE_pluginbox, CLUT_DIVE_FieldSeperatorLines); | |
2443 } | |
2444 | |
2445 void t7_set_field_to_primary(void) | |
2446 { | |
2447 if(stateUsed->mode == MODE_DIVE) | |
2448 selection_custom_field = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; | |
2449 } | |
2450 | |
2451 void t7_change_field(void) | |
2452 { | |
2453 const uint8_t minVal = 0; | |
2454 const uint8_t maxValGF = 8; | |
2455 const uint8_t maxValVPM = 7; | |
2456 uint8_t maxNow = maxValGF; | |
2457 | |
2458 selection_custom_field++; | |
2459 | |
2460 if(stateUsed->diveSettings.deco_type.ub.standard == VPM_MODE) | |
2461 maxNow = maxValVPM; | |
2462 | |
2463 if(selection_custom_field > maxNow) | |
2464 selection_custom_field = minVal; | |
2465 } | |
2466 | |
2467 | |
2468 void t7_refresh_divemode_userselected_left_lower_corner(void) | |
2469 { | |
2470 if(!selection_custom_field) | |
2471 return; | |
2472 | |
2473 char headerText[10]; | |
2474 char text[TEXTSIZE]; | |
2475 uint8_t textpointer = 0; | |
2476 _Bool tinyHeaderFont = 0; | |
2477 uint8_t line = 0; | |
2478 | |
2479 SDivetime Stopwatch = {0,0,0,0}; | |
2480 float fAverageDepth, fAverageDepthAbsolute; | |
2481 const SDecoinfo * pDecoinfoStandard; | |
2482 const SDecoinfo * pDecoinfoFuture; | |
2483 float fCNS; | |
2484 float temperature; | |
2485 | |
2486 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
2487 { | |
2488 pDecoinfoStandard = &stateUsed->decolistBuehlmann; | |
2489 pDecoinfoFuture = &stateUsed->decolistFutureBuehlmann; | |
2490 } | |
2491 else | |
2492 { | |
2493 pDecoinfoStandard = &stateUsed->decolistVPM; | |
2494 pDecoinfoFuture = &stateUsed->decolistFutureVPM; | |
2495 } | |
2496 | |
2497 Stopwatch.Total = timer_Stopwatch_GetTime(); | |
2498 Stopwatch.Minutes = Stopwatch.Total / 60; | |
2499 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
2500 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
2501 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
2502 | |
2503 headerText[0] = '\032'; | |
2504 headerText[1] = '\f'; | |
2505 | |
2506 switch(selection_custom_field) | |
2507 { | |
2508 /* Temperature */ | |
2509 case 1: | |
2510 default: | |
189
8b8074080d7b
Bugfix: average temperature on arrival from RTE instead of display time
Jan Mulder <jlmulder@xs4all.nl>
parents:
187
diff
changeset
|
2511 temperature = unit_temperature_float(stateUsed->lifeData.temperature_celsius); |
38 | 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 } |