Mercurial > public > ostc4
annotate Discovery/Src/t7.c @ 211:85bd5fea5e08 cv-persistent
New feature: do not show sensor customviews when no sensors attached
There are mCCR divers, that use a DC just for deco and time purposes
and not for O2 tracking and logging. These divers typically use the
existing Fixed SP mode, and have 0 active 02 sensors.
This commit simply suppresses display of the 2 customviews in case
there are no active sensors defined.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
| author | Jan Mulder <jlmulder@xs4all.nl> |
|---|---|
| date | Tue, 26 Mar 2019 16:02:22 +0100 |
| parents | b2a9e9b02df0 |
| children | 51a3aeffc6b3 |
| 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); | |
|
196
2885628ab3ba
Bugfix, minor: color the overview customview correctly
Jan Mulder <jlmulder@xs4all.nl>
parents:
193
diff
changeset
|
61 static void t7_colorscheme_mod(char *text); |
| 38 | 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(); | |
|
198
878dc9e0dbc5
cleanup: another cleanup session (data_exchange_main.c)
Jan Mulder <jlmulder@xs4all.nl>
parents:
196
diff
changeset
|
1210 SDataExchangeSlaveToMaster *dataIn = get_dataInPointer(); |
| 38 | 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"); | |
|
198
878dc9e0dbc5
cleanup: another cleanup session (data_exchange_main.c)
Jan Mulder <jlmulder@xs4all.nl>
parents:
196
diff
changeset
|
1224 snprintf(TextL1,TEXTSIZE,"%X %X %X %X",dataIn->header.checkCode[0],dataIn->header.checkCode[1],dataIn->header.checkCode[2],dataIn->header.checkCode[3]); |
| 38 | 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; | |
|
198
878dc9e0dbc5
cleanup: another cleanup session (data_exchange_main.c)
Jan Mulder <jlmulder@xs4all.nl>
parents:
196
diff
changeset
|
1264 snprintf(TextL1,TEXTSIZE,"%u.%u",dataIn->RTE_VERSION_high,dataIn->RTE_VERSION_low); |
| 38 | 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 { | |
|
210
b2a9e9b02df0
New feature: make selected customviews persistent
Jan Mulder <jlmulder@xs4all.nl>
parents:
198
diff
changeset
|
1520 if((*pViews == cv_changelist[i]) && !CHECK_BIT_THOME(settingsGetPointer()->cv_configuration, cv_changelist[i])) |
| 38 | 1521 { |
| 1522 cv_disabled = 1; | |
| 1523 break; | |
| 1524 } | |
| 1525 } | |
|
211
85bd5fea5e08
New feature: do not show sensor customviews when no sensors attached
Jan Mulder <jlmulder@xs4all.nl>
parents:
210
diff
changeset
|
1526 |
|
85bd5fea5e08
New feature: do not show sensor customviews when no sensors attached
Jan Mulder <jlmulder@xs4all.nl>
parents:
210
diff
changeset
|
1527 if ((*pViews == CVIEW_sensors || *pViews == CVIEW_sensors_mV) && |
|
85bd5fea5e08
New feature: do not show sensor customviews when no sensors attached
Jan Mulder <jlmulder@xs4all.nl>
parents:
210
diff
changeset
|
1528 stateUsed->diveSettings.ppo2sensors_deactivated) |
|
85bd5fea5e08
New feature: do not show sensor customviews when no sensors attached
Jan Mulder <jlmulder@xs4all.nl>
parents:
210
diff
changeset
|
1529 { |
|
85bd5fea5e08
New feature: do not show sensor customviews when no sensors attached
Jan Mulder <jlmulder@xs4all.nl>
parents:
210
diff
changeset
|
1530 cv_disabled = 1; |
|
85bd5fea5e08
New feature: do not show sensor customviews when no sensors attached
Jan Mulder <jlmulder@xs4all.nl>
parents:
210
diff
changeset
|
1531 } |
|
85bd5fea5e08
New feature: do not show sensor customviews when no sensors attached
Jan Mulder <jlmulder@xs4all.nl>
parents:
210
diff
changeset
|
1532 |
| 38 | 1533 if(cv_disabled) |
| 1534 { | |
| 1535 if(*pViews < CVIEW_END) | |
| 1536 { | |
| 1537 pViews++; | |
| 1538 } | |
| 1539 else | |
| 1540 { | |
| 1541 pViews = customviewsDive; | |
| 1542 } | |
| 1543 } | |
| 1544 } while(cv_disabled); | |
| 1545 } | |
| 1546 selection_customview = *pViews; | |
| 1547 } | |
| 1548 | |
| 1549 | |
| 1550 uint8_t t7_get_length_of_customtext(void) | |
| 1551 { | |
| 1552 uint8_t i = 0; | |
| 1553 settingsGetPointer()->customtext[60-1] = 0; | |
| 1554 while(settingsGetPointer()->customtext[i] > 0) | |
| 1555 i++; | |
| 1556 return i; | |
| 1557 } | |
| 1558 | |
| 1559 | |
| 1560 void t7_refresh_customview(void) | |
| 1561 { | |
| 1562 | |
| 1563 char text[256]; | |
| 1564 uint16_t textpointer = 0; | |
| 1565 int16_t start; | |
|
51
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
1566 uint8_t lineCountCustomtext = 0; |
| 38 | 1567 int16_t shiftWindowY0; |
| 1568 RTC_DateTypeDef Sdate; | |
| 1569 RTC_TimeTypeDef Stime; | |
| 1570 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth; // CVIEW_Gaslist | |
| 1571 const SGasLine * pGasLine; // CVIEW_Gaslist | |
| 1572 uint8_t oxygen, helium; // CVIEW_Gaslist | |
| 1573 float depth, surface, fraction_nitrogen, fraction_helium, ead, end; // CVIEW_EADTime | |
| 1574 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1575 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1576 pSettings = settingsGetPointer(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1577 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1578 if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1579 t7_change_customview(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1580 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
|
1581 t7_change_customview(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1582 if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1583 t7_change_customview(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1584 |
| 38 | 1585 switch(selection_customview) |
| 1586 { | |
| 1587 case CVIEW_noneOrDebug: | |
| 1588 if(settingsGetPointer()->showDebugInfo) | |
| 1589 { | |
| 1590 // header | |
| 1591 strcpy(text,"\032\f\001Debug"); | |
| 1592 GFX_write_string(&FontT42,&t7cH,text,0); | |
| 1593 // content | |
| 1594 t7_debug(); | |
| 1595 } | |
| 1596 break; | |
| 1597 | |
| 1598 case CVIEW_SummaryOfLeftCorner: | |
| 1599 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Summary); | |
| 1600 GFX_write_string(&FontT42,&t7cH,text,0); | |
| 1601 // content | |
| 1602 t7_SummaryOfLeftCorner(); | |
| 1603 break; | |
| 1604 | |
| 1605 case CVIEW_CompassDebug: | |
| 1606 snprintf(text,100,"\032\f\001Compass raw"); | |
| 1607 GFX_write_string(&FontT42,&t7cH,text,0); | |
| 1608 /* | |
| 1609 pStateReal->lifeData.compass_heading = dataIn.data[dataIn.boolCompassData].compass_heading; | |
| 1610 pStateReal->lifeData.compass_roll = dataIn.data[dataIn.boolCompassData].compass_roll; | |
| 1611 pStateReal->lifeData.compass_pitch = dataIn.data[dataIn.boolCompassData].compass_pitch; | |
| 1612 | |
| 1613 pStateReal->lifeData.compass_DX_f = dataIn.data[dataIn.boolCompassData].compass_DX_f; | |
| 1614 pStateReal->lifeData.compass_DY_f = dataIn.data[dataIn.boolCompassData].compass_DY_f; | |
| 1615 pStateReal->lifeData.compass_DZ_f = dataIn.data[dataIn.boolCompassData].compass_DZ_f; | |
| 1616 */ | |
| 1617 snprintf(text,255,"%1.1f\n\r%1.1f\n\r%1.1f\n\r%i\n\r%i\n\r%i" | |
| 1618 ,stateUsed->lifeData.compass_heading | |
| 1619 ,stateUsed->lifeData.compass_roll | |
| 1620 ,stateUsed->lifeData.compass_pitch | |
| 1621 ,stateUsed->lifeData.compass_DX_f | |
| 1622 ,stateUsed->lifeData.compass_DY_f | |
| 1623 ,stateUsed->lifeData.compass_DZ_f | |
| 1624 ); | |
| 1625 | |
| 1626 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; | |
| 1627 t7cY0free.WindowLineSpacing = 48; | |
| 1628 t7cY0free.WindowNumberOfTextLines = 6; | |
| 1629 GFX_write_string(&FontT42, &t7cY0free, text, 1); | |
| 1630 break; | |
| 1631 | |
| 1632 case CVIEW_Hello: | |
| 1633 t7_logo_OSTC(); | |
| 1634 t7cC.WindowLineSpacing = 53; | |
| 1635 t7cC.WindowNumberOfTextLines = 5; | |
| 1636 shiftWindowY0 = 18; | |
| 1637 | |
| 1638 if(updateNecessary)//if(DataEX_check_RTE_version__needs_update() || font_update_required()) | |
| 1639 { | |
| 1640 if(warning_count_high_time) | |
| 1641 { | |
| 1642 shiftWindowY0 += 20; | |
| 1643 t7cC.WindowY0 -= shiftWindowY0; | |
| 1644 textpointer = 0; | |
| 1645 text[textpointer++] = TXT_2BYTE; | |
| 1646 text[textpointer++] = TXT2BYTE_PleaseUpdate; | |
| 1647 text[textpointer++] = '\n'; | |
| 1648 text[textpointer++] = '\r'; | |
| 1649 if(DataEX_check_RTE_version__needs_update()) | |
| 1650 { | |
| 1651 text[textpointer++] = TXT_2BYTE; | |
| 1652 text[textpointer++] = TXT2BYTE_RTE; | |
| 1653 text[textpointer++] = '\n'; | |
| 1654 text[textpointer++] = '\r'; | |
| 1655 } | |
| 1656 if(font_update_required()) | |
| 1657 { | |
| 1658 text[textpointer++] = TXT_2BYTE; | |
| 1659 text[textpointer++] = TXT2BYTE_Fonts; | |
| 1660 } | |
| 1661 text[textpointer++] = 0; | |
| 1662 GFX_write_string_color(&FontT42,&t7cC,text,1, CLUT_WarningRed); | |
| 1663 t7cC.WindowY0 += shiftWindowY0; | |
| 1664 } | |
| 1665 t7cC.WindowNumberOfTextLines = 3; | |
| 1666 } | |
| 1667 else // customtext | |
| 1668 { | |
| 1669 lineCountCustomtext = t7_customtextPrepare(text); | |
| 1670 if(lineCountCustomtext <= 2) | |
| 1671 shiftWindowY0 += 20+26; // nach unten | |
| 1672 else | |
| 1673 if(lineCountCustomtext <= 3) | |
| 1674 shiftWindowY0 += 20; // nach unten | |
| 1675 t7cC.WindowY0 -= shiftWindowY0; | |
| 1676 | |
| 1677 GFX_write_string(&FontT42,&t7cC,text,1); | |
| 1678 t7cC.WindowNumberOfTextLines = 3; | |
| 1679 t7cC.WindowY0 += shiftWindowY0; | |
| 1680 } | |
| 1681 if(lineCountCustomtext <= 4) | |
| 1682 { | |
| 1683 snprintf(text,100,"\001#%0u V%01u.%01u.%01u", | |
| 1684 settingsGetPointer()->serialLow + (256 * settingsGetPointer()->serialHigh), | |
| 1685 firmwareDataGetPointer()->versionFirst, | |
| 1686 firmwareDataGetPointer()->versionSecond, | |
| 1687 firmwareDataGetPointer()->versionThird | |
| 1688 ); | |
| 1689 GFX_write_string(&FontT24,&t7cC,text,0); | |
| 1690 } | |
| 1691 break; | |
| 1692 | |
| 1693 case CVIEW_Gaslist: | |
| 1694 // a lot of code taken from tMenuGas.c | |
| 1695 // header | |
| 1696 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Gaslist); | |
| 1697 GFX_write_string(&FontT42,&t7cH,text,0); | |
| 1698 // content | |
| 1699 textpointer = 0; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1700 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1701 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1702 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1703 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1704 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1705 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1706 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1707 t7cY0free.WindowY1 = 400; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1708 } |
| 38 | 1709 t7cY0free.WindowLineSpacing = 48+9; |
| 1710 t7cY0free.WindowNumberOfTextLines = 5; // NUM_GASES == 5 | |
| 1711 t7cY0free.WindowTab = 420; | |
| 1712 | |
| 1713 pGasLine = settingsGetPointer()->gas; | |
| 1714 if(actualLeftMaxDepth(stateUsed)) | |
| 1715 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_deco) / 100; | |
| 1716 else | |
| 1717 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100; | |
| 1718 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100; | |
| 1719 for(int gasId=1;gasId<=NUM_GASES;gasId++) | |
| 1720 { | |
| 1721 textpointer = 0; | |
| 1722 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100; | |
| 1723 if(pGasLine[gasId].note.ub.active == 0) | |
| 1724 strcpy(&text[textpointer++],"\021"); | |
| 1725 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow)) | |
| 1726 strcpy(&text[textpointer++],"\025"); | |
| 1727 else | |
| 1728 strcpy(&text[textpointer++],"\030"); | |
| 1729 | |
| 1730 text[textpointer++] = ' '; | |
| 1731 oxygen = pGasLine[gasId].oxygen_percentage; | |
| 1732 helium = pGasLine[gasId].helium_percentage; | |
| 1733 textpointer += write_gas(&text[textpointer], oxygen, helium); | |
| 1734 // Wechseltiefe | |
| 1735 if(pGasLine[gasId].depth_meter) | |
| 1736 { | |
| 1737 textpointer += snprintf(&text[textpointer],7,"\t%u %c%c",unit_depth_integer(pGasLine[gasId].depth_meter), unit_depth_char1(), unit_depth_char2()); | |
| 1738 } | |
| 1739 GFX_write_string(&FontT42, &t7cY0free, text, gasId); | |
| 1740 } | |
| 1741 break; | |
| 1742 | |
| 1743 case CVIEW_EADTime: | |
| 1744 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Info ); | |
| 1745 GFX_write_string(&FontT42,&t7cH,text,0); | |
| 1746 textpointer = 0; | |
| 1747 | |
| 1748 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1749 if(pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1750 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1751 t7cY0free.WindowY1 = 400; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1752 } |
| 38 | 1753 t7cY0free.WindowLineSpacing = 48; |
| 1754 t7cY0free.WindowNumberOfTextLines = 6; | |
| 1755 | |
| 1756 // time | |
| 1757 snprintf(text,100,"\032\001%c%c",TXT_2BYTE,TXT2BYTE_Clock ); | |
| 1758 GFX_write_string(&FontT42, &t7cY0free, text, 1); | |
| 1759 | |
| 1760 translateDate(stateRealGetPointer()->lifeData.dateBinaryFormat, &Sdate); | |
| 1761 translateTime(stateRealGetPointer()->lifeData.timeBinaryFormat, &Stime); | |
| 1762 if(Stime.Seconds % 2) | |
| 1763 textpointer += snprintf(&text[textpointer],100,"\030\001%02d:%02d",Stime.Hours,Stime.Minutes); | |
| 1764 else | |
| 1765 textpointer += snprintf(&text[textpointer],100,"\030\001%02d\031:\030%02d",Stime.Hours,Stime.Minutes); | |
| 1766 GFX_write_string(&FontT42, &t7cY0free, text, 2); | |
| 1767 | |
| 1768 // EAD / END | |
| 1769 // The equivalent air depth can be calculated for depths in metres as follows: | |
| 1770 // EAD = (Depth + 10) � Fraction of N2 / 0.79 - 10 (wikipedia) | |
| 1771 // The equivalent narcotic depth can be calculated for depths in metres as follows: | |
| 1772 // END = (Depth + 10) � (1 - Fraction of helium) - 10 (wikipedia) | |
| 1773 decom_get_inert_gases((float)stateUsed->lifeData.pressure_ambient_bar,&(stateUsed->lifeData.actualGas),&fraction_nitrogen,&fraction_helium); | |
| 1774 depth = stateUsed->lifeData.pressure_ambient_bar; | |
| 1775 surface = stateUsed->lifeData.pressure_surface_bar; | |
| 1776 ead = 10.f * ((depth * fraction_nitrogen/0.79f) - surface); | |
| 1777 end = 10.0f * ((depth * (1.f - fraction_helium)) - surface); | |
| 1778 if(ead < 0) | |
| 1779 ead = 0; | |
| 1780 if(end < 0) | |
| 1781 end = 0; | |
| 1782 | |
| 1783 snprintf(text,100,"\032\001EAD"); | |
| 1784 GFX_write_string(&FontT42, &t7cY0free, text, 3); | |
| 1785 snprintf(text,100,"\030\001%01.1f %c%c" | |
| 1786 , unit_depth_float(ead) | |
| 1787 , unit_depth_char1() | |
| 1788 , unit_depth_char2() | |
| 1789 ); | |
| 1790 GFX_write_string(&FontT42, &t7cY0free, text, 4); | |
| 1791 | |
| 1792 snprintf(text,100,"\032\001END"); | |
| 1793 GFX_write_string(&FontT42, &t7cY0free, text, 5); | |
| 1794 snprintf(text,100,"\030\001%01.1f %c%c" | |
| 1795 , unit_depth_float(ead) | |
| 1796 , unit_depth_char1() | |
| 1797 , unit_depth_char2() | |
| 1798 ); | |
| 1799 GFX_write_string(&FontT42, &t7cY0free, text, 6); | |
| 1800 break; | |
| 1801 | |
| 1802 case CVIEW_Profile: | |
| 1803 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Profile); | |
| 1804 GFX_write_string(&FontT42,&t7cH,text,0); | |
| 1805 textpointer = 0; | |
| 1806 t7_miniLiveLogProfile(); | |
| 1807 break; | |
| 1808 | |
| 1809 case CVIEW_Tissues: | |
| 1810 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Tissues); | |
| 1811 GFX_write_string(&FontT42,&t7cH,text,0); | |
| 1812 textpointer = 0; | |
| 1813 t7_tissues(stateUsed); | |
| 1814 break; | |
| 1815 | |
| 1816 case CVIEW_sensors: | |
| 1817 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_O2monitor); | |
| 1818 GFX_write_string(&FontT42,&t7cH,text,0); | |
| 1819 textpointer = 0; | |
| 1820 text[textpointer++] = '\030'; // main color | |
| 1821 for(int i=0;i<3;i++) | |
| 1822 { | |
| 1823 if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) | |
| 1824 { | |
| 1825 text[textpointer++] = '\031'; // labelcolor | |
| 1826 text[textpointer++] = '\001'; | |
| 1827 text[textpointer++] = '-'; | |
| 1828 text[textpointer++] = '\n'; | |
| 1829 text[textpointer++] = '\r'; | |
| 1830 text[textpointer++] = '\030'; // main color | |
| 1831 text[textpointer] = 0; | |
| 1832 } | |
| 1833 else | |
| 1834 { | |
| 1835 if(stateUsed->warnings.sensorOutOfBounds[i]) | |
| 1836 text[textpointer++] = '\025'; // Warning Red | |
| 1837 textpointer += snprintf(&text[textpointer],100,"\001%01.2f\n\r\030",stateUsed->lifeData.ppO2Sensor_bar[i]); | |
| 1838 } | |
| 1839 } | |
| 1840 t7cC.WindowLineSpacing = 95; | |
| 1841 t7cC.WindowNumberOfTextLines = 3; | |
| 1842 text[textpointer] = 0; | |
| 1843 GFX_write_string(&FontT105,&t7cC,text,1); | |
| 1844 break; | |
| 1845 | |
| 1846 case CVIEW_sensors_mV: | |
| 1847 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_O2voltage); | |
| 1848 GFX_write_string(&FontT42,&t7cH,text,0); | |
| 1849 textpointer = 0; | |
| 1850 text[textpointer++] = '\030'; | |
| 1851 for(int i=0;i<3;i++) | |
| 1852 { | |
| 1853 if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) | |
| 1854 { | |
| 1855 text[textpointer++] = '\031'; | |
| 1856 text[textpointer++] = '\001'; | |
| 1857 text[textpointer++] = '-'; | |
| 1858 text[textpointer++] = '\n'; | |
| 1859 text[textpointer++] = '\r'; | |
| 1860 text[textpointer++] = '\030'; | |
| 1861 text[textpointer] = 0; | |
| 1862 } | |
| 1863 else | |
| 1864 { | |
| 1865 if(stateUsed->warnings.sensorOutOfBounds[i]) | |
| 1866 text[textpointer++] = '\025'; | |
| 1867 textpointer += snprintf(&text[textpointer],100,"\001%01.1f mV\n\r\030",(stateUsed->lifeData.sensorVoltage_mV[i])); | |
| 1868 } | |
| 1869 } | |
| 1870 t7cC.WindowLineSpacing = 95; | |
| 1871 t7cC.WindowNumberOfTextLines = 3; | |
| 1872 text[textpointer] = 0; | |
| 1873 GFX_write_string(&FontT48,&t7cC,text,1); | |
| 1874 break; | |
| 1875 | |
| 1876 case CVIEW_Compass: | |
| 1877 default: | |
| 1878 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE, TXT2BYTE_Compass); | |
| 1879 GFX_write_string(&FontT42,&t7cH,text,0); | |
| 1880 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
|
1881 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1882 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1883 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1884 t7cY0free.WindowX0 += 15; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1885 t7cY0free.WindowY0 = 230; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1886 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1887 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1888 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1889 t7cY0free.WindowX0 -= 15; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1890 t7cY0free.WindowY0 = 0; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1891 t7cY0free.WindowY1 = 250; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1892 } |
| 38 | 1893 snprintf(text,100,"\030\001%03i`",(uint16_t)stateUsed->lifeData.compass_heading); |
| 1894 GFX_write_string(&FontT54,&t7cY0free,text,0); | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1895 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1896 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1897 t7cY0free.WindowX0 -= 15; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1898 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1899 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1900 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1901 t7cY0free.WindowX0 += 15; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1902 } |
| 38 | 1903 break; |
| 1904 | |
| 1905 case CVIEW_Decolist: | |
| 1906 snprintf(text,100,"\032\f\001 %c%c", TXT_2BYTE, TXT2BYTE_Decolist); | |
| 1907 GFX_write_string(&FontT42,&t7cH,text,0); | |
| 1908 | |
| 1909 const SDecoinfo * pDecoinfo; | |
| 1910 uint8_t depthNext, depthLast, depthSecond, depthInc; | |
| 1911 | |
| 1912 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
| 1913 pDecoinfo = &stateUsed->decolistBuehlmann; | |
| 1914 else | |
| 1915 pDecoinfo = &stateUsed->decolistVPM; | |
| 1916 | |
| 1917 depthLast = (uint8_t)(stateUsed->diveSettings.last_stop_depth_bar * 10); | |
| 1918 depthSecond = (uint8_t)(stateUsed->diveSettings.input_second_to_last_stop_depth_bar * 10); | |
| 1919 depthInc = (uint8_t)(stateUsed->diveSettings.input_next_stop_increment_depth_bar * 10); | |
| 1920 | |
| 1921 if(settingsGetPointer()->nonMetricalSystem) | |
| 1922 { | |
| 1923 depthLast = (uint8_t)unit_depth_integer(depthLast); | |
| 1924 depthSecond = (uint8_t)unit_depth_integer(depthSecond); | |
| 1925 depthInc = (uint8_t)unit_depth_integer(depthInc); | |
| 1926 } | |
| 1927 | |
| 1928 for(start=DECOINFO_STRUCT_MAX_STOPS-1; start>0; start--) | |
| 1929 if(pDecoinfo->output_stop_length_seconds[start]) break; | |
| 1930 start -= 6; | |
| 1931 if(start < 0) start = 0; | |
| 1932 | |
| 1933 textpointer = 0; | |
| 1934 for(int i=start;i<6+start;i++) | |
| 1935 { | |
| 1936 if(i == 0) | |
| 1937 depthNext = depthLast; | |
| 1938 else | |
| 1939 depthNext = depthSecond + (( i - 1 )* depthInc); | |
| 1940 | |
| 1941 if(pDecoinfo->output_stop_length_seconds[i]) | |
| 1942 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); | |
| 1943 else | |
| 1944 textpointer += snprintf(&text[textpointer],20,"\031\034 %2u\016\016%c%c\017\n\r",depthNext, unit_depth_char1(), unit_depth_char2()); | |
| 1945 if(textpointer > 200) break; | |
| 1946 } | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1947 if(!pSettings->FlipDisplay) |
|
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 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1950 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1951 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1952 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1953 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1954 t7cY0free.WindowY1 = 400; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1955 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1956 |
| 38 | 1957 t7cY0free.WindowLineSpacing = 48; |
| 1958 t7cY0free.WindowNumberOfTextLines = 6; | |
| 1959 GFX_write_string(&FontT42, &t7cY0free, text, 1); | |
| 1960 break; | |
| 1961 } | |
| 1962 } | |
| 1963 | |
| 1964 | |
| 1965 | |
| 1966 /* DIVE MODE | |
| 1967 */ | |
| 1968 void t7_refresh_divemode(void) | |
| 1969 { | |
| 1970 char TextL1[TEXTSIZE]; | |
| 1971 char TextL2[TEXTSIZE]; | |
| 1972 | |
| 1973 char TextR1[TEXTSIZE]; | |
| 1974 char TextR2[TEXTSIZE]; | |
| 1975 char TextR3[TEXTSIZE]; | |
| 1976 | |
| 1977 char TextC1[2*TEXTSIZE]; | |
| 1978 char TextC2[TEXTSIZE]; | |
| 1979 uint8_t textPointer; | |
| 1980 | |
| 1981 point_t start, stop; | |
| 1982 uint8_t color; | |
| 1983 int textlength; | |
| 1984 | |
| 1985 uint16_t nextstopLengthSeconds = 0; | |
| 1986 uint8_t nextstopDepthMeter = 0; | |
| 1987 uint8_t oxygen_percentage = 0; | |
| 1988 SDivetime Divetime = {0,0,0, 0}; | |
| 1989 SDivetime SafetyStopTime = {0,0,0,0}; | |
| 1990 SDivetime TimeoutTime = {0,0,0,0}; | |
| 1991 uint8_t customview_warnings = 0; | |
| 1992 const SDecoinfo * pDecoinfo; | |
| 1993 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1994 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1995 pSettings = settingsGetPointer(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1996 |
| 38 | 1997 Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; |
| 1998 Divetime.Minutes = Divetime.Total / 60; | |
| 1999 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); | |
| 2000 | |
| 2001 SafetyStopTime.Total = timer_Safetystop_GetCountDown(); | |
| 2002 SafetyStopTime.Minutes = SafetyStopTime.Total / 60; | |
| 2003 SafetyStopTime.Seconds = SafetyStopTime.Total - (SafetyStopTime.Minutes * 60); | |
| 2004 | |
| 2005 TimeoutTime.Total = settingsGetPointer()->timeoutDiveReachedZeroDepth - stateUsed->lifeData.counterSecondsShallowDepth; | |
| 2006 if(TimeoutTime.Total > settingsGetPointer()->timeoutDiveReachedZeroDepth) | |
| 2007 { | |
| 2008 TimeoutTime.Total = 0; | |
| 2009 } | |
| 2010 TimeoutTime.Minutes = TimeoutTime.Total / 60; | |
| 2011 TimeoutTime.Seconds = TimeoutTime.Total - (TimeoutTime.Minutes * 60); | |
| 2012 | |
| 2013 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
| 2014 pDecoinfo = &stateUsed->decolistBuehlmann; | |
| 2015 else | |
| 2016 pDecoinfo = &stateUsed->decolistVPM; | |
| 2017 | |
| 2018 if(pDecoinfo->output_time_to_surface_seconds) | |
| 2019 { | |
| 2020 tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
| 2021 } | |
| 2022 else | |
| 2023 { | |
| 2024 nextstopDepthMeter = 0; | |
| 2025 nextstopLengthSeconds = 0; | |
| 2026 } | |
| 2027 | |
| 2028 /* depth */ | |
|
174
ecb71521d004
Bugfix: make max depth move with current depth (part 2)
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
2029 float depth = unit_depth_float(stateUsed->lifeData.depth_meter); |
| 38 | 2030 |
| 2031 if(depth <= 0.3f) | |
| 2032 depth = 0; | |
| 2033 | |
| 2034 if(settingsGetPointer()->nonMetricalSystem) | |
| 2035 snprintf(TextL1,TEXTSIZE,"\032\f[feet]"); | |
| 2036 else | |
| 2037 snprintf(TextL1,TEXTSIZE,"\032\f%c",TXT_Depth); | |
| 2038 GFX_write_string(&FontT24,&t7l1,TextL1,0); | |
| 2039 | |
| 2040 if((stateUsed->lifeData.ascent_rate_meter_per_min > 8) || (stateUsed->lifeData.ascent_rate_meter_per_min < -10)) | |
| 2041 { | |
| 2042 snprintf(TextL1,TEXTSIZE,"\f\002%.0f %c%c/min " | |
| 2043 , unit_depth_float(stateUsed->lifeData.ascent_rate_meter_per_min) | |
| 2044 , unit_depth_char1() | |
| 2045 , unit_depth_char2() | |
| 2046 ); | |
| 2047 GFX_write_string(&FontT24,&t7l1,TextL1,0); | |
| 2048 } | |
| 2049 | |
| 2050 if( depth < 100) | |
| 2051 snprintf(TextL1,TEXTSIZE,"\020%01.1f",depth); | |
| 2052 else | |
| 2053 snprintf(TextL1,TEXTSIZE,"\020%01.0f",depth); | |
| 2054 | |
| 2055 t7_colorscheme_mod(TextL1); | |
| 2056 GFX_write_string(&FontT144,&t7l1,TextL1,1); | |
| 2057 | |
| 2058 /* max depth */ | |
| 2059 snprintf(TextL2,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
| 2060 GFX_write_string(&FontT42,&t7l2,TextL2,0); | |
| 2061 | |
| 2062 if(unit_depth_float(stateUsed->lifeData.max_depth_meter) < 100) | |
| 2063 snprintf(TextL2,TEXTSIZE,"\020%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
| 2064 else | |
| 2065 snprintf(TextL2,TEXTSIZE,"\020%01.0f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
| 2066 | |
| 2067 t7_colorscheme_mod(TextL2); | |
| 2068 GFX_write_string(&FontT105,&t7l2,TextL2,1); | |
| 2069 | |
|
187
485c5135cf7f
cleanup: forgotten cleanup from 9da7dd50e2ec
Jan Mulder <jlmulder@xs4all.nl>
parents:
178
diff
changeset
|
2070 /* ascent rate graph */ |
| 38 | 2071 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) |
| 2072 { | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2073 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2074 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2075 start.y = t7l1.WindowY0 - 1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2076 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2077 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2078 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2079 start.y = t7l3.WindowY0 - 25; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2080 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2081 |
| 38 | 2082 for(int i = 0; i<4;i++) |
| 2083 { | |
| 2084 start.y += 5*6; | |
| 2085 stop.y = start.y; | |
| 2086 start.x = CUSTOMBOX_LINE_LEFT - 1; | |
| 2087 stop.x = start.x - 17; | |
| 2088 GFX_draw_line(&t7screen, start, stop, 0); | |
| 2089 // start.x = CUSTOMBOX_LINE_RIGHT + 2; old right too | |
| 2090 // stop.x = start.x + 17; | |
| 2091 // GFX_draw_line(&t7screen, start, stop, 0); | |
| 2092 } | |
| 2093 // new thick bar design Sept. 2015 | |
| 2094 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 3 - 5; | |
| 2095 stop.x = start.x; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2096 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2097 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2098 start.y = t7l1.WindowY0 - 1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2099 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2100 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2101 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2102 start.y = t7l3.WindowY0 - 25; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2103 } |
| 38 | 2104 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 6); |
| 2105 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9 | |
| 2106 if(stop.y >= 470) | |
| 2107 stop.y = 470; | |
| 2108 start.y += 7; // starte etwas weiter oben | |
| 2109 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 10) | |
| 2110 color = CLUT_EverythingOkayGreen; | |
| 2111 else | |
| 2112 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 15) | |
| 2113 color = CLUT_WarningYellow; | |
| 2114 else | |
| 2115 color = CLUT_WarningRed; | |
| 2116 | |
| 2117 GFX_draw_thick_line(12,&t7screen, start, stop, color); | |
| 2118 } | |
| 2119 //snprintf(TextL2,TEXTSIZE,"\f%.1f m/min",stateUsed->lifeData.ascent_rate_meter_per_min); | |
| 2120 | |
| 2121 /* divetime */ | |
| 2122 if(stateUsed->lifeData.counterSecondsShallowDepth) | |
| 2123 { | |
| 2124 snprintf(TextR1,TEXTSIZE,"\f\002\136 %u:%02u",TimeoutTime.Minutes, TimeoutTime.Seconds); | |
| 2125 GFX_write_string(&FontT42,&t7r1,TextR1,0); | |
| 2126 } | |
| 2127 else | |
| 2128 { | |
| 2129 snprintf(TextR1,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
| 2130 GFX_write_string(&FontT42,&t7r1,TextR1,0); | |
| 2131 } | |
| 2132 | |
| 2133 if(Divetime.Minutes < 1000) | |
| 2134 snprintf(TextR1,TEXTSIZE,"\020\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds); | |
| 2135 else | |
| 2136 snprintf(TextR1,TEXTSIZE,"\020\016\002%u'",Divetime.Minutes); | |
| 2137 t7_colorscheme_mod(TextR1); | |
| 2138 GFX_write_string(&FontT105,&t7r1,TextR1,1); | |
| 2139 | |
| 2140 /* next deco stop */ | |
| 2141 if(nextstopDepthMeter) | |
| 2142 { | |
| 2143 snprintf(TextR2,TEXTSIZE,"\032\f\002%c",TXT_Decostop); | |
| 2144 GFX_write_string(&FontT42,&t7r2,TextR2,0); | |
| 2145 textlength = snprintf(TextR2,TEXTSIZE,"\020\002%u%c%c %u'" | |
| 2146 , unit_depth_integer(nextstopDepthMeter) | |
| 2147 , unit_depth_char1_T105() | |
| 2148 , unit_depth_char2_T105() | |
| 2149 , (nextstopLengthSeconds+59)/60); | |
| 2150 t7_colorscheme_mod(TextR2); | |
| 2151 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | |
| 2152 TextR2[0] = '\021'; | |
| 2153 if(textlength <= 9) | |
| 2154 GFX_write_string(&FontT105,&t7r2,TextR2,1); | |
| 2155 else | |
| 2156 GFX_write_string(&FontT54,&t7r2,TextR2,1); | |
| 2157 } | |
| 2158 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit())) | |
| 2159 { | |
| 2160 snprintf(TextR2,TEXTSIZE,"\032\f\002%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2); | |
| 2161 GFX_write_string(&FontT42,&t7r2,TextR2,0); | |
| 2162 snprintf(TextR2,TEXTSIZE,"\020\016\002%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds); | |
| 2163 t7_colorscheme_mod(TextR2); | |
| 2164 GFX_write_string(&FontT105,&t7r2,TextR2,1); | |
| 2165 } | |
| 2166 | |
| 2167 /* tts - option 1 | |
| 2168 * ndl - option 2 | |
| 2169 * empty - option 3 */ | |
| 2170 if(pDecoinfo->output_time_to_surface_seconds) | |
| 2171 { | |
| 2172 snprintf(TextR3,TEXTSIZE,"\032\f\002%c",TXT_TTS); | |
| 2173 GFX_write_string(&FontT42,&t7r3,TextR3,0); | |
| 2174 if(pDecoinfo->output_time_to_surface_seconds < 1000 * 60) | |
| 2175 snprintf(TextR3,TEXTSIZE,"\020\002%i'",(pDecoinfo->output_time_to_surface_seconds + 30)/ 60); | |
| 2176 else | |
| 2177 snprintf(TextR3,TEXTSIZE,"\020\002%ih",pDecoinfo->output_time_to_surface_seconds / 3600); | |
| 2178 t7_colorscheme_mod(TextR3); | |
| 2179 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | |
| 2180 TextR2[0] = '\021'; | |
| 2181 GFX_write_string(&FontT105,&t7r3,TextR3,1); | |
| 2182 } | |
| 2183 else if(pDecoinfo->output_ndl_seconds) | |
| 2184 { | |
| 2185 snprintf(TextR3,TEXTSIZE,"\032\f\002%c",TXT_Nullzeit); | |
| 2186 GFX_write_string(&FontT42,&t7r3,TextR3,0); | |
| 2187 if(pDecoinfo->output_ndl_seconds < 1000 * 60) | |
| 2188 snprintf(TextR3,TEXTSIZE,"\020\002%i'",pDecoinfo->output_ndl_seconds/60); | |
| 2189 else | |
| 2190 snprintf(TextR3,TEXTSIZE,"\020\002%ih",pDecoinfo->output_ndl_seconds/3600); | |
| 2191 t7_colorscheme_mod(TextR3); | |
| 2192 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | |
| 2193 TextR2[0] = '\021'; | |
| 2194 GFX_write_string(&FontT105,&t7r3,TextR3,1); | |
| 2195 } | |
| 2196 | |
| 2197 /* Menu Selection (and gas mix) */ | |
| 2198 if(get_globalState() == StDMGAS) | |
| 2199 { | |
| 2200 textPointer = 0; | |
| 2201 TextR1[textPointer++] = '\a'; | |
| 2202 // TextR1[textPointer++] = '\f'; | |
| 2203 TextR1[textPointer++] = '\001'; | |
| 2204 TextR1[textPointer++] = ' '; | |
| 2205 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[actualBetterGasId()].oxygen_percentage,stateUsed->diveSettings.gas[actualBetterGasId()].helium_percentage,&TextR1[textPointer]); | |
| 2206 TextR1[textPointer++] = '?'; | |
| 2207 TextR1[textPointer++] = ' '; | |
| 2208 TextR1[textPointer++] = 0; | |
| 2209 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
| 2210 } | |
| 2211 else if(get_globalState() == StDMSPT) | |
| 2212 { | |
| 2213 textPointer = 0; | |
| 2214 TextR1[textPointer++] = '\a'; | |
| 2215 TextR1[textPointer++] = '\001'; | |
| 2216 TextR1[textPointer++] = ' '; | |
| 2217 textPointer += snprintf(&TextR1[textPointer],5,"%f01.2",((float)(stateUsed->diveSettings.setpoint[actualBetterSetpointId()].setpoint_cbar))/100); | |
| 2218 TextR1[textPointer++] = '?'; | |
| 2219 TextR1[textPointer++] = ' '; | |
| 2220 TextR1[textPointer++] = 0; | |
| 2221 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
| 2222 } | |
| 2223 else if(get_globalState() == StDMENU) | |
| 2224 { | |
| 2225 snprintf(TextR1,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveMenuQ); | |
| 2226 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
| 2227 } | |
| 2228 else if(get_globalState() == StDSIM1) | |
| 2229 { | |
| 2230 snprintf(TextR1,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveQuitQ); | |
| 2231 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
| 2232 } | |
| 2233 else if(get_globalState() == StDSIM2) | |
| 2234 { | |
| 2235 if(settingsGetPointer()->nonMetricalSystem) | |
| 2236 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:-3.33ft "); | |
| 2237 else | |
| 2238 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:-1m "); | |
| 2239 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
| 2240 | |
| 2241 snprintf(TextR1,TEXTSIZE,"\a\f %u %c%c" | |
| 2242 , unit_depth_integer(simulation_get_aim_depth()) | |
| 2243 , unit_depth_char1() | |
| 2244 , unit_depth_char2() | |
| 2245 ); | |
| 2246 GFX_write_string_color(&FontT42,&t7l1,TextR1,0,CLUT_WarningYellow); | |
| 2247 | |
| 2248 } | |
| 2249 else if(get_globalState() == StDSIM3) | |
| 2250 { | |
| 2251 if(settingsGetPointer()->nonMetricalSystem) | |
| 2252 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+3.33ft "); | |
| 2253 else | |
| 2254 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+1m "); | |
| 2255 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
| 2256 snprintf(TextR1,TEXTSIZE,"\a\f %u %c%c" | |
| 2257 , unit_depth_integer(simulation_get_aim_depth()) | |
| 2258 , unit_depth_char1() | |
| 2259 , unit_depth_char2() | |
| 2260 ); | |
| 2261 GFX_write_string_color(&FontT42,&t7l1,TextR1,0,CLUT_WarningYellow); | |
| 2262 } | |
| 2263 else if(get_globalState() == StDSIM4) | |
| 2264 { | |
| 2265 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+5' "); | |
| 2266 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | |
| 2267 snprintf(TextR1,TEXTSIZE,"\a\f %u %c%c" | |
| 2268 , unit_depth_integer(simulation_get_aim_depth()) | |
| 2269 , unit_depth_char1() | |
| 2270 , unit_depth_char2() | |
| 2271 ); | |
| 2272 GFX_write_string_color(&FontT42,&t7l1,TextR1,0,CLUT_WarningYellow); | |
| 2273 } | |
| 2274 else | |
| 2275 { | |
| 2276 /* gas mix */ | |
| 2277 oxygen_percentage = 100; | |
| 2278 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage; | |
| 2279 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage; | |
| 2280 | |
| 2281 textPointer = 0; | |
| 2282 TextC2[textPointer++] = '\020'; | |
| 2283 if(stateUsed->warnings.betterGas && warning_count_high_time) | |
| 2284 { | |
| 2285 TextC2[textPointer++] = '\a'; | |
| 2286 } | |
| 2287 else | |
| 2288 { | |
| 2289 float fPpO2limitHigh, fPpO2now; | |
| 2290 | |
| 2291 if(actualLeftMaxDepth(stateUsed)) | |
| 2292 fPpO2limitHigh = settingsGetPointer()->ppO2_max_deco; | |
| 2293 else | |
| 2294 fPpO2limitHigh = settingsGetPointer()->ppO2_max_std; | |
| 2295 | |
| 2296 fPpO2now = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * oxygen_percentage; | |
| 2297 | |
| 2298 if((fPpO2now > fPpO2limitHigh) || (fPpO2now < (float)(settingsGetPointer()->ppO2_min))) | |
| 2299 TextC2[textPointer++] = '\025'; | |
| 2300 } | |
| 2301 TextC2[textPointer++] = '\002'; | |
| 2302 textPointer += tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&TextC2[textPointer]); | |
| 2303 | |
| 2304 if(stateUsed->warnings.betterGas && warning_count_high_time) | |
| 2305 { | |
| 2306 if(TextC2[0] == '\020') | |
| 2307 { | |
| 2308 TextC2[0] = '\004'; // NOP | |
| 2309 } | |
| 2310 GFX_write_string_color(&FontT48,&t7c2,TextC2,0,CLUT_WarningYellow); | |
| 2311 } | |
| 2312 else | |
| 2313 { | |
| 2314 t7_colorscheme_mod(TextC2); | |
| 2315 GFX_write_string(&FontT48,&t7c2,TextC2,0); // T54 has only numbers | |
| 2316 } | |
| 2317 | |
| 2318 if(stateUsed->diveSettings.ccrOption) | |
| 2319 { | |
| 2320 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) | |
| 2321 { | |
| 2322 snprintf(TextC2,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); | |
| 2323 if(stateUsed->warnings.betterSetpoint && warning_count_high_time && (stateUsed->diveSettings.diveMode == DIVEMODE_CCR)) | |
| 2324 { | |
| 2325 TextC2[0] = '\a'; // inverse instead of color \020 | |
| 2326 GFX_write_string_color(&FontT48,&t7c2,TextC2,0,CLUT_WarningYellow); | |
| 2327 } | |
| 2328 else | |
| 2329 { | |
| 2330 t7_colorscheme_mod(TextC2); | |
| 2331 GFX_write_string(&FontT48,&t7c2,TextC2,0); | |
| 2332 } | |
| 2333 } | |
| 2334 } | |
| 2335 else if(settingsGetPointer()->alwaysShowPPO2) | |
| 2336 { | |
| 2337 snprintf(TextC2,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); | |
| 2338 t7_colorscheme_mod(TextC2); | |
| 2339 GFX_write_string(&FontT48,&t7c2,TextC2,0); | |
| 2340 } | |
| 2341 } | |
| 2342 | |
| 2343 /* algorithm, ccr, bailout and battery */ | |
| 2344 /* and permanent warnings (CNS) */ | |
| 2345 | |
| 2346 if((stateUsed->warnings.cnsHigh) && display_count_high_time) | |
| 2347 { | |
| 2348 TextC2[0] = '\f'; | |
| 2349 TextC2[1] = TXT_2BYTE; | |
| 2350 TextC2[2] = TXT2BYTE_WarnCnsHigh; | |
| 2351 TextC2[3] = 0; | |
| 2352 GFX_write_string_color(&FontT48,&t7c1,TextC2,0,CLUT_WarningRed); | |
| 2353 } | |
| 2354 else | |
| 2355 { | |
| 2356 if(stateUsed->warnings.aGf) | |
| 2357 { | |
| 2358 GFX_write_string_color(&FontT48,&t7c1,"\f" "aGF",0,CLUT_WarningYellow); | |
| 2359 } | |
| 2360 else if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
| 2361 { | |
| 2362 GFX_write_string(&FontT48,&t7c1,"\027\f" "GF",0); | |
| 2363 } | |
| 2364 else | |
| 2365 { | |
| 2366 GFX_write_string(&FontT48,&t7c1,"\027\f" "VPM",0); | |
| 2367 } | |
| 2368 | |
| 2369 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) | |
| 2370 GFX_write_string(&FontT24,&t7c1,"\027\f\002" "CCR",0); | |
| 2371 // GFX_write_string(&FontT24,&t7c1,"\f\177\177\x80" "CCR",0); | |
| 2372 else | |
| 2373 if(stateUsed->diveSettings.ccrOption) | |
| 2374 GFX_write_string(&FontT24,&t7c1,"\f\002\024" "Bailout",0); | |
| 2375 // GFX_write_string(&FontT24,&t7c1,"\f\177\177\x80\024" "Bailout",0); | |
| 2376 } | |
| 2377 TextC1[0] = '\020'; | |
| 2378 TextC1[1] = '3'; | |
| 2379 TextC1[2] = '1'; | |
| 2380 TextC1[3] = '1'; | |
| 2381 TextC1[4] = '1'; | |
| 2382 TextC1[5] = '1'; | |
| 2383 TextC1[6] = '1'; | |
| 2384 TextC1[7] = '1'; | |
| 2385 TextC1[8] = '1'; | |
| 2386 TextC1[9] = '1'; | |
| 2387 TextC1[10] = '1'; | |
| 2388 TextC1[11] = '1'; | |
| 2389 TextC1[12] = '0'; | |
| 2390 TextC1[13] = 0; | |
| 2391 | |
| 2392 for(int i=1;i<=10;i++) | |
| 2393 { | |
| 2394 if( stateUsed->lifeData.battery_charge > (9 * i)) | |
| 2395 TextC1[i+1] += 1; | |
| 2396 } | |
| 2397 | |
| 2398 if(stateUsed->warnings.lowBattery) | |
| 2399 { | |
| 2400 TextC1[0] = '\025'; | |
| 2401 if(warning_count_high_time) | |
| 2402 { | |
| 2403 for(int i=2;i<=11;i++) | |
| 2404 TextC1[i] = '1'; | |
| 2405 } | |
| 2406 else | |
| 2407 { | |
| 2408 TextC1[2] = '2'; | |
| 2409 } | |
| 2410 GFX_write_string(&Batt24,&t7batt,TextC1,0); | |
| 2411 | |
| 2412 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) | |
| 2413 { | |
| 2414 snprintf(TextC1,16,"\004\025\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); | |
| 2415 if(warning_count_high_time) | |
| 2416 TextC1[0] = '\a'; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2417 GFX_write_string(&FontT24,&t7voltage,TextC1,0); |
| 38 | 2418 } |
| 2419 } | |
| 2420 else | |
| 2421 { | |
| 2422 t7_colorscheme_mod(TextC1); | |
| 2423 GFX_write_string(&Batt24,&t7batt,TextC1,0); | |
| 2424 | |
| 2425 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) | |
| 2426 { | |
| 2427 snprintf(TextC1,16,"\020\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); | |
| 2428 t7_colorscheme_mod(TextC1); | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2429 GFX_write_string(&FontT24,&t7voltage,TextC1,0); // t7batt |
| 38 | 2430 } |
| 2431 } | |
| 2432 | |
| 2433 /* customizable left lower corner */ | |
| 2434 t7_refresh_divemode_userselected_left_lower_corner(); | |
| 2435 | |
| 2436 | |
| 2437 /* customview - option 1 | |
| 2438 * warning - option 2 */ | |
| 2439 if(stateUsed->warnings.numWarnings) | |
| 2440 customview_warnings = t7_test_customview_warnings(); | |
| 2441 | |
|
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
2442 background.pointer = 0; |
| 38 | 2443 if(customview_warnings && warning_count_high_time) |
| 2444 t7_show_customview_warnings(); | |
| 2445 else | |
| 2446 t7_refresh_customview(); | |
| 2447 | |
| 2448 /* the frame */ | |
| 2449 draw_frame(1,1, CLUT_DIVE_pluginbox, CLUT_DIVE_FieldSeperatorLines); | |
| 2450 } | |
| 2451 | |
| 2452 void t7_set_field_to_primary(void) | |
| 2453 { | |
| 2454 if(stateUsed->mode == MODE_DIVE) | |
| 2455 selection_custom_field = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; | |
| 2456 } | |
| 2457 | |
| 2458 void t7_change_field(void) | |
| 2459 { | |
| 2460 const uint8_t minVal = 0; | |
| 2461 const uint8_t maxValGF = 8; | |
| 2462 const uint8_t maxValVPM = 7; | |
| 2463 uint8_t maxNow = maxValGF; | |
| 2464 | |
| 2465 selection_custom_field++; | |
| 2466 | |
| 2467 if(stateUsed->diveSettings.deco_type.ub.standard == VPM_MODE) | |
| 2468 maxNow = maxValVPM; | |
| 2469 | |
| 2470 if(selection_custom_field > maxNow) | |
| 2471 selection_custom_field = minVal; | |
| 2472 } | |
| 2473 | |
| 2474 | |
| 2475 void t7_refresh_divemode_userselected_left_lower_corner(void) | |
| 2476 { | |
| 2477 if(!selection_custom_field) | |
| 2478 return; | |
| 2479 | |
| 2480 char headerText[10]; | |
| 2481 char text[TEXTSIZE]; | |
| 2482 uint8_t textpointer = 0; | |
| 2483 _Bool tinyHeaderFont = 0; | |
| 2484 uint8_t line = 0; | |
| 2485 | |
| 2486 SDivetime Stopwatch = {0,0,0,0}; | |
| 2487 float fAverageDepth, fAverageDepthAbsolute; | |
| 2488 const SDecoinfo * pDecoinfoStandard; | |
| 2489 const SDecoinfo * pDecoinfoFuture; | |
| 2490 float fCNS; | |
| 2491 float temperature; | |
| 2492 | |
| 2493 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
| 2494 { | |
| 2495 pDecoinfoStandard = &stateUsed->decolistBuehlmann; | |
| 2496 pDecoinfoFuture = &stateUsed->decolistFutureBuehlmann; | |
| 2497 } | |
| 2498 else | |
| 2499 { | |
| 2500 pDecoinfoStandard = &stateUsed->decolistVPM; | |
| 2501 pDecoinfoFuture = &stateUsed->decolistFutureVPM; | |
| 2502 } | |
| 2503 | |
| 2504 Stopwatch.Total = timer_Stopwatch_GetTime(); | |
| 2505 Stopwatch.Minutes = Stopwatch.Total / 60; | |
| 2506 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
| 2507 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
| 2508 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
| 2509 | |
| 2510 headerText[0] = '\032'; | |
| 2511 headerText[1] = '\f'; | |
| 2512 | |
| 2513 switch(selection_custom_field) | |
| 2514 { | |
| 2515 /* Temperature */ | |
| 2516 case 1: | |
| 2517 default: | |
|
189
8b8074080d7b
Bugfix: average temperature on arrival from RTE instead of display time
Jan Mulder <jlmulder@xs4all.nl>
parents:
187
diff
changeset
|
2518 temperature = unit_temperature_float(stateUsed->lifeData.temperature_celsius); |
| 38 | 2519 headerText[2] = TXT_Temperature; |
| 2520 textpointer = snprintf(text,TEXTSIZE,"\020\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F | |
| 2521 if(settingsGetPointer()->nonMetricalSystem == 0) | |
| 2522 text[textpointer++] = 'C'; | |
| 2523 else | |
| 2524 text[textpointer++] = 'F'; | |
| 2525 text[textpointer++] = 0; | |
| 2526 tinyHeaderFont = 0; | |
| 2527 break; | |
| 2528 | |
| 2529 /* Average Depth */ | |
| 2530 case 2: | |
| 2531 headerText[2] = TXT_AvgDepth; | |
| 2532 if(settingsGetPointer()->nonMetricalSystem) | |
| 2533 snprintf(text,TEXTSIZE,"\020%01.0f",unit_depth_float(fAverageDepthAbsolute)); | |
| 2534 else | |
| 2535 snprintf(text,TEXTSIZE,"\020%01.1f",fAverageDepthAbsolute); | |
| 2536 break; | |
| 2537 | |
| 2538 /* ppO2 */ | |
| 2539 case 3: | |
| 2540 headerText[2] = TXT_ppO2; | |
| 2541 snprintf(text,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); | |
| 2542 break; | |
| 2543 | |
| 2544 /* Stop Uhr */ | |
| 2545 case 4: | |
| 2546 headerText[2] = TXT_Stopwatch; | |
| 2547 if(settingsGetPointer()->nonMetricalSystem) | |
| 2548 snprintf(text,TEXTSIZE,"\020\016\016%u:%02u\n\r%01.0f",Stopwatch.Minutes, Stopwatch.Seconds,unit_depth_float(fAverageDepth)); | |
| 2549 else | |
| 2550 snprintf(text,TEXTSIZE,"\020\016\016%u:%02u\n\r%01.1f",Stopwatch.Minutes, Stopwatch.Seconds,fAverageDepth); | |
| 2551 tinyHeaderFont = 1; | |
| 2552 line = 1; | |
| 2553 break; | |
| 2554 | |
| 2555 /* Ceiling */ | |
| 2556 case 5: | |
| 2557 headerText[2] = TXT_Ceiling; | |
| 2558 if((pDecoinfoStandard->output_ceiling_meter > 99.9f) || (settingsGetPointer()->nonMetricalSystem)) | |
| 2559 snprintf(text,TEXTSIZE,"\020%01.0f",unit_depth_float(pDecoinfoStandard->output_ceiling_meter)); | |
| 2560 else | |
| 2561 snprintf(text,TEXTSIZE,"\020%01.1f",pDecoinfoStandard->output_ceiling_meter); | |
| 2562 break; | |
| 2563 | |
| 2564 /* Future TTS */ | |
| 2565 case 6: | |
| 2566 headerText[2] = TXT_FutureTTS; | |
| 2567 snprintf(text,TEXTSIZE,"\020\016\016@+%u'\n\r" "%i' TTS",settingsGetPointer()->future_TTS, pDecoinfoFuture->output_time_to_surface_seconds / 60); | |
| 2568 tinyHeaderFont = 1; | |
| 2569 line = 1; | |
| 2570 break; | |
| 2571 | |
| 2572 /* CNS */ | |
| 2573 case 7: | |
| 2574 headerText[2] = TXT_CNS; | |
| 2575 fCNS = stateUsed->lifeData .cns; | |
| 2576 if(fCNS > 999) | |
| 2577 fCNS = 999; | |
| 2578 snprintf(text,TEXTSIZE,"\020%.0f\016\016%%\017",fCNS); | |
| 2579 break; | |
| 2580 | |
| 2581 /* actual GF */ | |
| 2582 case 8: | |
| 2583 headerText[2] = TXT_ActualGradient; | |
| 2584 snprintf(text,TEXTSIZE,"\020%.0f",100 * pDecoinfoStandard->output_relative_gradient); | |
| 2585 break; | |
| 2586 } | |
| 2587 headerText[3] = 0; | |
| 2588 | |
| 2589 if(tinyHeaderFont) | |
| 2590 GFX_write_string(&FontT24,&t7l3,headerText,0); | |
| 2591 else | |
| 2592 GFX_write_string(&FontT42,&t7l3,headerText,0); | |
| 2593 | |
| 2594 t7_colorscheme_mod(text); | |
| 2595 GFX_write_string(&FontT105,&t7l3,text,line); | |
| 2596 } | |
| 2597 | |
| 2598 /* Private functions ---------------------------------------------------------*/ | |
| 2599 | |
| 2600 uint8_t t7_customtextPrepare(char * text) | |
| 2601 { | |
| 2602 uint8_t i, j, textptr, lineCount; | |
| 2603 char nextChar; | |
| 2604 | |
| 2605 textptr = 0; | |
| 2606 lineCount = 0; | |
| 2607 | |
| 2608 text[textptr++] = TXT_MINIMAL; | |
| 2609 | |
| 2610 j = 0; | |
| 2611 i = 0; | |
| 2612 do | |
| 2613 { | |
| 2614 j += i; | |
| 2615 i = 0; | |
| 2616 do | |
| 2617 { | |
| 2618 nextChar = settingsGetPointer()->customtext[i+j]; | |
| 2619 i++; | |
| 2620 if((!nextChar) || (nextChar =='\n') || (nextChar =='\r')) | |
| 2621 break; | |
| 2622 text[textptr++] = nextChar; | |
| 2623 } while (i < 12); | |
| 2624 | |
| 2625 if(!nextChar) | |
| 2626 break; | |
| 2627 | |
| 2628 if(lineCount < 3) | |
| 2629 { | |
| 2630 text[textptr++] = '\n'; | |
| 2631 text[textptr++] = '\r'; | |
| 2632 } | |
| 2633 lineCount++; | |
| 2634 for(uint8_t k=0;k<2;k++) | |
| 2635 { | |
| 2636 nextChar = settingsGetPointer()->customtext[i+j+k]; | |
| 2637 if((nextChar =='\n') || (nextChar =='\r')) | |
| 2638 i++; | |
| 2639 else | |
| 2640 break; | |
| 2641 } | |
| 2642 | |
| 2643 } while (lineCount < 4); | |
| 2644 | |
| 2645 text[textptr] = 0; | |
| 2646 return lineCount; | |
| 2647 } | |
| 2648 | |
|
196
2885628ab3ba
Bugfix, minor: color the overview customview correctly
Jan Mulder <jlmulder@xs4all.nl>
parents:
193
diff
changeset
|
2649 static void t7_colorscheme_mod(char *text) { |
|
2885628ab3ba
Bugfix, minor: color the overview customview correctly
Jan Mulder <jlmulder@xs4all.nl>
parents:
193
diff
changeset
|
2650 char *p = text; |
|
2885628ab3ba
Bugfix, minor: color the overview customview correctly
Jan Mulder <jlmulder@xs4all.nl>
parents:
193
diff
changeset
|
2651 while (*p) { |
|
2885628ab3ba
Bugfix, minor: color the overview customview correctly
Jan Mulder <jlmulder@xs4all.nl>
parents:
193
diff
changeset
|
2652 if ((*p == '\020') && !GFX_is_colorschemeDiveStandard()) |
|
2885628ab3ba
Bugfix, minor: color the overview customview correctly
Jan Mulder <jlmulder@xs4all.nl>
parents:
193
diff
changeset
|
2653 *p = '\027'; |
|
2885628ab3ba
Bugfix, minor: color the overview customview correctly
Jan Mulder <jlmulder@xs4all.nl>
parents:
193
diff
changeset
|
2654 p++; |
|
2885628ab3ba
Bugfix, minor: color the overview customview correctly
Jan Mulder <jlmulder@xs4all.nl>
parents:
193
diff
changeset
|
2655 } |
| 38 | 2656 } |
| 2657 | |
| 2658 | |
| 2659 void draw_frame(_Bool PluginBoxHeader, _Bool LinesOnTheSides, uint8_t colorBox, uint8_t colorLinesOnTheSide) | |
| 2660 { | |
| 2661 point_t LeftLow, WidthHeight; | |
| 2662 point_t start, stop; | |
| 2663 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2664 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2665 pSettings = settingsGetPointer(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2666 |
| 38 | 2667 // plugin box |
| 2668 LeftLow.x = CUSTOMBOX_LINE_LEFT; | |
| 2669 WidthHeight.x = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_LINE_LEFT; | |
| 2670 LeftLow.y = 60; | |
| 2671 WidthHeight.y = 440 - LeftLow.y; | |
| 2672 GFX_draw_box(&t7screen, LeftLow, WidthHeight, 1, colorBox); | |
| 2673 | |
| 2674 if(PluginBoxHeader) | |
| 2675 { | |
| 2676 // plugin box - header | |
| 2677 start.x = CUSTOMBOX_LINE_LEFT; | |
| 2678 stop.x = CUSTOMBOX_LINE_RIGHT; | |
| 2679 stop.y = start.y = 440 - 60; | |
| 2680 GFX_draw_line(&t7screen, start, stop, colorBox); | |
| 2681 } | |
| 2682 | |
| 2683 if(LinesOnTheSides) | |
| 2684 { | |
| 2685 // aufteilung links | |
| 2686 start.x = 0; | |
| 2687 stop.x = CUSTOMBOX_LINE_LEFT; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2688 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2689 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2690 stop.y = start.y = t7l1.WindowY0 - 1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2691 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2692 else |
|
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 = 480 - t7l1.WindowY1 - 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 |
| 38 | 2697 GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide); |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2698 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2699 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2700 stop.y = start.y = t7l2.WindowY0 -1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2701 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2702 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2703 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2704 stop.y = start.y = 480 - t7l2.WindowY1 -1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2705 } |
| 38 | 2706 GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide); |
| 2707 | |
| 2708 // aufteilung rechts | |
| 2709 start.x = CUSTOMBOX_LINE_RIGHT; | |
| 2710 stop.x = 799; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2711 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2712 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2713 stop.y = start.y = t7l1.WindowY0 - 1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2714 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2715 else |
|
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 = 480 - t7l1.WindowY1 - 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 |
| 38 | 2720 GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide); |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2721 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2722 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2723 stop.y = start.y = t7l2.WindowY0 - 1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2724 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2725 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2726 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2727 stop.y = start.y = 480 - t7l2.WindowY1 - 1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2728 } |
| 38 | 2729 GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide); |
| 2730 } | |
| 2731 } | |
| 2732 | |
| 2733 | |
| 2734 /* Compass like TCOS shellfish | |
| 2735 * input is 0 to 359 | |
| 2736 * 2 px / 1 degree | |
| 2737 * Range is 148 degree with CUSTOMBOX_SPACE_INSIDE = 296 | |
| 2738 * one side is 74 degree (less than 90 degree) | |
| 2739 * internal 360 + 180 degree of freedom | |
| 2740 * use positive values only, shift by 360 below 90 mid position | |
| 2741 */ | |
| 2742 | |
| 2743 | |
| 2744 point_t t7_compass_circle(uint8_t id, uint16_t degree) | |
| 2745 { | |
| 2746 float fCos, fSin; | |
| 2747 const float piMult = ((2 * 3.14159) / 360); | |
| 2748 // const int radius[4] = {95,105,115,60}; | |
| 2749 const int radius[4] = {95,105,115,100}; | |
| 2750 const point_t offset = {.x = 400, .y = 250}; | |
| 2751 | |
| 2752 static point_t r[4][360] = { 0 }; | |
| 2753 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2754 if(r[0][0].y == 0) /* calc table at first call only */ |
| 38 | 2755 { |
| 2756 for(int i=0;i<360;i++) | |
| 2757 { | |
| 2758 fCos = cos(i * piMult); | |
| 2759 fSin = sin(i * piMult); | |
| 2760 for(int j=0;j<4;j++) | |
| 2761 { | |
| 2762 r[j][i].x = offset.x + (int)(fSin * radius[j]); | |
| 2763 r[j][i].y = offset.y + (int)(fCos * radius[j]); | |
| 2764 } | |
| 2765 } | |
| 2766 } | |
| 2767 if(id > 3) id = 0; | |
| 2768 if(degree > 359) degree = 0; | |
| 2769 return r[id][degree]; | |
| 2770 } | |
| 2771 | |
| 2772 /* range should be 0 to 30 bar if 300 meter with 100% of nitrogen or helium | |
| 2773 * T24 is 28 high | |
| 2774 */ | |
| 2775 void t7_tissues(const SDiveState * pState) | |
| 2776 { | |
| 2777 point_t start, change, stop; | |
| 2778 float value; | |
| 2779 uint16_t front, cns100pixel; | |
| 2780 char text[256]; | |
| 2781 uint8_t textpointer = 0; | |
| 2782 uint8_t color; | |
| 2783 | |
| 2784 float percent_N2; | |
| 2785 float percent_He; | |
| 2786 float partial_pressure_N2; | |
| 2787 float partial_pressure_He; | |
| 2788 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2789 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2790 pSettings = settingsGetPointer(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2791 |
| 38 | 2792 |
| 2793 /* N2 */ | |
| 2794 t7cY0free.WindowLineSpacing = 28 + 48 + 14; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2795 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2796 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2797 t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2798 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2799 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2800 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2801 t7cY0free.WindowY0 = t7cH.WindowY0 + 15; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2802 t7cY0free.WindowY1 = t7cY0free.WindowY0 + 250; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2803 } |
| 38 | 2804 t7cY0free.WindowNumberOfTextLines = 3; |
| 2805 | |
| 2806 text[textpointer++] = '\030'; | |
| 2807 text[textpointer++] = TXT_2BYTE; | |
| 2808 text[textpointer++] = TXT2BYTE_Nitrogen; | |
| 2809 text[textpointer++] = '\n'; | |
| 2810 text[textpointer++] = '\r'; | |
| 2811 text[textpointer++] = TXT_2BYTE; | |
| 2812 text[textpointer++] = TXT2BYTE_Helium; | |
| 2813 text[textpointer++] = '\n'; | |
| 2814 text[textpointer++] = '\r'; | |
| 2815 text[textpointer++] = TXT_2BYTE; | |
| 2816 text[textpointer++] = TXT2BYTE_CNS; | |
| 2817 text[textpointer++] = 0; | |
| 2818 | |
| 2819 GFX_write_string(&FontT24, &t7cY0free, text, 1); | |
| 2820 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2821 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2822 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2823 start.y = t7cH.WindowY0 - 5; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2824 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2825 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2826 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2827 start.y = t7cH.WindowY1 - 5; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2828 } |
| 38 | 2829 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
| 2830 stop.x = start.x + CUSTOMBOX_SPACE_INSIDE; | |
| 2831 | |
| 2832 for(int i=0;i<16;i++) | |
| 2833 { | |
| 2834 stop.y = start.y; | |
| 2835 change.y = start.y; | |
| 2836 | |
| 2837 value = pState->lifeData.tissue_nitrogen_bar[i] - 0.7512f; | |
| 2838 value *= 80;//20 | |
| 2839 | |
| 2840 if(value < 0) | |
| 2841 front = 0; | |
| 2842 else | |
| 2843 if(value > CUSTOMBOX_SPACE_INSIDE) | |
| 2844 front = CUSTOMBOX_SPACE_INSIDE; | |
| 2845 else | |
| 2846 front = (uint16_t)value; | |
| 2847 | |
| 2848 change.x = start.x + front; | |
| 2849 if(change.x != start.x) | |
| 2850 GFX_draw_thick_line(1,&t7screen, start, change, CLUT_Font030); | |
| 2851 if(change.x != stop.x) | |
| 2852 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font031); | |
| 2853 | |
| 2854 start.y -= 3; | |
| 2855 } | |
| 2856 | |
| 2857 /* He */ | |
| 2858 start.y -= 28 + 14; | |
| 2859 for(int i=0;i<16;i++) | |
| 2860 { | |
| 2861 stop.y = start.y; | |
| 2862 change.y = start.y; | |
| 2863 | |
| 2864 value = pState->lifeData.tissue_helium_bar[i]; | |
| 2865 value *= 80;//20 | |
| 2866 | |
| 2867 if(value < 0) | |
| 2868 front = 0; | |
| 2869 else if(value > CUSTOMBOX_SPACE_INSIDE) | |
| 2870 front = CUSTOMBOX_SPACE_INSIDE; | |
| 2871 else | |
| 2872 front = (uint16_t)value; | |
| 2873 | |
| 2874 change.x = start.x + front; | |
| 2875 if(change.x != start.x) | |
| 2876 GFX_draw_thick_line(1,&t7screen, start, change, CLUT_Font030); | |
| 2877 if(change.x != stop.x) | |
| 2878 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font031); | |
| 2879 | |
| 2880 start.y -= 3; | |
| 2881 } | |
| 2882 | |
| 2883 /* CNS == Oxygen */ | |
| 2884 start.y -= 28 + 14; | |
| 2885 | |
| 2886 cns100pixel = (8 * CUSTOMBOX_SPACE_INSIDE) / 10; | |
| 2887 value = pState->lifeData.cns; | |
| 2888 value *= cns100pixel; | |
| 2889 value /= 100; | |
| 2890 | |
| 2891 if(value < 0) | |
| 2892 front = 0; | |
| 2893 else if(value > CUSTOMBOX_SPACE_INSIDE) | |
| 2894 front = CUSTOMBOX_SPACE_INSIDE; | |
| 2895 else | |
| 2896 front = (uint16_t)value; | |
| 2897 | |
| 2898 if(pState->lifeData.cns < 95) | |
| 2899 color = CLUT_Font030; | |
| 2900 else if(pState->lifeData.cns < 100) | |
| 2901 color = CLUT_WarningYellow; | |
| 2902 else | |
| 2903 color = CLUT_WarningRed; | |
| 2904 | |
| 2905 for(int i=0;i<16;i++) | |
| 2906 { | |
| 2907 stop.y = start.y; | |
| 2908 change.y = start.y; | |
| 2909 | |
| 2910 change.x = start.x + front; | |
| 2911 if(change.x != start.x) | |
| 2912 GFX_draw_thick_line(1,&t7screen, start, change, color); | |
| 2913 if(change.x != stop.x) | |
| 2914 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font031); | |
| 2915 | |
| 2916 start.y -= 3; | |
| 2917 } | |
| 2918 | |
| 2919 /* where is the onload/offload limit for N2 and He */ | |
| 2920 decom_get_inert_gases(pState->lifeData.pressure_ambient_bar, &pState->lifeData.actualGas, &percent_N2, &percent_He); | |
| 2921 partial_pressure_N2 = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_N2; | |
| 2922 partial_pressure_He = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_He; | |
| 2923 | |
| 2924 // Nitrogen vertical bar | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2925 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2926 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2927 start.y = t7cH.WindowY0 + 1 - 5; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2928 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2929 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2930 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2931 start.y = t7cH.WindowY1 - 5; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2932 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2933 |
| 38 | 2934 stop.y = start.y - (3 * 15) - 1; |
| 2935 if((percent_N2 > 0) && (partial_pressure_N2 > 0.8f))//(0.8f + 0.5f))) | |
| 2936 { | |
| 2937 value = partial_pressure_N2; | |
| 2938 value *= 80;//20 | |
| 2939 | |
| 2940 if(value < 0) | |
| 2941 front = 3; | |
| 2942 else if(value + 5 > CUSTOMBOX_SPACE_INSIDE) | |
| 2943 front = CUSTOMBOX_SPACE_INSIDE - 3; | |
| 2944 else | |
| 2945 front = (uint16_t)value; | |
| 2946 } | |
| 2947 else | |
| 2948 { | |
| 2949 front = 1; | |
| 2950 } | |
| 2951 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + front; | |
| 2952 stop.x = start.x; | |
| 2953 GFX_draw_thick_line(2,&t7screen, start, stop, CLUT_EverythingOkayGreen); | |
| 2954 | |
| 2955 | |
| 2956 // Helium vertical bar | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2957 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2958 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2959 start.y = t7cH.WindowY0 + 1 - 5 - 3*16 - 28 - 14; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2960 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2961 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2962 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2963 start.y = t7cH.WindowY1 - 5 - 3*16 - 28 - 14; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2964 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2965 |
| 38 | 2966 stop.y = start.y - (3 * 15) - 1; |
| 2967 if((percent_He > 0) && (partial_pressure_He > 0.01f)) // 0.5f | |
| 2968 { | |
| 2969 | |
| 2970 value = partial_pressure_He; | |
| 2971 value *= 80;//20 | |
| 2972 | |
| 2973 if(value < 0) | |
| 2974 front = 3; | |
| 2975 else if(value + 5 > CUSTOMBOX_SPACE_INSIDE) | |
| 2976 front = CUSTOMBOX_SPACE_INSIDE - 3; | |
| 2977 else | |
| 2978 front = (uint16_t)value; | |
| 2979 } | |
| 2980 else | |
| 2981 { | |
| 2982 front = 1; | |
| 2983 } | |
| 2984 | |
| 2985 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + front; | |
| 2986 stop.x = start.x; | |
| 2987 GFX_draw_thick_line(2,&t7screen, start, stop, CLUT_EverythingOkayGreen); | |
| 2988 | |
| 2989 // Oxygen vertical bar | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2990 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2991 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2992 start.y = t7cH.WindowY0 + 1 - 5 - 6*16 - 2*28 - 2*14; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2993 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2994 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2995 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2996 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
|
2997 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
2998 |
| 38 | 2999 stop.y = start.y - (3 * 15) - 1; |
| 3000 | |
| 3001 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + cns100pixel; | |
| 3002 stop.x = start.x; | |
| 3003 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
|
3004 |
| 38 | 3005 } |
| 3006 | |
| 3007 | |
| 3008 void t7_debug(void) | |
| 3009 { | |
| 3010 char text[256+50]; | |
| 3011 uint8_t textpointer = 0; | |
| 3012 | |
| 3013 t7cY0free.WindowLineSpacing = 28 + 48 + 14; | |
| 3014 t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing; | |
| 3015 t7cY0free.WindowNumberOfTextLines = 3; | |
| 3016 | |
| 3017 textpointer += snprintf(&text[textpointer],50,"Ambient [bar]\n\r"); | |
| 3018 textpointer += snprintf(&text[textpointer],50,"Surface [bar] + salt\n\r"); | |
| 3019 // textpointer += snprintf(&text[textpointer],50,"Difference [mbar]\n\r"); | |
| 3020 textpointer += snprintf(&text[textpointer],50,"ShallowCounter [s]\n\r"); | |
| 3021 GFX_write_string(&FontT24, &t7cY0free, text, 1); | |
| 3022 | |
| 3023 t7cY0free.WindowY0 -= 52; | |
| 3024 // 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)); | |
| 3025 snprintf(text,60, | |
| 3026 "%0.2f\n\r" | |
| 3027 "%0.2f %u%%\n\r" | |
| 3028 "%u" | |
| 3029 ,stateUsed->lifeData.pressure_ambient_bar | |
| 3030 ,stateUsed->lifeData.pressure_surface_bar | |
| 3031 ,settingsGetPointer()->salinity | |
| 3032 ,stateUsed->lifeData.counterSecondsShallowDepth); | |
| 3033 GFX_write_string(&FontT42, &t7cY0free, text, 1); | |
| 3034 } | |
| 3035 | |
| 3036 | |
| 3037 void t7_SummaryOfLeftCorner(void) | |
| 3038 { | |
| 3039 char text[256+60]; | |
| 3040 uint8_t textpointer = 0; | |
| 3041 | |
| 3042 const SDecoinfo * pDecoinfoStandard; | |
| 3043 const SDecoinfo * pDecoinfoFuture; | |
| 3044 float fCNS; | |
| 3045 | |
| 3046 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
| 3047 { | |
| 3048 pDecoinfoStandard = &stateUsed->decolistBuehlmann; | |
| 3049 pDecoinfoFuture = &stateUsed->decolistFutureBuehlmann; | |
| 3050 } | |
| 3051 else | |
| 3052 { | |
| 3053 pDecoinfoStandard = &stateUsed->decolistVPM; | |
| 3054 pDecoinfoFuture = &stateUsed->decolistFutureVPM; | |
| 3055 } | |
| 3056 | |
| 3057 fCNS = stateUsed->lifeData .cns; | |
| 3058 if(fCNS > 999) | |
| 3059 fCNS = 999; | |
| 3060 | |
| 3061 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; | |
| 3062 t7cY0free.WindowLineSpacing = 48; | |
| 3063 t7cY0free.WindowNumberOfTextLines = 6; | |
| 3064 t7cY0free.WindowTab = 420; | |
| 3065 | |
| 3066 // header | |
| 3067 textpointer = 0; | |
| 3068 text[textpointer++] = '\032'; | |
| 3069 text[textpointer++] = '\016'; | |
| 3070 text[textpointer++] = '\016'; | |
| 3071 text[textpointer++] = TXT_ppO2; | |
| 3072 text[textpointer++] = '\n'; | |
| 3073 text[textpointer++] = '\r'; | |
| 3074 text[textpointer++] = TXT_Ceiling; | |
| 3075 text[textpointer++] = '\n'; | |
| 3076 text[textpointer++] = '\r'; | |
| 3077 text[textpointer++] = TXT_ActualGradient; | |
| 3078 text[textpointer++] = '\n'; | |
| 3079 text[textpointer++] = '\r'; | |
| 3080 text[textpointer++] = TXT_CNS; | |
| 3081 text[textpointer++] = '\n'; | |
| 3082 text[textpointer++] = '\r'; | |
| 3083 text[textpointer++] = TXT_FutureTTS; | |
| 3084 text[textpointer++] = '\017'; | |
| 3085 text[textpointer++] = 0; | |
| 3086 t7cY0free.WindowX0 += 10; | |
| 3087 t7cY0free.WindowY0 += 10; | |
| 3088 GFX_write_string(&FontT24, &t7cY0free, text, 1); | |
| 3089 t7cY0free.WindowX0 -= 10; | |
| 3090 t7cY0free.WindowY0 -= 10; | |
| 3091 | |
| 3092 textpointer = 0; | |
| 3093 text[textpointer++] = '\t'; | |
| 3094 textpointer += snprintf(&text[textpointer],10,"\020%01.2f", stateUsed->lifeData.ppO2); | |
| 3095 text[textpointer++] = '\n'; | |
| 3096 text[textpointer++] = '\r'; | |
| 3097 text[textpointer++] = '\t'; | |
| 3098 if((pDecoinfoStandard->output_ceiling_meter > 99.9f) || (settingsGetPointer()->nonMetricalSystem)) | |
| 3099 textpointer += snprintf(&text[textpointer],10,"\020%01.1f",unit_depth_float(pDecoinfoStandard->output_ceiling_meter)); | |
| 3100 else | |
| 3101 textpointer += snprintf(&text[textpointer],10,"\020%01.0f",pDecoinfoStandard->output_ceiling_meter); | |
| 3102 text[textpointer++] = '\n'; | |
| 3103 text[textpointer++] = '\r'; | |
| 3104 text[textpointer++] = '\t'; | |
| 3105 textpointer += snprintf(&text[textpointer],10,"\020%.0f", 100 * pDecoinfoStandard->output_relative_gradient); | |
| 3106 text[textpointer++] = '\n'; | |
| 3107 text[textpointer++] = '\r'; | |
| 3108 text[textpointer++] = '\t'; | |
| 3109 textpointer += snprintf(&text[textpointer],10,"\020%.0f\016\016%%\017",fCNS); | |
| 3110 text[textpointer++] = '\n'; | |
| 3111 text[textpointer++] = '\r'; | |
| 3112 text[textpointer++] = '\t'; | |
| 3113 textpointer += snprintf(&text[textpointer],10,"\020%i'", pDecoinfoFuture->output_time_to_surface_seconds / 60); | |
| 3114 text[textpointer++] = 0; | |
|
196
2885628ab3ba
Bugfix, minor: color the overview customview correctly
Jan Mulder <jlmulder@xs4all.nl>
parents:
193
diff
changeset
|
3115 t7_colorscheme_mod(text); |
| 38 | 3116 GFX_write_string(&FontT42, &t7cY0free, text, 1); |
| 3117 } | |
| 3118 | |
| 3119 | |
| 3120 | |
| 3121 | |
| 3122 /* | |
| 3123 point_t start, change, stop; | |
| 3124 float value; | |
| 3125 uint16_t front; | |
| 3126 uint8_t color; | |
| 3127 | |
| 3128 | |
| 3129 start.y = t7cH.WindowY0 - 5; | |
| 3130 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
| 3131 stop.x = start.x + CUSTOMBOX_SPACE_INSIDE; | |
| 3132 | |
| 3133 | |
| 3134 for(int i=0;i<16;i++) | |
| 3135 { | |
| 3136 stop.y = start.y; | |
| 3137 change.y = start.y; | |
| 3138 | |
| 3139 value = pState->lifeData.tissue_nitrogen_bar[i] - 0.7512f; | |
| 3140 value *= 20; | |
| 3141 | |
| 3142 if(value < 0) | |
| 3143 front = 0; | |
| 3144 else | |
| 3145 if(value > CUSTOMBOX_SPACE_INSIDE) | |
| 3146 front = CUSTOMBOX_SPACE_INSIDE; | |
| 3147 else | |
| 3148 front = (uint16_t)value; | |
| 3149 | |
| 3150 change.x = start.x + front; | |
| 3151 if(change.x != start.x) | |
| 3152 GFX_draw_thick_line(1,&t7screen, start, change, CLUT_Font020); | |
| 3153 if(change.x != stop.x) | |
| 3154 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font021); | |
| 3155 | |
| 3156 start.y -= 3; | |
| 3157 } | |
| 3158 | |
| 3159 // He | |
| 3160 start.y -= 28 + 14; | |
| 3161 for(int i=0;i<16;i++) | |
| 3162 { | |
| 3163 stop.y = start.y; | |
| 3164 change.y = start.y; | |
| 3165 | |
| 3166 value = pState->lifeData.tissue_helium_bar[i]; | |
| 3167 value *= 20; | |
| 3168 | |
| 3169 if(value < 0) | |
| 3170 front = 0; | |
| 3171 else | |
| 3172 if(value > CUSTOMBOX_SPACE_INSIDE) | |
| 3173 front = CUSTOMBOX_SPACE_INSIDE; | |
| 3174 else | |
| 3175 front = (uint16_t)value; | |
| 3176 | |
| 3177 change.x = start.x + front; | |
| 3178 if(change.x != start.x) | |
| 3179 GFX_draw_thick_line(1,&t7screen, start, change, CLUT_Font020); | |
| 3180 if(change.x != stop.x) | |
| 3181 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font021); | |
| 3182 | |
| 3183 start.y -= 3; | |
| 3184 } | |
| 3185 | |
| 3186 // CNS == Oxygen | |
| 3187 start.y -= 28 + 14; | |
| 3188 | |
| 3189 value = pState->lifeData.cns; | |
| 3190 value *= (CUSTOMBOX_SPACE_INSIDE/2); | |
| 3191 value /= 100; | |
| 3192 | |
| 3193 if(value < 0) | |
| 3194 front = 0; | |
| 3195 else | |
| 3196 if(value > CUSTOMBOX_SPACE_INSIDE) | |
| 3197 front = CUSTOMBOX_SPACE_INSIDE; | |
| 3198 else | |
| 3199 front = (uint16_t)value; | |
| 3200 | |
| 3201 if(pState->lifeData.cns < 95) | |
| 3202 color = CLUT_Font020; | |
| 3203 else | |
| 3204 if(pState->lifeData.cns < 100) | |
| 3205 color = CLUT_WarningYellow; | |
| 3206 else | |
| 3207 color = CLUT_WarningRed; | |
| 3208 | |
| 3209 for(int i=0;i<16;i++) | |
| 3210 { | |
| 3211 stop.y = start.y; | |
| 3212 change.y = start.y; | |
| 3213 | |
| 3214 change.x = start.x + front; | |
| 3215 if(change.x != start.x) | |
| 3216 GFX_draw_thick_line(1,&t7screen, start, change, color); | |
| 3217 if(change.x != stop.x) | |
| 3218 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font021); | |
| 3219 | |
| 3220 start.y -= 3; | |
| 3221 } | |
| 3222 | |
| 3223 // where is the onload/offload limit for N2 and He | |
| 3224 decom_get_inert_gases(pState->lifeData.pressure_ambient_bar, &pState->lifeData.actualGas, &percent_N2, &percent_He); | |
| 3225 partial_pressure_N2 = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_N2; | |
| 3226 partial_pressure_He = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_He; | |
| 3227 | |
| 3228 if((percent_N2 > 0) && (partial_pressure_N2 > (0.8f + 0.5f))) | |
| 3229 { | |
| 3230 start.y = t7cH.WindowY0 + 1 - 5; | |
| 3231 stop.y = start.y - (3 * 15) - 1; | |
| 3232 | |
| 3233 value = partial_pressure_N2; | |
| 3234 value *= 20; | |
| 3235 | |
| 3236 if(value < 0) | |
| 3237 front = 3; | |
| 3238 else | |
| 3239 if(value + 5 > CUSTOMBOX_SPACE_INSIDE) | |
| 3240 front = CUSTOMBOX_SPACE_INSIDE - 3; | |
| 3241 else | |
| 3242 front = (uint16_t)value; | |
| 3243 | |
| 3244 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + front; | |
| 3245 stop.x = start.x; | |
| 3246 GFX_draw_thick_line(2,&t7screen, start, stop, CLUT_EverythingOkayGreen); | |
| 3247 } | |
| 3248 | |
| 3249 if((percent_He > 0) && (partial_pressure_He > 0.5f)) | |
| 3250 { | |
| 3251 start.y = t7cH.WindowY0 + 1 - 5 - 3*16 - 28 - 14; | |
| 3252 stop.y = start.y - (3 * 15) - 1; | |
| 3253 | |
| 3254 value = partial_pressure_He; | |
| 3255 value *= 20; | |
| 3256 | |
| 3257 if(value < 0) | |
| 3258 front = 3; | |
| 3259 else | |
| 3260 if(value + 5 > CUSTOMBOX_SPACE_INSIDE) | |
| 3261 front = CUSTOMBOX_SPACE_INSIDE - 3; | |
| 3262 else | |
| 3263 front = (uint16_t)value; | |
| 3264 | |
| 3265 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + front; | |
| 3266 stop.x = start.x; | |
| 3267 GFX_draw_thick_line(2,&t7screen, start, stop, CLUT_EverythingOkayGreen); | |
| 3268 } | |
| 3269 | |
| 3270 start.y = t7cH.WindowY0 + 1 - 5 - 6*16 - 2*28 - 2*14; | |
| 3271 stop.y = start.y - (3 * 15) - 1; | |
| 3272 | |
| 3273 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + CUSTOMBOX_SPACE_INSIDE/2; | |
| 3274 stop.x = start.x; | |
| 3275 GFX_draw_thick_line(2, &t7screen, start, stop, CLUT_WarningRed); | |
| 3276 */ | |
| 3277 | |
| 3278 /* | |
| 3279 void t7_clock(void) | |
| 3280 { | |
| 3281 point_t start, stop; | |
| 3282 | |
| 3283 | |
| 3284 for(uint16_t i=0;i<360;i+=30) | |
| 3285 { | |
| 3286 start = t7_compass_circle(1,i); | |
| 3287 stop = t7_compass_circle(2,i); | |
| 3288 start.x += 280; // standard center is 400, 250 | |
| 3289 stop.x += 280; | |
| 3290 GFX_draw_thick_line(5,&t7screen, start, stop, CLUT_CompassSubTick); | |
| 3291 | |
| 3292 start.x = 400+280; | |
| 3293 start.y = 250; | |
| 3294 stop = t7_compass_circle(2,58); | |
| 3295 stop.x += 280; | |
| 3296 GFX_draw_thick_line(3,&t7screen, start, stop, CLUT_CompassNorthTick); | |
| 3297 stop = t7_compass_circle(0,302); | |
| 3298 stop.x += 280; | |
| 3299 GFX_draw_thick_line(3,&t7screen, start, stop, CLUT_CompassNorthTick); | |
| 3300 } | |
| 3301 } | |
| 3302 */ | |
| 3303 | |
| 3304 //static float testCC = 180; | |
| 3305 void t7_compass(uint16_t ActualHeading, uint16_t UserSetHeading) | |
| 3306 { | |
| 3307 | |
| 3308 /* | |
| 3309 static uint16_t lastHeading = 0; | |
| 3310 float differenceCompass, resultKalman; | |
| 3311 | |
| 3312 if(testCC > lastHeading) | |
| 3313 differenceCompass = testCC - lastHeading; | |
| 3314 else | |
| 3315 differenceCompass = lastHeading - testCC; | |
| 3316 | |
| 3317 resultKalman = Kalman_getAngle(differenceCompass, 2, 0.1); | |
| 3318 if(testCC > lastHeading) | |
| 3319 ActualHeading = lastHeading + resultKalman; | |
| 3320 else | |
| 3321 ActualHeading = lastHeading - resultKalman; | |
| 3322 | |
| 3323 lastHeading = ActualHeading; | |
| 3324 */ | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3325 uint16_t ActualHeadingRose; |
| 38 | 3326 uint16_t LeftBorderHeading, LineHeading; |
| 3327 uint32_t offsetPicture; | |
| 3328 point_t start, stop, center; | |
| 3329 static int32_t LastHeading = 0; | |
| 3330 int32_t newHeading = 0; | |
| 3331 int32_t diff = 0; | |
| 3332 int32_t diff2 = 0; | |
| 3333 | |
| 3334 int32_t diffAbs = 0; | |
| 3335 int32_t diffAbs2 = 0; | |
| 3336 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3337 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3338 pSettings = settingsGetPointer(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3339 |
| 38 | 3340 newHeading = ActualHeading; |
| 3341 | |
| 3342 diff = newHeading - LastHeading; | |
| 3343 | |
| 3344 if(newHeading < LastHeading) | |
| 3345 diff2 = newHeading + 360 - LastHeading; | |
| 3346 else | |
| 3347 diff2 = newHeading - 360 - LastHeading; | |
| 3348 | |
| 3349 diffAbs = diff; | |
| 3350 if(diffAbs < 0) | |
| 3351 diffAbs *= -1; | |
| 3352 | |
| 3353 diffAbs2 = diff2; | |
| 3354 if(diffAbs2 < 0) | |
| 3355 diffAbs2 *= -1; | |
| 3356 | |
| 3357 | |
| 3358 if(diffAbs <= diffAbs2) | |
| 3359 newHeading = LastHeading + (diff / 2); | |
| 3360 else | |
| 3361 newHeading = LastHeading + (diff2 / 2); | |
| 3362 | |
| 3363 if(newHeading < 0) | |
| 3364 newHeading += 360; | |
| 3365 else | |
| 3366 if(newHeading >= 360) | |
| 3367 newHeading -= 360; | |
| 3368 | |
| 3369 LastHeading = newHeading; | |
| 3370 ActualHeading = newHeading; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3371 ActualHeadingRose = ActualHeading; |
| 38 | 3372 /* |
| 3373 if (ActualHeading < 90) | |
| 3374 ActualHeading += 360; | |
| 3375 | |
| 3376 if(ActualHeading > LastHeading) | |
| 3377 { | |
| 3378 if((ActualHeading - LastHeading) < 25) | |
| 3379 ActualHeading = LastHeading + 1; | |
| 3380 } | |
| 3381 else | |
| 3382 if(ActualHeading < LastHeading) | |
| 3383 { | |
| 3384 if((LastHeading - ActualHeading) < 25) | |
| 3385 ActualHeading = LastHeading - 1; | |
| 3386 } | |
| 3387 */ | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3388 if(pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3389 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3390 ActualHeadingRose = 360 - ActualHeadingRose; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3391 if (ActualHeadingRose < 170) ActualHeadingRose += 360; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3392 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3393 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3394 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3395 if (ActualHeadingRose < 90) ActualHeadingRose += 360; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3396 ActualHeading = ActualHeadingRose; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3397 } |
| 38 | 3398 |
| 3399 // new hw 160822 | |
| 3400 // if (ActualHeading >= 360 + 90) | |
| 3401 // ActualHeading = 360; | |
| 3402 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3403 LeftBorderHeading = 2 * (ActualHeadingRose - (CUSTOMBOX_SPACE_INSIDE/4)); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3404 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3405 if(pSettings->FlipDisplay) /* add offset caused by mirrowed drawing */ |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3406 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3407 LeftBorderHeading += 2 * 80; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3408 } |
| 38 | 3409 |
| 3410 offsetPicture = LeftBorderHeading * t7screenCompass.ImageHeight * 2; | |
| 3411 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3412 /* the background is used to draw the rotating compass rose */ |
| 38 | 3413 background.pointer = t7screenCompass.FBStartAdress+offsetPicture; |
| 3414 background.x0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3415 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3416 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3417 background.y0 = 65; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3418 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3419 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3420 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3421 background.y0 = 480 - t7screenCompass.ImageHeight - 65; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3422 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3423 |
| 38 | 3424 background.width = CUSTOMBOX_SPACE_INSIDE; |
| 3425 background.height = t7screenCompass.ImageHeight; | |
| 3426 | |
| 3427 | |
| 3428 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + (CUSTOMBOX_SPACE_INSIDE/2); | |
| 3429 stop.x = start.x; | |
| 3430 start.y = 65; | |
| 3431 stop.y = start.y + 55; | |
| 3432 GFX_draw_line(&t7screen, start, stop, CLUT_Font030); | |
| 3433 | |
| 3434 | |
| 3435 center.x = start.x; | |
| 3436 center.y = 300; | |
| 3437 | |
| 3438 stop.x = center.x + 44; | |
| 3439 stop.y = center.y + 24; | |
| 3440 | |
| 3441 | |
| 3442 while(ActualHeading > 359) ActualHeading -= 360; | |
| 3443 | |
| 3444 LineHeading = 360 - ActualHeading; | |
| 3445 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(0,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font030); // North | |
| 3446 LineHeading += 90; | |
| 3447 if(LineHeading > 359) LineHeading -= 360; | |
| 3448 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); // Maintick | |
| 3449 LineHeading += 90; | |
| 3450 if(LineHeading > 359) LineHeading -= 360; | |
| 3451 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
| 3452 LineHeading += 90; | |
| 3453 if(LineHeading > 359) LineHeading -= 360; | |
| 3454 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
| 3455 | |
| 3456 LineHeading = 360 - ActualHeading; | |
| 3457 LineHeading += 45; | |
| 3458 if(LineHeading > 359) LineHeading -= 360; | |
| 3459 GFX_draw_thick_line(5,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); // Subtick | |
| 3460 LineHeading += 90; | |
| 3461 if(LineHeading > 359) LineHeading -= 360; | |
| 3462 GFX_draw_thick_line(5,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
| 3463 LineHeading += 90; | |
| 3464 if(LineHeading > 359) LineHeading -= 360; | |
| 3465 GFX_draw_thick_line(5,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
| 3466 LineHeading += 90; | |
| 3467 if(LineHeading > 359) LineHeading -= 360; | |
| 3468 GFX_draw_thick_line(5,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
| 3469 | |
| 3470 LineHeading = 360 - ActualHeading; | |
| 3471 LineHeading += 22; | |
| 3472 if(LineHeading > 359) LineHeading -= 360; | |
| 3473 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); // Subtick | |
| 3474 LineHeading += 45; | |
| 3475 if(LineHeading > 359) LineHeading -= 360; | |
| 3476 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
| 3477 LineHeading += 45; | |
| 3478 if(LineHeading > 359) LineHeading -= 360; | |
| 3479 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
| 3480 LineHeading += 45; | |
| 3481 if(LineHeading > 359) LineHeading -= 360; | |
| 3482 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
| 3483 LineHeading += 45; | |
| 3484 if(LineHeading > 359) LineHeading -= 360; | |
| 3485 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); // Subtick | |
| 3486 LineHeading += 45; | |
| 3487 if(LineHeading > 359) LineHeading -= 360; | |
| 3488 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
| 3489 LineHeading += 45; | |
| 3490 if(LineHeading > 359) LineHeading -= 360; | |
| 3491 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
| 3492 LineHeading += 45; | |
| 3493 if(LineHeading > 359) LineHeading -= 360; | |
| 3494 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); | |
| 3495 | |
| 3496 if(UserSetHeading) | |
| 3497 { | |
| 3498 LineHeading = UserSetHeading + 360 - ActualHeading; | |
| 3499 if(LineHeading > 359) LineHeading -= 360; | |
| 3500 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(3,LineHeading), t7_compass_circle(2,LineHeading), CLUT_CompassUserHeadingTick); | |
| 3501 | |
| 3502 // R�ckpeilung, User Back Heading | |
| 3503 LineHeading = UserSetHeading + 360 + 180 - ActualHeading; | |
| 3504 if(LineHeading > 359) LineHeading -= 360; | |
| 3505 if(LineHeading > 359) LineHeading -= 360; | |
| 3506 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(3,LineHeading), t7_compass_circle(2,LineHeading), CLUT_CompassUserBackHeadingTick); | |
| 3507 } | |
| 3508 | |
| 3509 center.x = start.x; | |
| 3510 center.y = 250; | |
| 3511 GFX_draw_circle(&t7screen, center, 116, CLUT_Font030); | |
| 3512 GFX_draw_circle(&t7screen, center, 118, CLUT_Font030); | |
| 3513 GFX_draw_circle(&t7screen, center, 117, CLUT_Font030); | |
| 3514 | |
| 3515 | |
| 3516 } | |
| 3517 | |
| 3518 | |
| 3519 /* Font_T42: N is 27 px, S is 20 px, W is 36 px, E is 23 px | |
| 3520 * max is NW with 63 px | |
| 3521 * Font_T24: N is 15 px, S is 12 px, W is 20 px, E is 13 px | |
| 3522 * max is NW with 35 px | |
| 3523 * NE is 28 px | |
| 3524 * SW is 32 px | |
| 3525 * SE is 25 px | |
| 3526 * space between each is 45 px * 2 | |
| 3527 * FirstItem List | |
| 3528 * \177 \177 prepare for size | |
| 3529 */ | |
| 3530 void init_t7_compass(void) | |
| 3531 { | |
| 3532 t7screenCompass.FBStartAdress = getFrame(21); | |
| 3533 | |
| 3534 char text[256]; | |
| 3535 uint8_t textpointer = 0; | |
| 3536 | |
| 3537 text[textpointer++] = '\030'; | |
| 3538 text[textpointer++] = '\177'; | |
| 3539 text[textpointer++] = '\177'; | |
| 3540 text[textpointer++] = 76; // 90 - 14 | |
| 3541 text[textpointer++] = '\016'; | |
| 3542 text[textpointer++] = '\016'; | |
| 3543 text[textpointer++] = 'N'; | |
| 3544 text[textpointer++] = 'E'; // 96 + 28 = 124 total | |
| 3545 text[textpointer++] = '\017'; | |
| 3546 text[textpointer++] = '\177'; | |
| 3547 text[textpointer++] = '\177'; | |
| 3548 text[textpointer++] = 64; // 90 - 14 - 12 | |
| 3549 text[textpointer++] = 'E'; // 124 + 74 + 23 = 221 total | |
| 3550 text[textpointer++] = '\177'; | |
| 3551 text[textpointer++] = '\177'; | |
| 3552 text[textpointer++] = 66; // 90 - 11 - 13 | |
| 3553 text[textpointer++] = '\016'; | |
| 3554 text[textpointer++] = '\016'; | |
| 3555 text[textpointer++] = 'S'; | |
| 3556 text[textpointer++] = 'E'; | |
| 3557 text[textpointer++] = '\017'; | |
| 3558 text[textpointer++] = '\177'; | |
| 3559 text[textpointer++] = '\177'; | |
| 3560 text[textpointer++] = 68; // 90 - 12 - 10 | |
| 3561 text[textpointer++] = 'S'; | |
| 3562 text[textpointer++] = '\177'; | |
| 3563 text[textpointer++] = '\177'; | |
| 3564 text[textpointer++] = 64; // 90 - 10 - 16 | |
| 3565 text[textpointer++] = '\016'; | |
| 3566 text[textpointer++] = '\016'; | |
| 3567 text[textpointer++] = 'S'; | |
| 3568 text[textpointer++] = 'W'; | |
| 3569 text[textpointer++] = '\017'; | |
| 3570 text[textpointer++] = '\177'; | |
| 3571 text[textpointer++] = '\177'; | |
| 3572 text[textpointer++] = 56; // 90 - 16 - 18 | |
| 3573 text[textpointer++] = 'W'; | |
| 3574 text[textpointer++] = '\177'; | |
| 3575 text[textpointer++] = '\177'; | |
| 3576 text[textpointer++] = 54; // 90 - 18 - 18 | |
| 3577 text[textpointer++] = '\016'; | |
| 3578 text[textpointer++] = '\016'; | |
| 3579 text[textpointer++] = 'N'; | |
| 3580 text[textpointer++] = 'W'; | |
| 3581 text[textpointer++] = '\017'; | |
| 3582 text[textpointer++] = '\177'; | |
| 3583 text[textpointer++] = '\177'; | |
| 3584 text[textpointer++] = 59; // 90 - 17 - 14 | |
| 3585 text[textpointer++] = 'N'; | |
| 3586 text[textpointer++] = '\177'; | |
| 3587 text[textpointer++] = '\177'; | |
| 3588 text[textpointer++] = 63; // 90 - 13 - 14 | |
| 3589 text[textpointer++] = '\016'; | |
| 3590 text[textpointer++] = '\016'; | |
| 3591 text[textpointer++] = 'N'; | |
| 3592 text[textpointer++] = 'E'; | |
| 3593 text[textpointer++] = '\017'; | |
| 3594 text[textpointer++] = '\177'; | |
| 3595 text[textpointer++] = '\177'; | |
| 3596 text[textpointer++] = 64; // 90 - 14 - 12 | |
| 3597 text[textpointer++] = 'E'; | |
| 3598 text[textpointer++] = '\177'; | |
| 3599 text[textpointer++] = '\177'; | |
| 3600 text[textpointer++] = 66; // 90 - 11 - 13 | |
| 3601 text[textpointer++] = '\016'; | |
| 3602 text[textpointer++] = '\016'; | |
| 3603 text[textpointer++] = 'S'; | |
| 3604 text[textpointer++] = 'E'; | |
| 3605 text[textpointer++] = '\017'; | |
| 3606 text[textpointer++] = '\177'; | |
| 3607 text[textpointer++] = '\177'; | |
| 3608 text[textpointer++] = 68; // 90 - 12 - 10 | |
| 3609 text[textpointer++] = 'S'; | |
| 3610 text[textpointer++] = '\177'; | |
| 3611 text[textpointer++] = '\177'; | |
| 3612 text[textpointer++] = 64; // 90 - 10 - 16 | |
| 3613 text[textpointer++] = '\016'; | |
| 3614 text[textpointer++] = '\016'; | |
| 3615 text[textpointer++] = 'S'; | |
| 3616 text[textpointer++] = 'W'; | |
| 3617 text[textpointer++] = '\017'; | |
| 3618 text[textpointer++] = 0; // end | |
| 3619 | |
| 3620 GFX_write_string(&FontT42,&t7pCompass,text,1); | |
| 3621 | |
| 3622 releaseAllFramesExcept(21,t7screenCompass.FBStartAdress); | |
| 3623 } | |
| 3624 | |
| 3625 | |
| 3626 void t7_miniLiveLogProfile(void) | |
| 3627 { | |
| 3628 SWindowGimpStyle wintemp; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3629 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3630 pSettings = settingsGetPointer(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3631 |
| 38 | 3632 wintemp.left = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; |
| 3633 wintemp.right = wintemp.left + CUSTOMBOX_SPACE_INSIDE; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3634 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3635 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3636 wintemp.top = 480 - t7l1.WindowY0; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3637 wintemp.bottom = wintemp. top + 200; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3638 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3639 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3640 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3641 wintemp.top = t7l1.WindowY1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3642 wintemp.bottom = wintemp. top + 200; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3643 } |
| 38 | 3644 |
| 3645 uint16_t max_depth = (uint16_t)(stateUsed->lifeData.max_depth_meter * 10); | |
| 3646 | |
| 3647 GFX_graph_print(&t7screen, &wintemp, 0,1,0, max_depth, getMiniLiveLogbookPointerToData(), getMiniLiveLogbookActualDataLength(), CLUT_Font030, NULL); | |
| 3648 } | |
| 3649 | |
| 3650 void t7_logo_OSTC(void) | |
| 3651 { | |
| 3652 SWindowGimpStyle windowGimp; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3653 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3654 pSettings = settingsGetPointer(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3655 |
| 38 | 3656 /* OSTC logo */ |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3657 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3658 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3659 windowGimp.left = t7l1.WindowX1 + 32; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3660 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3661 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3662 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3663 windowGimp.left = t7r1.WindowX1 + 32; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3664 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
3665 |
| 38 | 3666 windowGimp.top = 40 + 32; |
| 3667 GFX_draw_image_monochrome(&t7screen, windowGimp, &ImgOSTC, 0); | |
| 3668 } |
