Mercurial > public > ostc4
annotate Discovery/Src/t3.c @ 174:ecb71521d004 max-depth
Bugfix: make max depth move with current depth (part 2)
Step 2 of the fix as introduced in the previous commit. Now we have
a smart averaging depth import from the RTE, we do not need to average
close to display time. So, simply kick out this logic here.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
| author | Jan Mulder <jlmulder@xs4all.nl> |
|---|---|
| date | Mon, 11 Mar 2019 19:54:20 +0100 |
| parents | 255eedad4155 |
| children | 8b8074080d7b |
| rev | line source |
|---|---|
| 38 | 1 /////////////////////////////////////////////////////////////////////////////// |
| 2 /// -*- coding: UTF-8 -*- | |
| 3 /// | |
| 4 /// \file Discovery/Src/t3.c | |
| 5 /// \brief Main Template file for dive mode special scree t3 | |
| 6 /// \author Heinrichs Weikamp gmbh | |
| 7 /// \date 10-Nov-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 "t3.h" | |
| 31 | |
| 32 #include "data_exchange_main.h" | |
| 33 #include "decom.h" | |
| 34 #include "gfx_fonts.h" | |
| 35 #include "math.h" | |
| 36 #include "tHome.h" | |
| 37 #include "timer.h" | |
| 38 #include "unit.h" | |
| 39 | |
| 40 //* Importend function prototypes ---------------------------------------------*/ | |
| 41 extern uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium); | |
| 42 | |
| 43 /* Exported variables --------------------------------------------------------*/ | |
| 44 | |
| 45 const uint16_t BigFontSeperationLeftRight = 399; | |
| 46 const uint16_t BigFontSeperationTopBottom = 240; | |
| 47 | |
| 48 /* Private variables ---------------------------------------------------------*/ | |
| 49 GFX_DrawCfgScreen t3screen; | |
| 50 GFX_DrawCfgWindow t3l1; | |
| 51 GFX_DrawCfgWindow t3r1; | |
| 52 GFX_DrawCfgWindow t3c1; | |
| 53 GFX_DrawCfgWindow t3c2; | |
| 54 | |
| 55 extern float temperatureLastCall[3]; | |
| 56 extern uint8_t idTemperatureLastCall; | |
| 57 | |
| 58 uint8_t t3_selection_customview = 0; | |
| 59 | |
| 60 /* TEM HAS TO MOVE TO GLOBAL--------------------------------------------------*/ | |
| 61 | |
| 62 /* Private types -------------------------------------------------------------*/ | |
| 63 #define TEXTSIZE 16 | |
| 64 | |
| 65 const uint8_t t3_customviewsStandard[] = | |
| 66 { | |
| 67 CVIEW_T3_Decostop, | |
| 68 CVIEW_sensors, | |
| 69 CVIEW_Compass, | |
| 70 CVIEW_T3_MaxDepth, | |
| 71 CVIEW_T3_StopWatch, | |
| 72 CVIEW_T3_TTS, | |
| 73 CVIEW_T3_ppO2andGas, | |
| 74 CVIEW_T3_END | |
| 75 }; | |
| 76 | |
| 77 | |
| 78 const uint8_t *t3_customviews = t3_customviewsStandard; | |
| 79 | |
| 80 /* Private function prototypes -----------------------------------------------*/ | |
| 81 void t3_refresh_divemode(void); | |
| 82 | |
| 83 uint8_t t3_test_customview_warnings(void); | |
| 84 void t3_refresh_customview(float depth); | |
| 85 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, uint16_t ActualHeading, uint16_t UserSetHeading); | |
| 86 | |
| 87 /* Exported functions --------------------------------------------------------*/ | |
| 88 | |
| 89 void t3_init(void) | |
| 90 { | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
91 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
92 pSettings = settingsGetPointer(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
93 |
| 38 | 94 t3_selection_customview = t3_customviews[0]; |
| 95 | |
| 96 t3screen.FBStartAdress = 0; | |
| 97 t3screen.ImageHeight = 480; | |
| 98 t3screen.ImageWidth = 800; | |
| 99 t3screen.LayerIndex = 1; | |
| 100 | |
| 101 t3l1.Image = &t3screen; | |
| 102 t3l1.WindowNumberOfTextLines = 2; | |
| 103 t3l1.WindowLineSpacing = 19; // Abstand von Y0 | |
| 104 t3l1.WindowTab = 100; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
105 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
106 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
107 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
108 t3l1.WindowX0 = 0; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
109 t3l1.WindowX1 = BigFontSeperationLeftRight - 5; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
110 t3l1.WindowY0 = BigFontSeperationTopBottom + 5; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
111 t3l1.WindowY1 = 479; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
112 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
113 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
114 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
115 t3l1.WindowX0 = 800 - BigFontSeperationLeftRight + 5; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
116 t3l1.WindowX1 = 799; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
117 t3l1.WindowY0 = 0; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
118 t3l1.WindowY1 = 479 - BigFontSeperationTopBottom + 5 ; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
119 } |
| 38 | 120 |
| 121 t3r1.Image = &t3screen; | |
| 122 t3r1.WindowNumberOfTextLines = t3l1.WindowNumberOfTextLines; | |
| 123 t3r1.WindowLineSpacing = t3l1.WindowLineSpacing; | |
| 124 t3r1.WindowTab = t3l1.WindowTab; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
125 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
126 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
127 t3r1.WindowX0 = BigFontSeperationLeftRight + 5; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
128 t3r1.WindowX1 = 799; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
129 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
130 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
131 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
132 t3r1.WindowX0 = 0; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
133 t3r1.WindowX1 = BigFontSeperationLeftRight - 5; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
134 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
135 |
| 38 | 136 t3r1.WindowY0 = t3l1.WindowY0; |
| 137 t3r1.WindowY1 = t3l1.WindowY1; | |
| 138 | |
| 139 t3c1.Image = &t3screen; | |
| 140 t3c1.WindowNumberOfTextLines = 2; | |
| 141 t3c1.WindowLineSpacing = t3l1.WindowLineSpacing; | |
| 142 t3c1.WindowX0 = 0; | |
| 143 t3c1.WindowX1 = 799; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
144 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
145 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
146 t3c1.WindowY0 = 0; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
147 t3c1.WindowY1 = BigFontSeperationTopBottom - 5; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
148 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
149 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
150 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
151 t3c1.WindowY0 = 480 - BigFontSeperationTopBottom + 5; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
152 t3c1.WindowY1 = 479; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
153 } |
| 38 | 154 |
| 155 t3c2.Image = &t3screen; | |
| 156 t3c2.WindowNumberOfTextLines = 3; | |
| 157 t3c2.WindowLineSpacing = 58; | |
| 158 t3c2.WindowX0 = 370; | |
| 159 t3c2.WindowX1 = 799; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
160 t3c2.WindowY0 = t3c1.WindowY0; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
161 t3c2.WindowY1 = t3c1.WindowY1; |
| 38 | 162 t3c2.WindowTab = 600; |
| 163 } | |
| 164 | |
| 165 | |
| 166 void t3_refresh(void) | |
| 167 { | |
| 168 SStateList status; | |
| 169 get_globalStateList(&status); | |
| 170 | |
| 171 if(stateUsed->mode != MODE_DIVE) | |
| 172 { | |
| 173 settingsGetPointer()->design = 7; | |
| 174 return; | |
| 175 } | |
| 176 | |
| 177 if(status.base != BaseHome) | |
| 178 return; | |
| 179 | |
| 180 t3screen.FBStartAdress = getFrame(24); | |
| 181 t3_refresh_divemode(); | |
|
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
182 GFX_SetFramesTopBottom(t3screen.FBStartAdress, 0,480); |
| 38 | 183 releaseAllFramesExcept(24,t3screen.FBStartAdress); |
| 184 } | |
| 185 | |
| 186 | |
| 187 /* Private functions ---------------------------------------------------------*/ | |
| 188 | |
| 189 float t3_basics_lines_depth_and_divetime(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode) | |
| 190 { | |
| 191 char text[512]; | |
| 192 uint8_t color; | |
| 193 uint8_t depthChangeRate; | |
| 194 uint8_t depthChangeAscent; | |
| 195 point_t start, stop, startZeroLine; | |
| 196 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
197 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
198 pSettings = settingsGetPointer(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
199 |
| 38 | 200 start.x = 0; |
| 201 stop.x = 799; | |
| 202 stop.y = start.y = BigFontSeperationTopBottom; | |
| 203 GFX_draw_line(tXscreen, start, stop, CLUT_Font020); | |
| 204 | |
| 205 start.y = BigFontSeperationTopBottom; | |
| 206 stop.y = 479; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
207 |
| 38 | 208 stop.x = start.x = BigFontSeperationLeftRight; |
| 209 GFX_draw_line(tXscreen, start, stop, CLUT_Font020); | |
| 210 | |
| 211 /* depth */ | |
|
174
ecb71521d004
Bugfix: make max depth move with current depth (part 2)
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
212 float depth = unit_depth_float(stateUsed->lifeData.depth_meter); |
| 38 | 213 |
| 214 if(depth <= 0.3f) | |
| 215 depth = 0; | |
| 216 | |
| 217 if(settingsGetPointer()->nonMetricalSystem) | |
| 218 snprintf(text,TEXTSIZE,"\032\f[feet]"); | |
| 219 else | |
| 220 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Depth); | |
| 221 GFX_write_string(&FontT42,tXl1,text,0); | |
| 222 | |
| 223 if( ((mode == DIVEMODE_Apnea) && ((stateUsed->lifeData.ascent_rate_meter_per_min > 4) || (stateUsed->lifeData.ascent_rate_meter_per_min < -4 ))) | |
| 224 || ((mode != DIVEMODE_Apnea) && ((stateUsed->lifeData.ascent_rate_meter_per_min > 8) || (stateUsed->lifeData.ascent_rate_meter_per_min < -10))) | |
| 225 ) | |
| 226 { | |
| 227 snprintf(text,TEXTSIZE,"\f\002%.0f %c%c/min " | |
| 228 , unit_depth_float(stateUsed->lifeData.ascent_rate_meter_per_min) | |
| 229 , unit_depth_char1() | |
| 230 , unit_depth_char2() | |
| 231 ); | |
| 232 GFX_write_string(&FontT42,tXl1,text,0); | |
| 233 } | |
| 234 | |
| 235 if( depth < 100) | |
| 236 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",depth); | |
| 237 else | |
| 238 snprintf(text,TEXTSIZE,"\020\003\016%01.0f",depth); | |
| 239 | |
| 240 t3_basics_colorscheme_mod(text); | |
| 241 GFX_write_string(&FontT105,tXl1,text,1); | |
| 242 | |
| 243 | |
| 244 /* ascentrate graph */ | |
| 245 if(mode == DIVEMODE_Apnea) | |
| 246 { | |
| 247 /* ascentrate graph - apnea mode */ | |
| 248 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) | |
| 249 { | |
| 250 depthChangeAscent = 1; | |
| 251 if(stateUsed->lifeData.ascent_rate_meter_per_min < 200) | |
| 252 depthChangeRate = (uint8_t)stateUsed->lifeData.ascent_rate_meter_per_min; | |
| 253 else | |
| 254 depthChangeRate = 200; | |
| 255 } | |
| 256 else | |
| 257 { | |
| 258 depthChangeAscent = 0; | |
| 259 if(stateUsed->lifeData.ascent_rate_meter_per_min > -200) | |
| 260 depthChangeRate = (uint8_t)(0 - stateUsed->lifeData.ascent_rate_meter_per_min); | |
| 261 else | |
| 262 depthChangeRate = 200; | |
| 263 } | |
| 264 start.y = tXl1->WindowY0 - 1; | |
| 265 for(int i = 0; i<5;i++) | |
| 266 { | |
| 267 start.y += 40; | |
| 268 stop.y = start.y; | |
| 269 start.x = tXl1->WindowX1 - 1; | |
| 270 stop.x = start.x - 17; | |
| 271 | |
| 272 if(depthChangeRate <= 6) | |
| 273 { | |
| 274 if(i == 2) | |
| 275 { | |
| 276 startZeroLine.y = start.y; | |
| 277 stop.x = start.x - 34; | |
| 278 } | |
| 279 } | |
| 280 else | |
| 281 { | |
| 282 if(((i == 1) && depthChangeAscent) || ((i == 3) && !depthChangeAscent)) | |
| 283 { | |
| 284 startZeroLine.y = start.y; | |
| 285 stop.x = start.x - 34; | |
| 286 } | |
| 287 } | |
| 288 GFX_draw_line(tXscreen, start, stop, 0); | |
| 289 } | |
| 290 // new thick bar design Sept. 2015 | |
| 291 if((stateUsed->lifeData.ascent_rate_meter_per_min > 4) || (stateUsed->lifeData.ascent_rate_meter_per_min < -4)) | |
| 292 { | |
| 293 start.y = startZeroLine.y; | |
| 294 | |
| 295 if(depthChangeAscent) | |
| 296 { | |
| 297 color = CLUT_EverythingOkayGreen; | |
| 298 start.y += 7; // starte etwas weiter oben | |
| 299 stop.y = start.y + (uint16_t)(depthChangeRate * 4) - 9; // - x; // wegen der Liniendicke | |
| 300 if(stop.y > 475) | |
| 301 stop.y = 475; | |
| 302 } | |
| 303 else | |
| 304 { | |
| 305 color = CLUT_Font023; | |
| 306 start.y -= 7; | |
| 307 stop.y = start.y - (uint16_t)(depthChangeRate * 4) + 9; | |
| 308 if(stop.y <= tXl1->WindowY0) | |
| 309 stop.y = tXl1->WindowY0 + 1; | |
| 310 } | |
| 311 stop.x = start.x = tXl1->WindowX1 - 8; | |
| 312 GFX_draw_thick_line(12,tXscreen, start, stop, color); | |
| 313 } | |
| 314 } | |
| 315 else | |
| 316 { | |
| 317 /* ascentrate graph -standard mode */ | |
| 318 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) | |
| 319 { | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
320 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
321 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
322 start.y = tXl1->WindowY0 - 1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
323 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
324 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
325 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
326 start.y = tXl1->WindowY1 + 1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
327 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
328 |
| 38 | 329 for(int i = 0; i<4;i++) |
| 330 { | |
| 331 start.y += 5*8; | |
| 332 stop.y = start.y; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
333 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
334 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
335 start.x = tXl1->WindowX1 - 1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
336 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
337 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
338 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
339 start.x = tXr1->WindowX1 - 1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
340 } |
| 38 | 341 stop.x = start.x - 17; |
| 342 GFX_draw_line(tXscreen, start, stop, 0); | |
| 343 } | |
| 344 // new thick bar design Sept. 2015 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
345 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
346 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
347 start.x = tXl1->WindowX1 - 3 - 5; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
348 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
349 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
350 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
351 start.x = tXr1->WindowX1 - 3 - 5; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
352 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
353 |
| 38 | 354 stop.x = start.x; |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
355 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
356 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
357 start.y = tXl1->WindowY0 - 1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
358 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
359 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
360 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
361 start.y = tXl1->WindowY1 + 1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
362 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
363 |
| 38 | 364 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 8); |
| 365 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9 | |
| 366 if(stop.y >= 470) | |
| 367 stop.y = 470; | |
| 368 start.y += 7; // starte etwas weiter oben | |
| 369 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 10) | |
| 370 color = CLUT_EverythingOkayGreen; | |
| 371 else | |
| 372 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 15) | |
| 373 color = CLUT_WarningYellow; | |
| 374 else | |
| 375 color = CLUT_WarningRed; | |
| 376 | |
| 377 GFX_draw_thick_line(12,tXscreen, start, stop, color); | |
| 378 } | |
| 379 } | |
| 380 | |
| 381 // divetime | |
| 382 if(mode == DIVEMODE_Apnea) | |
| 383 { | |
| 384 if(stateUsed->lifeData.counterSecondsShallowDepth) | |
| 385 { | |
| 386 SDivetime SurfaceBreakTime = {0,0,0,0}; | |
| 387 | |
| 388 SurfaceBreakTime.Total = stateUsed->lifeData.counterSecondsShallowDepth; | |
| 389 SurfaceBreakTime.Minutes = SurfaceBreakTime.Total / 60; | |
| 390 SurfaceBreakTime.Seconds = SurfaceBreakTime.Total - (SurfaceBreakTime.Minutes * 60); | |
| 391 | |
| 392 snprintf(text,TEXTSIZE,"\032\f\002%c%c", TXT_2BYTE,TXT2BYTE_ApneaSurface); | |
| 393 GFX_write_string(&FontT42,tXr1,text,0); | |
| 394 | |
| 395 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",SurfaceBreakTime.Minutes, SurfaceBreakTime.Seconds); | |
| 396 } | |
| 397 else | |
| 398 { | |
| 399 SDivetime Divetime = {0,0,0, 0}; | |
| 400 | |
| 401 Divetime.Total = stateUsed->lifeData.dive_time_seconds; | |
| 402 Divetime.Minutes = Divetime.Total / 60; | |
| 403 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); | |
| 404 | |
| 405 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
| 406 GFX_write_string(&FontT42,tXr1,text,0); | |
| 407 | |
| 408 if(Divetime.Minutes < 100) | |
| 409 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds); | |
| 410 else | |
| 411 snprintf(text,TEXTSIZE,"\020\003\016\002%u'",Divetime.Minutes); | |
| 412 } | |
| 413 } | |
| 414 else | |
| 415 { | |
| 416 SDivetime Divetime = {0,0,0, 0}; | |
| 417 | |
| 418 Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; | |
| 419 Divetime.Minutes = Divetime.Total / 60; | |
| 420 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); | |
| 421 | |
| 422 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
| 423 GFX_write_string(&FontT42,tXr1,text,0); | |
| 424 | |
| 425 if(Divetime.Minutes < 100) | |
| 426 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds); | |
| 427 else | |
| 428 snprintf(text,TEXTSIZE,"\020\003\016\002%u'",Divetime.Minutes); | |
| 429 } | |
| 430 t3_basics_colorscheme_mod(text); | |
| 431 GFX_write_string(&FontT105,tXr1,text,1); | |
| 432 | |
| 433 return depth; | |
| 434 } | |
| 435 | |
| 436 | |
| 437 void t3_refresh_divemode(void) | |
| 438 { | |
| 439 uint8_t customview_warnings = 0; | |
| 440 float depth_meter = 0.0; | |
| 441 | |
| 442 // everything like lines, depth, ascent graph and divetime | |
| 443 depth_meter = t3_basics_lines_depth_and_divetime(&t3screen, &t3l1, &t3r1, 0); // 0 could be stateUsed->diveSettings.diveMode for CCR specials | |
| 444 | |
| 445 // customview | |
| 446 if(stateUsed->warnings.numWarnings) | |
| 447 customview_warnings = t3_test_customview_warnings(); | |
| 448 | |
| 449 if(customview_warnings && warning_count_high_time) | |
| 450 t3_basics_show_customview_warnings(&t3c1); | |
| 451 else | |
| 452 t3_refresh_customview(depth_meter); | |
| 453 | |
| 454 if(stateUsed->warnings.lowBattery) | |
| 455 t3_basics_battery_low_customview_extra(&t3c1); | |
| 456 } | |
| 457 | |
| 458 | |
| 459 void t3_basics_battery_low_customview_extra(GFX_DrawCfgWindow* tXc1) | |
| 460 { | |
| 461 char TextC1[256]; | |
| 462 | |
| 463 TextC1[0] = '\002'; | |
| 464 TextC1[1] = '\f'; | |
| 465 TextC1[2] = '\025'; | |
| 466 TextC1[3] = '3'; | |
| 467 TextC1[4] = '1'; | |
| 468 TextC1[5] = '1'; | |
| 469 TextC1[6] = '1'; | |
| 470 TextC1[7] = '1'; | |
| 471 TextC1[8] = '1'; | |
| 472 TextC1[9] = '1'; | |
| 473 TextC1[10] = '1'; | |
| 474 TextC1[11] = '1'; | |
| 475 TextC1[12] = '1'; | |
| 476 TextC1[13] = '1'; | |
| 477 TextC1[14] = '0'; | |
| 478 TextC1[15] = 0; | |
| 479 | |
| 480 if(!warning_count_high_time) | |
| 481 TextC1[4] = '2'; | |
| 482 | |
| 483 GFX_write_string(&Batt24,tXc1,TextC1,0); | |
| 484 } | |
| 485 | |
| 486 | |
| 487 | |
| 488 void t3_refresh_customview(float depth) | |
| 489 { | |
| 490 if((t3_selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) | |
| 491 t3_change_customview(); | |
| 492 | |
| 493 SDiveState * pDiveState; | |
| 494 | |
| 495 if(stateUsed == stateRealGetPointer()) | |
| 496 pDiveState = stateRealGetPointerWrite(); | |
| 497 else | |
| 498 pDiveState = stateSimGetPointerWrite(); | |
| 499 | |
| 500 t3_basics_refresh_customview(depth, t3_selection_customview, &t3screen, &t3c1, &t3c2, pDiveState->diveSettings.diveMode); | |
| 501 } | |
| 502 | |
| 503 | |
| 504 void t3_basics_refresh_apnoeRight(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) | |
| 505 { | |
| 506 char text[512]; | |
| 507 uint16_t textpointer = 0; | |
| 508 | |
| 509 // CVIEW_T3_Temperature | |
| 510 float temperatureThisCall; | |
| 511 float temperature; | |
| 512 | |
| 513 SDivetime TotalDivetime = {0,0,0,0}; | |
| 514 SDivetime LastDivetime = {0,0,0,0}; | |
| 515 | |
| 516 uint16_t tempWinX0; | |
| 517 uint16_t tempWinY0; | |
| 518 | |
| 519 tempWinX0 = tXc1->WindowX0; | |
| 520 tempWinY0 = tXc1->WindowY0; | |
| 521 | |
| 522 tXc1->WindowX0 = 440; // rechte Seite | |
| 523 | |
| 524 switch(tX_selection_customview) | |
| 525 { | |
| 526 case CVIEW_T3_Temperature: | |
| 527 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature); | |
| 528 GFX_write_string(&FontT42,tXc1,text,0); | |
| 529 | |
| 530 // mean value | |
| 531 temperatureThisCall = unit_temperature_float(stateUsed->lifeData.temperature_celsius); | |
| 532 temperature = (temperatureThisCall + temperatureLastCall[0] + temperatureLastCall[1] + temperatureLastCall[2]) / 4.0f; | |
| 533 idTemperatureLastCall++; | |
| 534 if(idTemperatureLastCall >= 3) | |
| 535 idTemperatureLastCall = 0; | |
| 536 temperatureLastCall[idTemperatureLastCall] = temperatureThisCall; | |
| 537 textpointer = snprintf(text,TEXTSIZE,"\020\003\016%01.0f\016\016\140",temperature); // "\016\016%01.1f `" + C or F | |
| 538 if(settingsGetPointer()->nonMetricalSystem == 0) | |
| 539 text[textpointer++] = 'C'; | |
| 540 else | |
| 541 text[textpointer++] = 'F'; | |
| 542 text[textpointer++] = 0; | |
| 543 t3_basics_colorscheme_mod(text); | |
| 544 GFX_write_string(&FontT105,tXc1,text,1); | |
| 545 break; | |
| 546 | |
| 547 case CVIEW_T3_ApnoeSurfaceInfo: | |
| 548 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Divetime); | |
| 549 GFX_write_string(&FontT42,tXc1,text,0); | |
| 550 | |
| 551 TotalDivetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; | |
| 552 TotalDivetime.Minutes = TotalDivetime.Total / 60; | |
| 553 TotalDivetime.Seconds = TotalDivetime.Total - ( TotalDivetime.Minutes * 60 ); | |
| 554 | |
| 555 LastDivetime.Total = stateUsed->lifeData.apnea_last_dive_time_seconds; | |
| 556 LastDivetime.Minutes = LastDivetime.Total / 60; | |
| 557 LastDivetime.Seconds = LastDivetime.Total - ( LastDivetime.Minutes * 60 ); | |
| 558 | |
| 559 tXc1->WindowY0 = 100; // obere Zeile | |
| 560 | |
| 561 snprintf(text,TEXTSIZE,"\020\016%u:%02u",LastDivetime.Minutes, LastDivetime.Seconds); | |
| 562 t3_basics_colorscheme_mod(text); | |
| 563 GFX_write_string(&FontT105,tXc1,text,0); | |
| 564 | |
| 565 snprintf(text,TEXTSIZE,"\032\002%c%c",TXT_2BYTE, TXT2BYTE_ApneaLast); | |
| 566 GFX_write_string(&FontT42,tXc1,text,0); | |
| 567 | |
| 568 tXc1->WindowY0 = tempWinY0; // wieder unten | |
| 569 | |
| 570 snprintf(text,TEXTSIZE,"\020\016%u:%02u",TotalDivetime.Minutes, TotalDivetime.Seconds); | |
| 571 t3_basics_colorscheme_mod(text); | |
| 572 GFX_write_string(&FontT105,tXc1,text,0); | |
| 573 | |
| 574 snprintf(text,TEXTSIZE,"\032\002%c%c",TXT_2BYTE, TXT2BYTE_ApneaTotal); | |
| 575 GFX_write_string(&FontT42,tXc1,text,0); | |
| 576 break; | |
| 577 } | |
| 578 | |
| 579 tXc1->WindowX0 = tempWinX0; | |
| 580 tXc1->WindowY0 = tempWinY0; | |
| 581 | |
| 582 } | |
| 583 | |
| 584 | |
| 585 void t3_basics_refresh_customview(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) | |
| 586 { | |
| 587 char text[512]; | |
| 588 uint16_t textpointer = 0; | |
| 589 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
590 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
591 pSettings = settingsGetPointer(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
592 |
| 38 | 593 // CVIEW_T3_Decostop and CVIEW_T3_TTS |
| 594 const SDecoinfo * pDecoinfo; | |
| 595 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
| 596 pDecoinfo = &stateUsed->decolistBuehlmann; | |
| 597 else | |
| 598 pDecoinfo = &stateUsed->decolistVPM; | |
| 599 | |
| 600 // CVIEW_T3_Decostop | |
| 601 uint16_t nextstopLengthSeconds = 0; | |
| 602 uint8_t nextstopDepthMeter = 0; | |
| 603 SDivetime SafetyStopTime = {0,0,0,0}; | |
| 604 | |
| 605 // CVIEW_T3_ppO2andGas | |
| 606 uint8_t oxygen_percentage = 0; | |
| 607 | |
| 608 // CVIEW_T3_Temperature | |
| 609 float temperatureThisCall; | |
| 610 float temperature; | |
| 611 | |
| 612 // CVIEW_T3_GasList | |
| 613 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth; | |
| 614 const SGasLine * pGasLine; | |
| 615 uint8_t oxygen, helium; | |
| 616 uint8_t lineNumber; | |
| 617 | |
| 618 // CVIEW_T3_StopWatch | |
| 619 SDivetime Stopwatch = {0,0,0,0}; | |
| 620 float fAverageDepth, fAverageDepthAbsolute; | |
| 621 | |
| 622 | |
| 623 uint16_t tempWinX0; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
624 uint16_t tempWinX1; |
| 38 | 625 uint16_t tempWinY0; |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
626 uint16_t tempWinY1; |
| 38 | 627 uint16_t tempWinC2X0; |
| 628 uint16_t tempWinC2Tab; | |
| 629 | |
| 630 tempWinX0 = tXc1->WindowX0; | |
| 631 tempWinY0 = tXc1->WindowY0; | |
| 632 tempWinC2X0 = tXc2->WindowX0; | |
| 633 tempWinC2Tab = tXc2->WindowTab; | |
| 634 | |
| 635 switch(tX_selection_customview) | |
| 636 { | |
| 637 case CVIEW_T3_ApnoeSurfaceInfo: | |
| 638 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
| 639 GFX_write_string(&FontT42,tXc1,text,0); | |
| 640 | |
| 641 tXc1->WindowY0 = 100; // obere Zeile | |
| 642 | |
| 643 snprintf(text,TEXTSIZE,"\020\016%01.1f",unit_depth_float(stateUsed->lifeData.apnea_last_max_depth_meter)); | |
| 644 t3_basics_colorscheme_mod(text); | |
| 645 GFX_write_string(&FontT105,tXc1,text,0); | |
| 646 | |
| 647 tXc1->WindowY0 = tempWinY0; // wieder unten | |
| 648 | |
| 649 snprintf(text,TEXTSIZE,"\020\016%01.1f",unit_depth_float(stateUsed->lifeData.apnea_total_max_depth_meter)); | |
| 650 t3_basics_colorscheme_mod(text); | |
| 651 GFX_write_string(&FontT105,tXc1,text,0); | |
| 652 break; | |
| 653 | |
| 654 case CVIEW_T3_StopWatch: | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
655 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
656 tempWinX0 = tXc1->WindowX0; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
657 tempWinY0 = tXc1->WindowY0; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
658 tempWinX1 = tXc1->WindowX1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
659 tempWinY1 = tXc1->WindowY1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
660 |
| 38 | 661 Stopwatch.Total = timer_Stopwatch_GetTime(); |
| 662 Stopwatch.Minutes = Stopwatch.Total / 60; | |
| 663 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
| 664 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
| 665 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
| 666 | |
| 667 snprintf(text,TEXTSIZE,"\032\f%c",TXT_AvgDepth); | |
| 668 GFX_write_string(&FontT42,tXc1,text,0); | |
| 669 snprintf(text,TEXTSIZE,"\030\003\016%01.1f",unit_depth_float(fAverageDepthAbsolute)); | |
| 670 GFX_write_string(&FontT105,tXc1,text,0); | |
| 671 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
672 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
673 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
674 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
675 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
676 tXc1->WindowX0 = 480; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
677 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
678 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
679 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
680 tXc1->WindowX1 = 320; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
681 tXc1->WindowY0 = t3c1.WindowY0; /* select customer window */ |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
682 } |
| 38 | 683 // snprintf(text,TEXTSIZE,"\032\f%c%c - %c",TXT_2BYTE, TXT2BYTE_Clock, TXT_AvgDepth); |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
684 |
| 38 | 685 snprintf(text,TEXTSIZE,"\032\f%c", TXT_Stopwatch); |
| 686 GFX_write_string(&FontT42,tXc1,text,0); | |
| 687 snprintf(text,TEXTSIZE,"\030\016%01.1f",unit_depth_float(fAverageDepth)); | |
| 688 GFX_write_string(&FontT105,tXc1,text,0); | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
689 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
690 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
691 tXc1->WindowY0 = 100; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
692 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
693 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
694 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
695 tXc1->WindowY1 -= 100; /* jump to upper of two lines */ |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
696 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
697 |
| 38 | 698 snprintf(text,TEXTSIZE,"\030%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); |
| 699 GFX_write_string(&FontT105,tXc1,text,0); | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
700 |
| 38 | 701 tXc1->WindowX0 = tempWinX0; |
| 702 tXc1->WindowY0 = tempWinY0; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
703 tXc1->WindowX1 = tempWinX1; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
704 tXc1->WindowY1 = tempWinY1; |
| 38 | 705 break; |
| 706 | |
| 707 case CVIEW_T3_GasList: | |
| 708 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist); | |
| 709 GFX_write_string(&FontT42,tXc1,text,0); | |
| 710 | |
| 711 textpointer = 0; | |
| 712 tempWinC2X0 = tXc2->WindowX0; | |
| 713 tempWinC2Tab = tXc2->WindowTab; | |
| 714 | |
| 715 tXc2->WindowX0 = 0; | |
| 716 tXc2->WindowTab = 800/2; | |
| 717 | |
| 718 pGasLine = settingsGetPointer()->gas; | |
| 719 if(actualLeftMaxDepth(stateUsed)) | |
| 720 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_deco) / 100; | |
| 721 else | |
| 722 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100; | |
| 723 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100; | |
| 724 for(int gasId=1;gasId<=NUM_GASES;gasId++) | |
| 725 { | |
| 726 textpointer = 0; | |
| 727 lineNumber = gasId; | |
| 728 if(gasId > 3) | |
| 729 { | |
| 730 text[textpointer++] = '\t'; | |
| 731 lineNumber = gasId - 3; | |
| 732 } | |
| 733 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100; | |
| 734 if(pGasLine[gasId].note.ub.active == 0) | |
| 735 strcpy(&text[textpointer++],"\021"); | |
| 736 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow)) | |
| 737 strcpy(&text[textpointer++],"\025"); | |
| 738 else | |
| 739 strcpy(&text[textpointer++],"\030"); | |
| 740 | |
| 741 text[textpointer++] = ' '; | |
| 742 oxygen = pGasLine[gasId].oxygen_percentage; | |
| 743 helium = pGasLine[gasId].helium_percentage; | |
| 744 textpointer += write_gas(&text[textpointer], oxygen, helium); | |
| 745 GFX_write_string(&FontT42, tXc2, text, lineNumber); | |
| 746 } | |
| 747 break; | |
| 748 | |
| 749 case CVIEW_T3_Temperature: | |
| 750 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature); | |
| 751 GFX_write_string(&FontT42,tXc1,text,0); | |
| 752 // mean value | |
| 753 temperatureThisCall = unit_temperature_float(stateUsed->lifeData.temperature_celsius); | |
| 754 temperature = (temperatureThisCall + temperatureLastCall[0] + temperatureLastCall[1] + temperatureLastCall[2]) / 4.0f; | |
| 755 idTemperatureLastCall++; | |
| 756 if(idTemperatureLastCall >= 3) | |
| 757 idTemperatureLastCall = 0; | |
| 758 temperatureLastCall[idTemperatureLastCall] = temperatureThisCall; | |
| 759 textpointer = snprintf(text,TEXTSIZE,"\030\003\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F | |
| 760 if(settingsGetPointer()->nonMetricalSystem == 0) | |
| 761 text[textpointer++] = 'C'; | |
| 762 else | |
| 763 text[textpointer++] = 'F'; | |
| 764 text[textpointer++] = 0; | |
| 765 GFX_write_string(&FontT105,tXc1,text,0); | |
| 766 break; | |
| 767 | |
| 768 case CVIEW_Compass: | |
| 769 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); | |
| 770 GFX_write_string(&FontT42,tXc1,text,0); | |
| 771 snprintf(text,100,"\030\003%03i`",(uint16_t)stateUsed->lifeData.compass_heading); | |
| 772 GFX_write_string(&FontT105,tXc1,text,0); | |
| 773 t3_basics_compass(tXscreen, (uint16_t)stateUsed->lifeData.compass_heading, stateUsed->diveSettings.compassHeading); | |
| 774 break; | |
| 775 | |
| 776 case CVIEW_T3_Decostop: | |
| 777 default: | |
| 778 // decostop | |
| 779 if(pDecoinfo->output_time_to_surface_seconds) | |
| 780 { | |
| 781 tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
| 782 } | |
| 783 else | |
| 784 { | |
| 785 nextstopDepthMeter = 0; | |
| 786 nextstopLengthSeconds = 0; | |
| 787 } | |
| 788 | |
| 789 SafetyStopTime.Total = timer_Safetystop_GetCountDown(); | |
| 790 SafetyStopTime.Minutes = SafetyStopTime.Total / 60; | |
| 791 SafetyStopTime.Seconds = SafetyStopTime.Total - (SafetyStopTime.Minutes * 60); | |
| 792 | |
| 793 if(nextstopDepthMeter) | |
| 794 { | |
| 795 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Decostop); | |
| 796 GFX_write_string(&FontT42,tXc1,text,0); | |
| 797 | |
| 798 textpointer = 0; | |
| 799 snprintf(&text[textpointer],TEXTSIZE,"\020\003%u%c%c %u'" | |
| 800 , unit_depth_integer(nextstopDepthMeter) | |
| 801 , unit_depth_char1_T105() | |
| 802 , unit_depth_char2_T105() | |
| 803 , (nextstopLengthSeconds+59)/60); | |
| 804 // old without feet hw 170703 snprintf(&text[textpointer],TEXTSIZE,"\020\003%um %u'",nextstopDepthMeter,(nextstopLengthSeconds+59)/60); | |
| 805 t3_basics_colorscheme_mod(text); | |
| 806 GFX_write_string(&FontT105,tXc1,text,1); | |
| 807 } | |
| 808 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit())) | |
| 809 { | |
| 810 textpointer = 0; | |
| 811 snprintf(&text[textpointer],TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2); | |
| 812 GFX_write_string(&FontT42,tXc1,text,0); | |
| 813 | |
| 814 textpointer = 0; | |
| 815 snprintf(&text[textpointer],TEXTSIZE,"\020\003\016%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds); | |
| 816 t3_basics_colorscheme_mod(text); | |
| 817 GFX_write_string(&FontT105,tXc1,text,1); | |
| 818 } | |
| 819 else // NDL | |
| 820 { | |
| 821 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Nullzeit); | |
| 822 GFX_write_string(&FontT42,tXc1,text,0); | |
| 823 if(pDecoinfo->output_ndl_seconds < 1000 * 60) | |
| 824 snprintf(text,TEXTSIZE,"\020\003%i'",pDecoinfo->output_ndl_seconds/60); | |
| 825 else | |
| 826 snprintf(text,TEXTSIZE,"\020\003%ih",pDecoinfo->output_ndl_seconds/3600); | |
| 827 t3_basics_colorscheme_mod(text); | |
| 828 GFX_write_string(&FontT105,tXc1,text,1); | |
| 829 } | |
| 830 break; | |
| 831 | |
| 832 case CVIEW_sensors: | |
| 833 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_O2monitor); | |
| 834 GFX_write_string(&FontT42,tXc1,text,0); | |
| 835 | |
| 836 for(int i=0;i<3;i++) | |
| 837 { | |
| 838 textpointer = 0; | |
| 839 text[textpointer++] = '\030'; | |
| 840 if(i==1) | |
| 841 text[textpointer++] = '\001'; | |
| 842 else if(i==2) | |
| 843 text[textpointer++] = '\002'; | |
| 844 if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) | |
| 845 { | |
| 846 text[textpointer++] = '\031'; | |
| 847 text[textpointer++] = ' '; | |
| 848 text[textpointer++] = '-'; | |
| 849 text[textpointer++] = ' '; | |
| 850 } | |
| 851 else | |
| 852 { | |
| 853 if(stateUsed->warnings.sensorOutOfBounds[i]) | |
| 854 text[textpointer++] = '\025'; | |
| 855 textpointer += snprintf(&text[textpointer],TEXTSIZE,"%.1f",stateUsed->lifeData.ppO2Sensor_bar[i]); | |
| 856 } | |
| 857 GFX_write_string(&FontT144,tXc1,text,1); | |
| 858 } | |
| 859 break; | |
| 860 | |
| 861 case CVIEW_T3_MaxDepth: | |
| 862 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
| 863 GFX_write_string(&FontT42,tXc1,text,0); | |
| 864 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
| 865 t3_basics_colorscheme_mod(text); | |
| 866 GFX_write_string(&FontT105,tXc1,text,1); | |
| 867 break; | |
| 868 | |
| 869 case CVIEW_T3_TTS: | |
| 870 snprintf(text,TEXTSIZE,"\032\f%c",TXT_TTS); | |
| 871 GFX_write_string(&FontT42,tXc1,text,0); | |
| 872 if(pDecoinfo->output_time_to_surface_seconds) | |
| 873 { | |
| 874 if(pDecoinfo->output_time_to_surface_seconds < 1000 * 60) | |
| 875 snprintf(text,TEXTSIZE,"\020\003\002%i'",(pDecoinfo->output_time_to_surface_seconds + 30)/ 60); | |
| 876 else | |
| 877 snprintf(text,TEXTSIZE,"\020\003\002%ih",pDecoinfo->output_time_to_surface_seconds / 3600); | |
| 878 t3_basics_colorscheme_mod(text); | |
| 879 GFX_write_string(&FontT105,tXc1,text,1); | |
| 880 } | |
| 881 break; | |
| 882 | |
| 883 case CVIEW_T3_ppO2andGas: | |
| 884 snprintf(text,TEXTSIZE,"\032\f%c",TXT_ppO2); | |
| 885 GFX_write_string(&FontT42,tXc1,text,0); | |
| 886 snprintf(text,TEXTSIZE,"\020\003%01.2f",stateUsed->lifeData.ppO2); | |
| 887 t3_basics_colorscheme_mod(text); | |
| 888 GFX_write_string(&FontT105,tXc1,text,1); | |
| 889 | |
| 890 textpointer = 0; | |
| 891 text[textpointer++] = '\020'; | |
| 892 text[textpointer++] = '\003'; | |
| 893 oxygen_percentage = 100; | |
| 894 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage; | |
| 895 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage; | |
| 896 text[textpointer++] = '\002'; | |
| 897 tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&text[textpointer]); | |
| 898 //textpointer = snprintf(&text[textpointer],TEXTSIZE,"\020\002%02u/%02u",oxygen_percentage, stateUsed->lifeData.actualGas.helium_percentage); | |
| 899 t3_basics_colorscheme_mod(text); | |
| 900 GFX_write_string(&FontT48,tXc1,text,1); | |
| 901 break; | |
| 902 } | |
| 903 tXc1->WindowX0 = tempWinX0; | |
| 904 tXc1->WindowY0 = tempWinY0; | |
| 905 tXc2->WindowX0 = tempWinC2X0; | |
| 906 tXc2->WindowTab = tempWinC2Tab; | |
| 907 } | |
| 908 | |
| 909 | |
| 910 uint8_t t3_test_customview_warnings(void) | |
| 911 { | |
| 912 uint8_t count = 0; | |
| 913 | |
| 914 count = 0; | |
| 915 count += stateUsed->warnings.decoMissed; | |
| 916 count += stateUsed->warnings.ppO2Low; | |
| 917 count += stateUsed->warnings.ppO2High; | |
| 918 //count += stateUsed->warnings.lowBattery; | |
| 919 count += stateUsed->warnings.sensorLinkLost; | |
| 920 count += stateUsed->warnings.fallback; | |
| 921 | |
| 922 return count; | |
| 923 } | |
| 924 | |
| 925 //void t3_show_customview_warnings(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode) | |
| 926 void t3_basics_show_customview_warnings(GFX_DrawCfgWindow* tXc1) | |
| 927 { | |
| 928 char text[256], textMain[256]; | |
| 929 uint8_t textpointer, textpointerMain, lineFree, more; | |
| 930 | |
| 931 snprintf(text,TEXTSIZE,"\025\f%c",TXT_Warning); | |
| 932 GFX_write_string(&FontT42,&t3c1,text,0); | |
| 933 | |
| 934 lineFree = 1; | |
| 935 more = 0; | |
| 936 | |
| 937 textpointerMain = 0; | |
| 938 textMain[textpointerMain++] = '\025'; | |
| 939 textMain[textpointerMain++] = '\003'; | |
| 940 | |
| 941 textpointer = 0; | |
| 942 | |
| 943 text[textpointer++] = '\021'; | |
| 944 text[textpointer++] = TXT_2BYTE; | |
| 945 text[textpointer++] = TXT2BYTE_WarnDecoMissed; | |
| 946 if(stateUsed->warnings.decoMissed) | |
| 947 { | |
| 948 text[textpointer - 3] = '\025'; | |
| 949 if(lineFree) | |
| 950 { | |
| 951 textMain[textpointerMain++] = TXT_2BYTE; | |
| 952 textMain[textpointerMain++] = text[textpointer - 1]; | |
| 953 textMain[textpointerMain] = 0; | |
| 954 lineFree--; | |
| 955 } | |
| 956 else | |
| 957 { | |
| 958 more++; | |
| 959 } | |
| 960 } | |
| 961 | |
| 962 text[textpointer++] = '\t'; | |
| 963 text[textpointer++] = '\021'; | |
| 964 text[textpointer++] = TXT_2BYTE; | |
| 965 text[textpointer++] = TXT2BYTE_WarnPPO2Low; | |
| 966 if(stateUsed->warnings.ppO2Low) | |
| 967 { | |
| 968 text[textpointer - 3] = '\025'; | |
| 969 if(lineFree) | |
| 970 { | |
| 971 textMain[textpointerMain++] = TXT_2BYTE; | |
| 972 textMain[textpointerMain++] = text[textpointer - 1]; | |
| 973 textMain[textpointerMain] = 0; | |
| 974 lineFree--; | |
| 975 } | |
| 976 else | |
| 977 { | |
| 978 more++; | |
| 979 } | |
| 980 } | |
| 981 | |
| 982 text[textpointer++] = '\n'; | |
| 983 text[textpointer++] = '\r'; | |
| 984 text[textpointer++] = '\021'; | |
| 985 text[textpointer++] = TXT_2BYTE; | |
| 986 text[textpointer++] = TXT2BYTE_WarnPPO2High; | |
| 987 if(stateUsed->warnings.ppO2High) | |
| 988 { | |
| 989 text[textpointer - 3] = '\025'; | |
| 990 if(lineFree) | |
| 991 { | |
| 992 textMain[textpointerMain++] = TXT_2BYTE; | |
| 993 textMain[textpointerMain++] = text[textpointer - 1]; | |
| 994 textMain[textpointerMain] = 0; | |
| 995 lineFree--; | |
| 996 } | |
| 997 else | |
| 998 { | |
| 999 more++; | |
| 1000 } | |
| 1001 } | |
| 1002 | |
| 1003 text[textpointer++] = '\t'; | |
| 1004 text[textpointer++] = '\021'; | |
| 1005 text[textpointer++] = TXT_2BYTE; | |
| 1006 text[textpointer++] = TXT2BYTE_WarnFallback; | |
| 1007 if(stateUsed->warnings.fallback) | |
| 1008 { | |
| 1009 text[textpointer - 3] = '\025'; | |
| 1010 if(lineFree) | |
| 1011 { | |
| 1012 textMain[textpointerMain++] = TXT_2BYTE; | |
| 1013 textMain[textpointerMain++] = text[textpointer - 1]; | |
| 1014 textMain[textpointerMain] = 0; | |
| 1015 lineFree--; | |
| 1016 } | |
| 1017 else | |
| 1018 { | |
| 1019 more++; | |
| 1020 } | |
| 1021 } | |
| 1022 | |
| 1023 text[textpointer++] = '\n'; | |
| 1024 text[textpointer++] = '\r'; | |
| 1025 text[textpointer++] = '\021'; | |
| 1026 text[textpointer++] = TXT_2BYTE; | |
| 1027 text[textpointer++] = TXT2BYTE_WarnSensorLinkLost; | |
| 1028 if(stateUsed->warnings.sensorLinkLost) | |
| 1029 { | |
| 1030 text[textpointer - 3] = '\025'; | |
| 1031 if(lineFree) | |
| 1032 { | |
| 1033 textMain[textpointerMain++] = TXT_2BYTE; | |
| 1034 textMain[textpointerMain++] = text[textpointer - 1]; | |
| 1035 textMain[textpointerMain] = 0; | |
| 1036 lineFree--; | |
| 1037 } | |
| 1038 else | |
| 1039 { | |
| 1040 more++; | |
| 1041 } | |
| 1042 } | |
| 1043 | |
| 1044 /* | |
| 1045 text[textpointer++] = '\t'; | |
| 1046 text[textpointer++] = '\021'; | |
| 1047 text[textpointer++] = TXT_2BYTE; | |
| 1048 text[textpointer++] = TXT2BYTE_WarnBatteryLow; | |
| 1049 if(stateUsed->warnings.lowBattery) | |
| 1050 { | |
| 1051 text[textpointer - 3] = '\025'; | |
| 1052 if(lineFree) | |
| 1053 { | |
| 1054 textMain[textpointerMain++] = TXT_2BYTE; | |
| 1055 textMain[textpointerMain++] = text[textpointer - 1]; | |
| 1056 textMain[textpointerMain] = 0; | |
| 1057 lineFree--; | |
| 1058 } | |
| 1059 else | |
| 1060 { | |
| 1061 more++; | |
| 1062 } | |
| 1063 } | |
| 1064 */ | |
| 1065 text[textpointer] = 0; | |
| 1066 /* | |
| 1067 if(more) | |
| 1068 { | |
| 1069 text[textpointer++] = '\002'; | |
| 1070 text[textpointer++] = '+'; | |
| 1071 if(more < 10) | |
| 1072 text[textpointer++] = '0' + more; | |
| 1073 else | |
| 1074 text[textpointer++] = 'X'; | |
| 1075 text[textpointer] = 0; | |
| 1076 } | |
| 1077 */ | |
| 1078 GFX_write_string(&FontT48,&t3c1,textMain,1); | |
| 1079 if(more) | |
| 1080 { | |
| 1081 GFX_write_string(&FontT48,&t3c2,text,1); | |
| 1082 } | |
| 1083 } | |
| 1084 | |
| 1085 | |
| 1086 void t3_change_customview(void) | |
| 1087 { | |
| 1088 t3_basics_change_customview(&t3_selection_customview, t3_customviews); | |
| 1089 } | |
| 1090 | |
| 1091 | |
| 1092 void t3_basics_change_customview(uint8_t *tX_selection_customview, const uint8_t *tX_customviews) | |
| 1093 { | |
| 1094 const SDecoinfo * pDecoinfo; | |
| 1095 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
| 1096 pDecoinfo = &stateUsed->decolistBuehlmann; | |
| 1097 else | |
| 1098 pDecoinfo = &stateUsed->decolistVPM; | |
| 1099 | |
| 1100 const uint8_t *pViews; | |
| 1101 pViews = tX_customviews; | |
| 1102 | |
| 1103 while((*pViews != CVIEW_T3_END) && (*pViews != *tX_selection_customview)) | |
| 1104 {pViews++;} | |
| 1105 | |
| 1106 if(*pViews < CVIEW_T3_END) | |
| 1107 pViews++; | |
| 1108 | |
| 1109 if((*pViews == CVIEW_T3_TTS) && !pDecoinfo->output_time_to_surface_seconds) | |
| 1110 pViews++; | |
| 1111 | |
| 1112 if(*pViews == CVIEW_T3_END) | |
| 1113 { | |
| 1114 *tX_selection_customview = tX_customviews[0]; | |
| 1115 } | |
| 1116 else | |
| 1117 *tX_selection_customview = *pViews; | |
| 1118 } | |
| 1119 | |
| 1120 | |
| 1121 void t3_basics_colorscheme_mod(char *text) | |
| 1122 { | |
| 1123 if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard()) | |
| 1124 { | |
| 1125 text[0] = '\027'; | |
| 1126 } | |
| 1127 } | |
| 1128 | |
| 1129 | |
| 1130 point_t t3_compass_circle(uint8_t id, uint16_t degree) | |
| 1131 { | |
| 1132 float fCos, fSin; | |
| 1133 const float piMult = ((2 * 3.14159) / 360); | |
| 1134 // const int radius[4] = {95,105,115,60}; | |
| 1135 const int radius[4] = {85,95,105,90}; | |
| 1136 const point_t offset = {.x = 600, .y = 116}; | |
| 1137 | |
| 1138 static point_t r[4][360] = { 0 }; | |
| 1139 | |
| 1140 if(r[0][0].y == 0) | |
| 1141 { | |
| 1142 for(int i=0;i<360;i++) | |
| 1143 { | |
| 1144 fCos = cos(i * piMult); | |
| 1145 fSin = sin(i * piMult); | |
| 1146 for(int j=0;j<4;j++) | |
| 1147 { | |
| 1148 r[j][i].x = offset.x + (int)(fSin * radius[j]); | |
| 1149 r[j][i].y = offset.y + (int)(fCos * radius[j]); | |
| 1150 } | |
| 1151 } | |
| 1152 } | |
| 1153 if(id > 3) id = 0; | |
| 1154 if(degree > 359) degree = 0; | |
| 1155 return r[id][degree]; | |
| 1156 } | |
| 1157 | |
| 1158 | |
| 1159 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, uint16_t ActualHeading, uint16_t UserSetHeading) | |
| 1160 { | |
| 1161 uint16_t LineHeading; | |
| 1162 point_t center; | |
| 1163 static int32_t LastHeading = 0; | |
| 1164 int32_t newHeading = 0; | |
| 1165 int32_t diff = 0; | |
| 1166 int32_t diff2 = 0; | |
| 1167 | |
| 1168 int32_t diffAbs = 0; | |
| 1169 int32_t diffAbs2 = 0; | |
| 1170 | |
| 1171 newHeading = ActualHeading; | |
| 1172 | |
| 1173 diff = newHeading - LastHeading; | |
| 1174 | |
| 1175 if(newHeading < LastHeading) | |
| 1176 diff2 = newHeading + 360 - LastHeading; | |
| 1177 else | |
| 1178 diff2 = newHeading - 360 - LastHeading; | |
| 1179 | |
| 1180 diffAbs = diff; | |
| 1181 if(diffAbs < 0) | |
| 1182 diffAbs *= -1; | |
| 1183 | |
| 1184 diffAbs2 = diff2; | |
| 1185 if(diffAbs2 < 0) | |
| 1186 diffAbs2 *= -1; | |
| 1187 | |
| 1188 if(diffAbs <= diffAbs2) | |
| 1189 newHeading = LastHeading + (diff / 2); | |
| 1190 else | |
| 1191 newHeading = LastHeading + (diff2 / 2); | |
| 1192 | |
| 1193 if(newHeading < 0) | |
| 1194 newHeading += 360; | |
| 1195 else | |
| 1196 if(newHeading >= 360) | |
| 1197 newHeading -= 360; | |
| 1198 | |
| 1199 LastHeading = newHeading; | |
| 1200 ActualHeading = newHeading; | |
| 1201 | |
| 1202 if (ActualHeading < 90) | |
| 1203 ActualHeading += 360; | |
| 1204 | |
| 1205 while(ActualHeading > 359) ActualHeading -= 360; | |
| 1206 | |
| 1207 LineHeading = 360 - ActualHeading; | |
| 1208 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font030); // North | |
| 1209 LineHeading += 90; | |
| 1210 if(LineHeading > 359) LineHeading -= 360; | |
| 1211 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); // Maintick | |
| 1212 LineHeading += 90; | |
| 1213 if(LineHeading > 359) LineHeading -= 360; | |
| 1214 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); | |
| 1215 LineHeading += 90; | |
| 1216 if(LineHeading > 359) LineHeading -= 360; | |
| 1217 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); | |
| 1218 | |
| 1219 LineHeading = 360 - ActualHeading; | |
| 1220 LineHeading += 45; | |
| 1221 if(LineHeading > 359) LineHeading -= 360; | |
| 1222 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); // Subtick | |
| 1223 LineHeading += 90; | |
| 1224 if(LineHeading > 359) LineHeading -= 360; | |
| 1225 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); | |
| 1226 LineHeading += 90; | |
| 1227 if(LineHeading > 359) LineHeading -= 360; | |
| 1228 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); | |
| 1229 LineHeading += 90; | |
| 1230 if(LineHeading > 359) LineHeading -= 360; | |
| 1231 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); | |
| 1232 | |
| 1233 LineHeading = 360 - ActualHeading; | |
| 1234 LineHeading += 22; | |
| 1235 if(LineHeading > 359) LineHeading -= 360; | |
| 1236 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); // Subtick | |
| 1237 LineHeading += 45; | |
| 1238 if(LineHeading > 359) LineHeading -= 360; | |
| 1239 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); | |
| 1240 LineHeading += 45; | |
| 1241 if(LineHeading > 359) LineHeading -= 360; | |
| 1242 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); | |
| 1243 LineHeading += 45; | |
| 1244 if(LineHeading > 359) LineHeading -= 360; | |
| 1245 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); | |
| 1246 LineHeading += 45; | |
| 1247 if(LineHeading > 359) LineHeading -= 360; | |
| 1248 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); // Subtick | |
| 1249 LineHeading += 45; | |
| 1250 if(LineHeading > 359) LineHeading -= 360; | |
| 1251 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); | |
| 1252 LineHeading += 45; | |
| 1253 if(LineHeading > 359) LineHeading -= 360; | |
| 1254 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); | |
| 1255 LineHeading += 45; | |
| 1256 if(LineHeading > 359) LineHeading -= 360; | |
| 1257 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); | |
| 1258 | |
| 1259 if(UserSetHeading) | |
| 1260 { | |
| 1261 LineHeading = UserSetHeading + 360 - ActualHeading; | |
| 1262 if(LineHeading > 359) LineHeading -= 360; | |
| 1263 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading), t3_compass_circle(2,LineHeading), CLUT_CompassUserHeadingTick); | |
| 1264 | |
| 1265 // R�ckpeilung, User Back Heading | |
| 1266 LineHeading = UserSetHeading + 360 + 180 - ActualHeading; | |
| 1267 if(LineHeading > 359) LineHeading -= 360; | |
| 1268 if(LineHeading > 359) LineHeading -= 360; | |
| 1269 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading), t3_compass_circle(2,LineHeading), CLUT_CompassUserBackHeadingTick); | |
| 1270 } | |
| 1271 | |
| 1272 center.x = 600; | |
| 1273 center.y = 116; | |
| 1274 GFX_draw_circle(tXscreen, center, 106, CLUT_Font030); | |
| 1275 GFX_draw_circle(tXscreen, center, 107, CLUT_Font030); | |
| 1276 GFX_draw_circle(tXscreen, center, 108, CLUT_Font030); | |
| 1277 } |
