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 ------------------------------------------------------------------*/
737
+ − 30 #include <stdlib.h>
+ − 31
38
+ − 32 #include "t7.h"
595
+ − 33 #include "t3.h"
527
+ − 34 #include "settings.h"
38
+ − 35 #include "data_exchange_main.h"
868
+ − 36 #include "data_central.h"
38
+ − 37 #include "decom.h"
+ − 38 #include "gfx_fonts.h"
+ − 39 #include "logbook_miniLive.h"
+ − 40 #include "math.h"
662
+ − 41 #include "tComm.h"
38
+ − 42 #include "tHome.h"
+ − 43 #include "simulation.h"
+ − 44 #include "timer.h"
+ − 45 #include "unit.h"
369
+ − 46 #include "motion.h"
527
+ − 47 #include "configuration.h"
740
+ − 48 #include "base.h"
775
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
diff
changeset
+ − 49 #include "tMenuEditSetpoint.h"
907
+ − 50 #include "vpm.h"
38
+ − 51
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 52 #define TIMER_ACTION_DELAY_S 10
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 53
38
+ − 54 /* Private function prototypes -----------------------------------------------*/
+ − 55
+ − 56 void t7_refresh_surface(void);
+ − 57 void t7_refresh_surface_debugmode(void);
+ − 58 void t7_refresh_divemode(void);
+ − 59 void t7_refresh_sleep_design_fun(void);
+ − 60 void t7_refresh_divemode_userselected_left_lower_corner(void);
+ − 61 void t7_refresh_customview(void);
405
+ − 62 uint8_t t7_customview_disabled(uint8_t view);
38
+ − 63
+ − 64 void draw_frame(_Bool PluginBoxHeader, _Bool LinesOnTheSides, uint8_t colorBox, uint8_t colorLinesOnTheSide);
+ − 65
+ − 66 void t7_tissues(const SDiveState * pState);
+ − 67 void t7_compass(uint16_t ActualHeading, uint16_t UserSetHeading);
+ − 68 void t7_SummaryOfLeftCorner(void);
+ − 69 void t7_debug(void);
+ − 70
+ − 71 void t7_miniLiveLogProfile(void);
+ − 72 void t7_logo_OSTC(void);
672
+ − 73 void t7_ChargerView(void);
38
+ − 74
+ − 75 uint8_t t7_test_customview_warnings(void);
+ − 76 void t7_show_customview_warnings(void);
+ − 77
+ − 78 uint8_t t7_test_customview_warnings_surface_mode(void);
+ − 79 void t7_show_customview_warnings_surface_mode(void);
+ − 80
+ − 81 uint8_t t7_customtextPrepare(char * text);
+ − 82
882
+ − 83 static void t7_drawAcentGraph(uint8_t color);
+ − 84 static uint8_t t7_drawSlowExitGraph(void);
899
+ − 85 static void t7_showPosition(void);
882
+ − 86
193
+ − 87 /* Imported function prototypes ---------------------------------------------*/
38
+ − 88 extern uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium);
+ − 89
+ − 90 /* Exported variables --------------------------------------------------------*/
+ − 91
+ − 92 /* Private variables ---------------------------------------------------------*/
+ − 93
+ − 94 GFX_DrawCfgScreen t7screen;
+ − 95 GFX_DrawCfgScreen t7screenCompass;
+ − 96
+ − 97 /* left 3 fields
+ − 98 * right 3 fields
+ − 99 * centered one field on top of customview, one below
+ − 100 * customview header + customview + warning
+ − 101 */
+ − 102 GFX_DrawCfgWindow t7l1, t7l2, t7l3;
+ − 103 GFX_DrawCfgWindow t7r1, t7r2, t7r3;
+ − 104 GFX_DrawCfgWindow t7c1, t7batt, t7c2, t7charge, t7voltage;
+ − 105 GFX_DrawCfgWindow t7cH, t7cC, t7cW, t7cY0free;
+ − 106 GFX_DrawCfgWindow t7pCompass;
+ − 107 GFX_DrawCfgWindow t7surfaceL, t7surfaceR;
+ − 108
442
+ − 109 uint8_t selection_customview = LLC_Temperature;
38
+ − 110
+ − 111 uint8_t updateNecessary = 0;
+ − 112
+ − 113 typedef struct{
+ − 114 uint32_t pointer;
+ − 115 uint32_t x0;
+ − 116 uint32_t y0;
+ − 117 uint32_t width;
+ − 118 uint32_t height;
+ − 119 } SBackground;
+ − 120
+ − 121 SBackground background =
+ − 122 {
166
+ − 123 .pointer = 0,
38
+ − 124 };
+ − 125
+ − 126
+ − 127 /* Private types -------------------------------------------------------------*/
+ − 128
882
+ − 129
38
+ − 130 const uint8_t customviewsSurfaceStandard[] =
+ − 131 {
+ − 132 // CVIEW_CompassDebug,
+ − 133 CVIEW_Hello,
+ − 134 CVIEW_sensors,
+ − 135 CVIEW_Compass,
+ − 136 CVIEW_Tissues,
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 137 CVIEW_Gaslist,
38
+ − 138 CVIEW_sensors_mV,
672
+ − 139 CVIEW_Charger,
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 140 CVIEW_CcrSummary,
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 141 CVIEW_Timer,
927
+ − 142 #if defined ENABLE_GPIO_V2 || defined ENABLE_GNSS_SUPPORT
899
+ − 143 CVIEW_Position,
+ − 144 #endif
38
+ − 145 CVIEW_END
+ − 146 };
+ − 147
442
+ − 148
+ − 149 static uint8_t selection_custom_field = LLC_Temperature;
+ − 150
837
+ − 151 const uint8_t *customviewsDive = cv_changelist;
38
+ − 152 const uint8_t *customviewsSurface = customviewsSurfaceStandard;
+ − 153
656
+ − 154 #define TEXTSIZE 30
38
+ − 155 /* offset includes line: 2 = line +1
+ − 156 * box (line) is 300 px
+ − 157 * inside is 296 px
+ − 158 * left of box are 249 px ( 0..248)
+ − 159 * right of box are 249 px (551 .. 799)
+ − 160 */
+ − 161
+ − 162 #define CUSTOMBOX_LINE_LEFT (250)
+ − 163 #define CUSTOMBOX_LINE_RIGHT (549)
110
+ − 164 #define CUSTOMBOX_LINE_TOP (0)
+ − 165 #define CUSTOMBOX_LINE_MIDDLE (142)
+ − 166 #define CUSTOMBOX_LINE_BOTTOM (318)
38
+ − 167 #define CUSTOMBOX_INSIDE_OFFSET (2)
+ − 168 #define CUSTOMBOX_OUTSIDE_OFFSET (2)
+ − 169 #define CUSTOMBOX_SPACE_INSIDE (CUSTOMBOX_LINE_RIGHT + 1 - (CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + CUSTOMBOX_INSIDE_OFFSET))
110
+ − 170 #define TOP_LINE_HIGHT (25)
38
+ − 171
336
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 172 #define SHOW_AMBIENTE_SURFACE_DELTA (0.02f)
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 173 #define SHOW_AMBIENTE_DEBOUNCE (0.003f)
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 174
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 175 #define MAX_NUM_SUMMARY_LINES 6
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 176
38
+ − 177 /* Exported functions --------------------------------------------------------*/
+ − 178
+ − 179 void t7_init(void)
+ − 180 {
110
+ − 181
+ − 182 SSettings* pSettings;
+ − 183 pSettings = settingsGetPointer();
+ − 184
442
+ − 185 selection_custom_field = LLC_Temperature;
38
+ − 186 selection_customview = customviewsSurface[0];
+ − 187
+ − 188 t7screen.FBStartAdress = 0;
+ − 189 t7screen.ImageHeight = 480;
+ − 190 t7screen.ImageWidth = 800;
+ − 191 t7screen.LayerIndex = 1;
+ − 192
+ − 193 t7screenCompass.FBStartAdress = 0;
+ − 194 t7screenCompass.ImageHeight = 240;
+ − 195 t7screenCompass.ImageWidth = 1600;
+ − 196 t7screenCompass.LayerIndex = 0;
+ − 197
110
+ − 198 if(!pSettings->FlipDisplay)
+ − 199 {
+ − 200 t7l1.Image = &t7screen;
+ − 201 t7l1.WindowNumberOfTextLines = 2;
+ − 202 t7l1.WindowLineSpacing = 19; // Abstand von Y0
+ − 203 t7l1.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster
+ − 204 t7l1.WindowX0 = 0;
+ − 205 t7l1.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET;
+ − 206 t7l1.WindowY0 = 318;
+ − 207 t7l1.WindowY1 = 479;
+ − 208
+ − 209 t7l2.Image = &t7screen;
+ − 210 t7l2.WindowNumberOfTextLines = 2;
884
+ − 211 t7l2.WindowLineSpacing = 12; // Abstand von Y0
110
+ − 212 t7l2.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster
+ − 213 t7l2.WindowX0 = 0;
+ − 214 t7l2.WindowX1 = t7l1.WindowX1;
+ − 215 t7l2.WindowY0 = 142;
+ − 216 t7l2.WindowY1 = t7l1.WindowY0 - 5;
+ − 217
+ − 218 t7l3.Image = &t7screen;
+ − 219 t7l3.WindowNumberOfTextLines = 2;
+ − 220 t7l3.WindowLineSpacing = 58; // Abstand von Y0
+ − 221 t7l3.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster
+ − 222 t7l3.WindowX0 = 0;
+ − 223 t7l3.WindowX1 = t7l1.WindowX1;
+ − 224 t7l3.WindowY0 = 0;
+ − 225 t7l3.WindowY1 = t7l2.WindowY0 - 5;
+ − 226
+ − 227 t7r1.Image = &t7screen;
+ − 228 t7r1.WindowNumberOfTextLines = 2;
+ − 229 t7r1.WindowLineSpacing = t7l1.WindowLineSpacing;
+ − 230 t7r1.WindowTab = 100;
+ − 231 t7r1.WindowX0 = 550;
+ − 232 t7r1.WindowX1 = 799;
+ − 233 t7r1.WindowY0 = t7l1.WindowY0;
+ − 234 t7r1.WindowY1 = 479;
+ − 235
+ − 236 t7r2.Image = &t7screen;
+ − 237 t7r2.WindowNumberOfTextLines = 2;
+ − 238 t7r2.WindowLineSpacing = t7l2.WindowLineSpacing;
+ − 239 t7r2.WindowTab = 100;
+ − 240 t7r2.WindowX0 = 550;
+ − 241 t7r2.WindowX1 = 799;
+ − 242 t7r2.WindowY0 = t7l2.WindowY0;
+ − 243 t7r2.WindowY1 = t7l2.WindowY1;
+ − 244
+ − 245 t7r3.Image = &t7screen;
+ − 246 t7r3.WindowNumberOfTextLines = 2;
+ − 247 t7r3.WindowLineSpacing = 0;//t7l3.WindowLineSpacing;
+ − 248 t7r3.WindowTab = 100;
+ − 249 t7r3.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET;
+ − 250 t7r3.WindowX1 = 799;
+ − 251 t7r3.WindowY0 = t7l3.WindowY0;
+ − 252 t7r3.WindowY1 = t7l3.WindowY1;
+ − 253
+ − 254 t7cC.Image = &t7screen;
+ − 255 t7cC.WindowNumberOfTextLines = 3;
+ − 256 t7cC.WindowLineSpacing = 95; // Abstand von Y0
+ − 257 t7cC.WindowTab = 100;
+ − 258 t7cC.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
+ − 259 t7cC.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET;
+ − 260 t7cC.WindowY0 = 90;
+ − 261 t7cC.WindowY1 = 434 - 95;
+ − 262
+ − 263 t7cH.Image = &t7screen;
+ − 264 t7cH.WindowNumberOfTextLines = 1;
+ − 265 t7cH.WindowLineSpacing = 95; // Abstand von Y0
+ − 266 t7cH.WindowTab = 100;
+ − 267 t7cH.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
+ − 268 t7cH.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET;
+ − 269 t7cH.WindowY0 = 434 - 94;
+ − 270 t7cH.WindowY1 = 434;
+ − 271
+ − 272 t7cW.Image = &t7screen;
+ − 273 t7cW.WindowNumberOfTextLines = 3;
+ − 274 t7cW.WindowLineSpacing = 95; // Abstand von Y0
+ − 275 t7cW.WindowTab = 100;
+ − 276 t7cW.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
+ − 277 t7cW.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET;
+ − 278 t7cW.WindowY0 = 90;
+ − 279 t7cW.WindowY1 = 434 - 95;
+ − 280
+ − 281
+ − 282 t7surfaceL.Image = &t7screen;
+ − 283 t7surfaceL.WindowNumberOfTextLines = 9;
+ − 284 t7surfaceL.WindowLineSpacing = 53;
+ − 285 t7surfaceL.WindowTab = 100;
+ − 286 t7surfaceL.WindowX0 = 0;
+ − 287 t7surfaceL.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET;
+ − 288 t7surfaceL.WindowY0 = 0;
+ − 289 t7surfaceL.WindowY1 = 480;
+ − 290
+ − 291 t7surfaceR.Image = &t7screen;
+ − 292 t7surfaceR.WindowNumberOfTextLines = 9;
+ − 293 t7surfaceR.WindowLineSpacing = 53;
+ − 294 t7surfaceR.WindowTab = 100;
+ − 295 t7surfaceR.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET;
+ − 296 t7surfaceR.WindowX1 = 800;
+ − 297 t7surfaceR.WindowY0 = 0;
+ − 298 t7surfaceR.WindowY1 = 480;
+ − 299
+ − 300 t7cY0free.Image = &t7screen;
+ − 301 t7cY0free.WindowNumberOfTextLines = 1;
+ − 302 t7cY0free.WindowLineSpacing = 95;
+ − 303 t7cY0free.WindowTab = 100;
+ − 304 t7cY0free.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
+ − 305 t7cY0free.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET;
+ − 306 t7cY0free.WindowY0 = 90;
+ − 307 t7cY0free.WindowY1 = 434 - 95;
+ − 308
+ − 309 t7batt.Image = &t7screen;
+ − 310 t7batt.WindowNumberOfTextLines = 1;
+ − 311 t7batt.WindowLineSpacing = 10;
+ − 312 t7batt.WindowTab = 100;
+ − 313 t7batt.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET;
+ − 314 t7batt.WindowX0 = t7batt.WindowX1 - (52+52);
+ − 315 t7batt.WindowY1 = 479;
+ − 316 t7batt.WindowY0 = t7batt.WindowY1 - 25;
+ − 317
+ − 318 t7charge.Image = &t7screen;
+ − 319 t7charge.WindowNumberOfTextLines = 1;
+ − 320 t7charge.WindowLineSpacing = 10;
+ − 321 t7charge.WindowTab = 100;
+ − 322 t7charge.WindowX1 = t7batt.WindowX1 - 18;
+ − 323 t7charge.WindowX0 = t7charge.WindowX1 - 14;
+ − 324 t7charge.WindowY1 = 479;
+ − 325 t7charge.WindowY0 = t7batt.WindowY1 - 25;
+ − 326
+ − 327 t7voltage.Image = &t7screen;
+ − 328 t7voltage.WindowNumberOfTextLines = 1;
+ − 329 t7voltage.WindowLineSpacing = 10;
+ − 330 t7voltage.WindowTab = 100;
145
+ − 331 t7voltage.WindowX0 = t7charge.WindowX0 - 10;
110
+ − 332 t7voltage.WindowX1 = t7voltage.WindowX0 + (18*3)+ 9;
+ − 333 t7voltage.WindowY1 = 479;
+ − 334 t7voltage.WindowY0 = t7batt.WindowY1 - 25;
+ − 335
+ − 336 t7c1.Image = &t7screen;
+ − 337 t7c1.WindowNumberOfTextLines = 1;
+ − 338 t7c1.WindowLineSpacing = 10;
+ − 339 t7c1.WindowTab = 100;
+ − 340 t7c1.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
+ − 341 t7c1.WindowX1 = t7batt.WindowX0 - 18;
+ − 342 t7c1.WindowY0 = 435;
+ − 343 t7c1.WindowY1 = 479;
+ − 344
+ − 345 t7c2.Image = &t7screen;
+ − 346 t7c2.WindowNumberOfTextLines = 1;
+ − 347 t7c2.WindowLineSpacing = 0; // Abstand von Y0
+ − 348 t7c2.WindowTab = 100;
+ − 349 t7c2.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
+ − 350 t7c2.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET;
+ − 351 t7c2.WindowY0 = 0;
+ − 352 t7c2.WindowY1 = 69;
+ − 353
+ − 354 t7pCompass.Image = &t7screenCompass;
+ − 355 t7pCompass.WindowNumberOfTextLines = 1;
+ − 356 t7pCompass.WindowLineSpacing = 100; // Abstand von Y0
+ − 357 t7pCompass.WindowTab = 100;
+ − 358 t7pCompass.WindowX0 = 0;
+ − 359 t7pCompass.WindowX1 = 1600-1;
+ − 360 t7pCompass.WindowY0 = 0;
+ − 361 t7pCompass.WindowY1 = 100-1;
+ − 362 }
+ − 363 else
+ − 364 {
+ − 365 /* 6 segments (left / right) used to show data during dive */
+ − 366
38
+ − 367 t7l1.Image = &t7screen;
+ − 368 t7l1.WindowNumberOfTextLines = 2;
+ − 369 t7l1.WindowLineSpacing = 19; // Abstand von Y0
+ − 370 t7l1.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster
110
+ − 371 t7l1.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET;
+ − 372 t7l1.WindowX1 = 799;
+ − 373 t7l1.WindowY0 = CUSTOMBOX_LINE_TOP;
+ − 374 t7l1.WindowY1 = 150 + TOP_LINE_HIGHT;
38
+ − 375
+ − 376 t7l2.Image = &t7screen;
+ − 377 t7l2.WindowNumberOfTextLines = 2;
884
+ − 378 t7l2.WindowLineSpacing = 12; // Abstand von Y0
38
+ − 379 t7l2.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster
110
+ − 380 t7l2.WindowX0 = t7l1.WindowX0;
38
+ − 381 t7l2.WindowX1 = t7l1.WindowX1;
110
+ − 382 t7l2.WindowY0 = t7l1.WindowY1 + 5;
+ − 383 t7l2.WindowY1 = t7l2.WindowY0 + 146;
38
+ − 384
+ − 385 t7l3.Image = &t7screen;
+ − 386 t7l3.WindowNumberOfTextLines = 2;
+ − 387 t7l3.WindowLineSpacing = 58; // Abstand von Y0
+ − 388 t7l3.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster
110
+ − 389 t7l3.WindowX0 = t7l1.WindowX0;
+ − 390 t7l3.WindowX1 = t7l1.WindowX1;;
+ − 391 t7l3.WindowY0 = 479 - 150;
+ − 392 t7l3.WindowY1 = 479;
38
+ − 393
+ − 394 t7r1.Image = &t7screen;
+ − 395 t7r1.WindowNumberOfTextLines = 2;
+ − 396 t7r1.WindowLineSpacing = t7l1.WindowLineSpacing;
+ − 397 t7r1.WindowTab = 100;
110
+ − 398 t7r1.WindowX0 = 0;
+ − 399 t7r1.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET;
38
+ − 400 t7r1.WindowY0 = t7l1.WindowY0;
110
+ − 401 t7r1.WindowY1 = t7l1.WindowY1;
38
+ − 402
+ − 403 t7r2.Image = &t7screen;
+ − 404 t7r2.WindowNumberOfTextLines = 2;
+ − 405 t7r2.WindowLineSpacing = t7l2.WindowLineSpacing;
+ − 406 t7r2.WindowTab = 100;
110
+ − 407 t7r2.WindowX0 = t7r1.WindowX0;
+ − 408 t7r2.WindowX1 = t7r1.WindowX1;
38
+ − 409 t7r2.WindowY0 = t7l2.WindowY0;
+ − 410 t7r2.WindowY1 = t7l2.WindowY1;
+ − 411
+ − 412 t7r3.Image = &t7screen;
+ − 413 t7r3.WindowNumberOfTextLines = 2;
+ − 414 t7r3.WindowLineSpacing = 0;//t7l3.WindowLineSpacing;
+ − 415 t7r3.WindowTab = 100;
110
+ − 416 t7r3.WindowX0 = t7r1.WindowX0;
+ − 417 t7r3.WindowX1 = t7r1.WindowX1;
38
+ − 418 t7r3.WindowY0 = t7l3.WindowY0;
+ − 419 t7r3.WindowY1 = t7l3.WindowY1;
+ − 420
110
+ − 421 /* screen for CustomText / serial number */
38
+ − 422 t7cC.Image = &t7screen;
+ − 423 t7cC.WindowNumberOfTextLines = 3;
+ − 424 t7cC.WindowLineSpacing = 95; // Abstand von Y0
+ − 425 t7cC.WindowTab = 100;
+ − 426 t7cC.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
+ − 427 t7cC.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET;
110
+ − 428 t7cC.WindowY0 = 165; //90;
+ − 429 t7cC.WindowY1 = 415;
+ − 430
+ − 431 /* used by warning message box */
38
+ − 432 t7cH.Image = &t7screen;
+ − 433 t7cH.WindowNumberOfTextLines = 1;
+ − 434 t7cH.WindowLineSpacing = 95; // Abstand von Y0
+ − 435 t7cH.WindowTab = 100;
+ − 436 t7cH.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
+ − 437 t7cH.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET;
110
+ − 438 t7cH.WindowY0 = 46; //480 - 434;
+ − 439 t7cH.WindowY1 = 390 - 46;// - 90; //46 + 390; //480 - (434 - 94); //434;
+ − 440
+ − 441 /* used by warning custom box */
38
+ − 442 t7cW.Image = &t7screen;
+ − 443 t7cW.WindowNumberOfTextLines = 3;
+ − 444 t7cW.WindowLineSpacing = 95; // Abstand von Y0
+ − 445 t7cW.WindowTab = 100;
+ − 446 t7cW.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
+ − 447 t7cW.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET;
110
+ − 448 t7cW.WindowY0 = 480 - (434 - 90);
+ − 449 t7cW.WindowY1 = 480 - 90; //434 - 95;
+ − 450
+ − 451 /* time and environment */
38
+ − 452 t7surfaceL.Image = &t7screen;
+ − 453 t7surfaceL.WindowNumberOfTextLines = 9;
+ − 454 t7surfaceL.WindowLineSpacing = 53;
+ − 455 t7surfaceL.WindowTab = 100;
110
+ − 456 t7surfaceL.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET;
+ − 457 t7surfaceL.WindowX1 = 799;
38
+ − 458 t7surfaceL.WindowY0 = 0;
110
+ − 459 t7surfaceL.WindowY1 = 479;
38
+ − 460
+ − 461 t7surfaceR.Image = &t7screen;
+ − 462 t7surfaceR.WindowNumberOfTextLines = 9;
+ − 463 t7surfaceR.WindowLineSpacing = 53;
+ − 464 t7surfaceR.WindowTab = 100;
110
+ − 465 t7surfaceR.WindowX0 = 0;
+ − 466 t7surfaceR.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET;
38
+ − 467 t7surfaceR.WindowY0 = 0;
110
+ − 468 t7surfaceR.WindowY1 = 479;
+ − 469
+ − 470 /* info screen in the middle */
38
+ − 471 t7cY0free.Image = &t7screen;
+ − 472 t7cY0free.WindowNumberOfTextLines = 1;
+ − 473 t7cY0free.WindowLineSpacing = 95;
+ − 474 t7cY0free.WindowTab = 100;
+ − 475 t7cY0free.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
+ − 476 t7cY0free.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET;
110
+ − 477 t7cY0free.WindowY0 = 115;
+ − 478 t7cY0free.WindowY1 = 365;
+ − 479
+ − 480 /* voltage value (V or %) */
+ − 481 t7voltage.Image = &t7screen;
+ − 482 t7voltage.WindowNumberOfTextLines = 1;
+ − 483 t7voltage.WindowLineSpacing = 10;
+ − 484 t7voltage.WindowTab = 100;
+ − 485 t7voltage.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
+ − 486 t7voltage.WindowX1 = t7voltage.WindowX0 + (18*3) +9;
+ − 487 t7voltage.WindowY1 = TOP_LINE_HIGHT;
+ − 488 t7voltage.WindowY0 = 0;
+ − 489
+ − 490 /* battery symbol */
38
+ − 491 t7batt.Image = &t7screen;
+ − 492 t7batt.WindowNumberOfTextLines = 1;
+ − 493 t7batt.WindowLineSpacing = 10;
+ − 494 t7batt.WindowTab = 100;
110
+ − 495 t7batt.WindowX0 = t7voltage.WindowX1;
+ − 496 t7batt.WindowX1 = t7batt.WindowX0 + (52);
+ − 497 t7batt.WindowY1 = TOP_LINE_HIGHT;
+ − 498 t7batt.WindowY0 = 0;
+ − 499
+ − 500 /* charger symbol */
38
+ − 501 t7charge.Image = &t7screen;
+ − 502 t7charge.WindowNumberOfTextLines = 1;
+ − 503 t7charge.WindowLineSpacing = 10;
+ − 504 t7charge.WindowTab = 100;
110
+ − 505 t7charge.WindowX1 = t7batt.WindowX0 - 18;
38
+ − 506 t7charge.WindowX0 = t7charge.WindowX1 - 14;
110
+ − 507
+ − 508 t7charge.WindowY1 = TOP_LINE_HIGHT;
+ − 509 t7charge.WindowY0 = 0;
+ − 510
+ − 511 /* show dive mode OC / CC */
38
+ − 512 t7c1.Image = &t7screen;
+ − 513 t7c1.WindowNumberOfTextLines = 1;
+ − 514 t7c1.WindowLineSpacing = 10;
+ − 515 t7c1.WindowTab = 100;
110
+ − 516 t7c1.WindowX0 = t7batt.WindowX1 + 18; //CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
+ − 517 t7c1.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; //t7batt.WindowX1 + 18;
+ − 518 t7c1.WindowY0 = 0;
+ − 519 t7c1.WindowY1 = 479 - 435;
+ − 520
+ − 521 /* Gas warnings and exit Sim*/
38
+ − 522 t7c2.Image = &t7screen;
+ − 523 t7c2.WindowNumberOfTextLines = 1;
+ − 524 t7c2.WindowLineSpacing = 0; // Abstand von Y0
+ − 525 t7c2.WindowTab = 100;
+ − 526 t7c2.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
+ − 527 t7c2.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET;
110
+ − 528 t7c2.WindowY0 = 480 - 69;
+ − 529 t7c2.WindowY1 = 479;
+ − 530
+ − 531 /* Rotating compass */
38
+ − 532 t7pCompass.Image = &t7screenCompass;
+ − 533 t7pCompass.WindowNumberOfTextLines = 1;
+ − 534 t7pCompass.WindowLineSpacing = 100; // Abstand von Y0
+ − 535 t7pCompass.WindowTab = 100;
+ − 536 t7pCompass.WindowX0 = 0;
+ − 537 t7pCompass.WindowX1 = 1600-1;
110
+ − 538 t7pCompass.WindowY0 = 479 - 75;
+ − 539 t7pCompass.WindowY1 = 479;
+ − 540
+ − 541 }
38
+ − 542
+ − 543 init_t7_compass();
+ − 544 }
+ − 545
+ − 546
+ − 547 void t7_refresh_sleepmode_fun(void)
+ − 548 {
+ − 549 uint32_t oldScreen;
+ − 550
+ − 551 oldScreen = t7screen.FBStartAdress;
+ − 552 t7screen.FBStartAdress = getFrame(22);
+ − 553
+ − 554 t7_refresh_sleep_design_fun();
+ − 555
+ − 556 if(get_globalState() == StStop)
+ − 557 {
166
+ − 558 GFX_SetFramesTopBottom(t7screen.FBStartAdress, 0,480);
38
+ − 559 }
+ − 560 releaseFrame(22,oldScreen);
+ − 561 }
+ − 562
+ − 563
+ − 564 void t7_refresh(void)
+ − 565 {
+ − 566 static uint8_t last_mode = MODE_SURFACE;
+ − 567 SStateList status;
+ − 568 get_globalStateList(&status);
+ − 569
+ − 570 t7screen.FBStartAdress = getFrame(22);
+ − 571
+ − 572 background.pointer = 0;
+ − 573
+ − 574 if(stateUsed->mode == MODE_DIVE)
+ − 575 {
837
+ − 576 /* T7 refresh is usally called at start of dive. Based on divesettings the design will be changed and T7 no longer called */
38
+ − 577 if(stateUsed->diveSettings.diveMode == DIVEMODE_Gauge)
+ − 578 {
+ − 579 settingsGetPointer()->design = 5;
+ − 580 releaseAllFramesExcept(22,t7screen.FBStartAdress);
+ − 581 releaseFrame(22,t7screen.FBStartAdress);
+ − 582 return;
+ − 583 }
+ − 584 else if(stateUsed->diveSettings.diveMode == DIVEMODE_Apnea)
+ − 585 {
+ − 586 settingsGetPointer()->design = 6;
+ − 587 releaseAllFramesExcept(22,t7screen.FBStartAdress);
+ − 588 releaseFrame(22,t7screen.FBStartAdress);
+ − 589 return;
+ − 590 }
+ − 591 else
+ − 592 {
837
+ − 593 if(last_mode != MODE_DIVE)
+ − 594 {
+ − 595 last_mode = MODE_DIVE;
+ − 596 /* lower left corner primary */
+ − 597 selection_custom_field = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary;
+ − 598 /* custom view primary OR debug if automatic return is off | T7 is default dive view => also initialize big font view */
+ − 599 if((settingsGetPointer()->tX_customViewTimeout == 0) && (settingsGetPointer()->showDebugInfo))
+ − 600 {
+ − 601 selection_customview = CVIEW_noneOrDebug;
+ − 602 t3_select_customview(CVIEW_noneOrDebug);
+ − 603 }
+ − 604 else
+ − 605 {
+ − 606 selection_customview = settingsGetPointer()->tX_customViewPrimary;
+ − 607 }
+ − 608 t7_change_customview(ACTION_END);
+ − 609
+ − 610 if((settingsGetPointer()->MotionDetection != MOTION_DETECT_OFF))
+ − 611 {
+ − 612 InitMotionDetection();
+ − 613 }
+ − 614
+ − 615 if((settingsGetPointer()->extraDisplay == EXTRADISPLAY_BFACTIVE) && ( settingsGetPointer()->design == 7))
+ − 616 {
+ − 617 settingsGetPointer()->design = 3;
+ − 618 t3_set_customview_to_primary();
+ − 619 releaseAllFramesExcept(22,t7screen.FBStartAdress);
+ − 620 releaseFrame(22,t7screen.FBStartAdress);
+ − 621 set_globalState(StD);
+ − 622 return;
+ − 623 }
+ − 624 }
+ − 625
+ − 626 if(status.page == PageSurface)
+ − 627 set_globalState(StD);
+ − 628
+ − 629 t7_refresh_divemode();
+ − 630 }
38
+ − 631 }
+ − 632 else // from if(stateUsed->mode == MODE_DIVE)
+ − 633 {
+ − 634 if(last_mode != MODE_SURFACE)
+ − 635 {
+ − 636 last_mode = MODE_SURFACE;
+ − 637 selection_customview = customviewsSurface[0];
369
+ − 638 InitMotionDetection();
553
+ − 639 resetFocusState();
38
+ − 640 }
+ − 641 if(status.page == PageDive)
+ − 642 set_globalState(StS);
+ − 643
+ − 644 if(settingsGetPointer()->showDebugInfo)
+ − 645 t7_refresh_surface_debugmode();
+ − 646 else
+ − 647 t7_refresh_surface();
+ − 648 }
+ − 649
+ − 650 tHome_show_lost_connection_count(&t7screen);
+ − 651
+ − 652 if(status.base == BaseHome)
+ − 653 {
+ − 654 if(background.pointer)
+ − 655 {
+ − 656 GFX_SetFrameTop(t7screen.FBStartAdress);
+ − 657 GFX_SetFrameBottom(background.pointer,background.x0 , background.y0, background.width, background.height);
+ − 658 }
+ − 659 else
166
+ − 660 GFX_SetFramesTopBottom(t7screen.FBStartAdress, 0,480);
38
+ − 661 }
+ − 662
+ − 663 releaseAllFramesExcept(22,t7screen.FBStartAdress);
+ − 664 }
+ − 665
+ − 666 /* Private functions ---------------------------------------------------------*/
+ − 667
+ − 668 void t7_fill_surfacetime_helper(SSurfacetime *outArray, uint32_t inputMinutes, uint32_t inputSeconds)
+ − 669 {
+ − 670 inputSeconds += inputMinutes * 60;
+ − 671
+ − 672 outArray->Total = inputSeconds;
+ − 673
+ − 674 outArray->Days = inputSeconds / 86400;// (24*60*60);
+ − 675 inputSeconds -= 86400 * (uint32_t)outArray->Days;
+ − 676
+ − 677 outArray->Hours = inputSeconds / 3600;// (60*60);
+ − 678 inputSeconds -= 3600 * (uint32_t)outArray->Hours;
+ − 679
+ − 680 outArray->Minutes = inputSeconds / 60;;
+ − 681 inputSeconds -= 60 * (uint32_t)outArray->Minutes;
+ − 682
+ − 683 outArray->Seconds = inputSeconds;
+ − 684 }
+ − 685
+ − 686 void t7_refresh_sleep_design_fun(void)
+ − 687 {
+ − 688 static uint16_t state = 0;
+ − 689 uint16_t ytop = 0;
+ − 690
+ − 691 state +=1;
+ − 692 if(state > 800)
+ − 693 state = 1;
+ − 694
+ − 695 if(state > 400)
+ − 696 ytop = 800 - state;
+ − 697 else
+ − 698 ytop = 0 + state;
178
d36596281501
Minor: Replace stupid "Sleep Sleep Sleep" message with something more meaningful
heinrichsweikamp
diff
changeset
+ − 699 Gfx_write_label_var(&t7screen, 300,800, ytop,&FontT48,CLUT_Font020,"Shutting down...");
38
+ − 700 }
+ − 701
+ − 702 void t7_refresh_surface(void)
+ − 703 {
336
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 704 static float debounceAmbientPressure = 0;
672
+ − 705 static uint8_t lastChargeStatus = 0;
38
+ − 706 char text[256];
567
+ − 707 char timeSuffix;
+ − 708 uint8_t hours;
527
+ − 709 uint8_t loop, textIdx;
38
+ − 710 uint8_t date[3], year,month,day;
+ − 711 uint32_t color;
+ − 712 uint8_t customview_warnings = 0;
740
+ − 713 SButtonLock ButtonLockState;
38
+ − 714
+ − 715 RTC_DateTypeDef Sdate;
+ − 716 RTC_TimeTypeDef Stime;
+ − 717 RTC_DateTypeDef SdateFirmware;
+ − 718
+ − 719 uint8_t dateNotSet = 0;
+ − 720
+ − 721 uint8_t oxygen_percentage, gasOffset, actualGasID;
457
+ − 722 #ifdef ENABLE_BOTTLE_SENSOR
442
+ − 723 uint16_t bottleFirstGas_bar;
457
+ − 724 #endif
38
+ − 725 point_t start, stop;//, other;
+ − 726
110
+ − 727 SSettings* pSettings;
+ − 728 pSettings = settingsGetPointer();
+ − 729
+ − 730
38
+ − 731 // update in all customview modes
+ − 732 if(DataEX_check_RTE_version__needs_update() || font_update_required())
+ − 733 updateNecessary = 1;
+ − 734 else
+ − 735 updateNecessary = 0;
+ − 736
+ − 737 /* buttons */
740
+ − 738 ButtonLockState = get_ButtonLock();
+ − 739 if(ButtonLockState == LOCK_OFF)
+ − 740 {
+ − 741 text[0] = TXT_2BYTE;
+ − 742 text[1] = TXT2BYTE_ButtonLogbook;
+ − 743 text[2] = 0;
+ − 744 write_content_simple(&t7screen, 0, 799, 479-TOP_LINE_HIGHT, &FontT24,text,CLUT_ButtonSurfaceScreen);
+ − 745
+ − 746 text[0] = '\001';
+ − 747 text[1] = TXT_2BYTE;
+ − 748 text[2] = TXT2BYTE_ButtonView;
+ − 749 text[3] = 0;
+ − 750 write_content_simple(&t7screen, 0, 799, 479-TOP_LINE_HIGHT, &FontT24,text,CLUT_ButtonSurfaceScreen);
+ − 751
+ − 752 text[0] = '\002';
+ − 753 text[1] = TXT_2BYTE;
+ − 754 text[2] = TXT2BYTE_ButtonMenu;
+ − 755 text[3] = 0;
+ − 756 write_content_simple(&t7screen, 0, 799, 479-TOP_LINE_HIGHT, &FontT24,text,CLUT_ButtonSurfaceScreen);
+ − 757 }
+ − 758 else
+ − 759 {
+ − 760 switch(ButtonLockState)
+ − 761 {
+ − 762 default:
+ − 763 case LOCK_1: snprintf(text,255,"\a\001 ");
+ − 764 break;
+ − 765 case LOCK_2: snprintf(text,255,"\a\002 ");
+ − 766 break;
+ − 767 case LOCK_3: snprintf(text,255,"\a ");
+ − 768 break;
+ − 769 }
+ − 770 write_content_simple(&t7screen, 0, 799, 479-TOP_LINE_HIGHT, &FontT24,text,CLUT_ButtonSurfaceScreen);
+ − 771 // GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow);
+ − 772 }
38
+ − 773 /* was power on reset */
+ − 774 //.....
+ − 775 /* removed hw 160802 in V1.1.1
+ − 776 if(errorsInSettings)
+ − 777 {
+ − 778 sprintf(text,"Settings: %u",errorsInSettings);
+ − 779 GFX_write_string_color(&FontT42,&t7surfaceR,text,4,CLUT_WarningRed);
+ − 780 }
+ − 781 else
+ − 782 */
662
+ − 783 if(DataEX_was_power_on()) {
38
+ − 784 GFX_write_string_color(&FontT42,&t7surfaceR,"cold start",4,CLUT_WarningRed);
662
+ − 785 }
38
+ − 786
+ − 787 /* time and date */
+ − 788 translateDate(stateUsed->lifeData.dateBinaryFormat, &Sdate);
+ − 789 translateTime(stateUsed->lifeData.timeBinaryFormat, &Stime);
+ − 790
+ − 791 firmwareGetDate(&SdateFirmware);
+ − 792 if(tHome_DateCode(&Sdate) < tHome_DateCode(&SdateFirmware))
+ − 793 dateNotSet = 1;
+ − 794 else
+ − 795 dateNotSet = 0;
+ − 796 /*
+ − 797 if(Stime.Seconds % 2)
+ − 798 snprintf(text,255,"\001%02d:%02d",Stime.Hours,Stime.Minutes);
+ − 799 else
527
+ − 800 snprintf(text,255,"\001%02d\031:\020%02d",Stime.Hours,Stime.Minutes);
38
+ − 801 GFX_write_string(&FontT54,&t7surfaceR,text,3);
+ − 802 */
+ − 803 // debug version:
567
+ − 804
+ − 805 if (settingsGetPointer()->amPMTime)
+ − 806 {
+ − 807 if (Stime.Hours > 11)
+ − 808 {
+ − 809 timeSuffix = 'P';
+ − 810 }
+ − 811 else
+ − 812 {
+ − 813 timeSuffix = 'A';
+ − 814 }
+ − 815
+ − 816 if (Stime.Hours % 12 == 0)
+ − 817 {
+ − 818 hours = 12;
+ − 819 }
+ − 820 else
+ − 821 {
+ − 822 hours = (Stime.Hours % 12);
+ − 823 }
+ − 824
+ − 825 if(Stime.Seconds % 2)
+ − 826 snprintf(text,255,"\001%02d:%02d:%02d\016\016%cM\017",hours,Stime.Minutes,Stime.Seconds,timeSuffix);
+ − 827 else if(dateNotSet)
+ − 828 snprintf(text,255,"\001\031%02d:%02d:%02d\016\016%cM\017\020",hours,Stime.Minutes,Stime.Seconds,timeSuffix);
+ − 829 else
+ − 830 snprintf(text,255,"\001%02d\031:\020%02d:%02d\016\016%cM\017",hours,Stime.Minutes,Stime.Seconds,timeSuffix);
+ − 831 GFX_write_string(&FontT48,&t7surfaceR,text,3);
+ − 832 }
38
+ − 833 else
567
+ − 834 {
+ − 835 if(Stime.Seconds % 2)
+ − 836 snprintf(text,255,"\001%02d:%02d:%02d",Stime.Hours,Stime.Minutes,Stime.Seconds);
+ − 837 else if(dateNotSet)
+ − 838 snprintf(text,255,"\001\031%02d:%02d:%02d\020",Stime.Hours,Stime.Minutes,Stime.Seconds);
+ − 839 else
+ − 840 snprintf(text,255,"\001%02d\031:\020%02d:%02d",Stime.Hours,Stime.Minutes,Stime.Seconds);
+ − 841 GFX_write_string(&FontT54,&t7surfaceR,text,3);
+ − 842 }
38
+ − 843
+ − 844 if(settingsGetPointer()->date_format == DDMMYY)
+ − 845 {
+ − 846 day = 0;
+ − 847 month = 1;
+ − 848 year = 2;
+ − 849 }
+ − 850 else
+ − 851 if(settingsGetPointer()->date_format == MMDDYY)
+ − 852 {
+ − 853 day = 1;
+ − 854 month = 0;
+ − 855 year = 2;
+ − 856 }
+ − 857 else
+ − 858 {
+ − 859 day = 2;
+ − 860 month = 1;
+ − 861 year = 0;
+ − 862 }
+ − 863 date[day] = Sdate.Date;
+ − 864 date[month] = Sdate.Month;
+ − 865 date[year] = Sdate.Year;
+ − 866
+ − 867 if((Stime.Seconds % 2) || (dateNotSet == 0))
+ − 868 snprintf(text,255,"\001%02d.%02d.%02d",date[0],date[1],date[2]);
+ − 869 else
527
+ − 870 snprintf(text,255,"\001\031%02d.%02d.%02d",date[0],date[1],date[2]);
38
+ − 871
+ − 872 GFX_write_string(&FontT54,&t7surfaceR,text,5);
+ − 873
+ − 874 if(!DataEX_was_power_on() && !errorsInSettings)
+ − 875 {
+ − 876 text[0] = '\001';
+ − 877 text[1] = '\004';
481
+ − 878 text[2] = '\016';
+ − 879 text[3] = '\016';
+ − 880 text[4] = TXT_2BYTE;
+ − 881 text[5] = TXT2BYTE_Sunday;
+ − 882 text[6] = 0;
38
+ − 883 if(Sdate.WeekDay != RTC_WEEKDAY_SUNDAY)
481
+ − 884 text[5] += Sdate.WeekDay;
38
+ − 885
+ − 886 if(!(Stime.Seconds % 2) && (dateNotSet == 1))
527
+ − 887 text[1] = '\031';
38
+ − 888
481
+ − 889 GFX_write_string(&FontT48,&t7surfaceR,text,4);
38
+ − 890 }
+ − 891
+ − 892 /* DEBUG uTick Pressure and Compass */
+ − 893 /*
+ − 894 snprintf(text,255,"\001%u",stateRealGetPointer()->pressure_uTick_new - stateRealGetPointer()->pressure_uTick_old);
+ − 895 GFX_write_string(&FontT42,&t7surfaceR,text,1);
+ − 896 snprintf(text,255,"\001%u",HAL_GetTick() - stateRealGetPointer()->pressure_uTick_local_new);
+ − 897 GFX_write_string(&FontT42,&t7surfaceR,text,2);
+ − 898
+ − 899 snprintf(text,255,"\001%u",stateRealGetPointer()->compass_uTick_new - stateRealGetPointer()->compass_uTick_old);
+ − 900 GFX_write_string(&FontT42,&t7surfaceR,text,6);
+ − 901 snprintf(text,255,"\001%u",HAL_GetTick() - stateRealGetPointer()->compass_uTick_local_new);
+ − 902 GFX_write_string(&FontT42,&t7surfaceR,text,7);
+ − 903
+ − 904 static uint32_t bildschirmRefresh = 0;
+ − 905 snprintf(text,255,"\001%u",HAL_GetTick() - bildschirmRefresh);
+ − 906 GFX_write_string(&FontT42,&t7surfaceR,text,8);
+ − 907 bildschirmRefresh = HAL_GetTick();
+ − 908
+ − 909 static uint16_t bildschirmRefreshCount = 1;
+ − 910 if(bildschirmRefreshCount>10)
+ − 911 bildschirmRefreshCount = 1;
+ − 912 for(int i=0;i<bildschirmRefreshCount;i++)
+ − 913 text[i] = '.';
+ − 914 text[bildschirmRefreshCount++] = 0;
+ − 915 GFX_write_string(&FontT42,&t7surfaceR,text,4);
+ − 916 */
+ − 917
+ − 918 /* noFlyTime or DesaturationTime */
477
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 919 if((stateUsed->lifeData.no_fly_time_minutes) && ((!display_count_high_time) || (stateUsed->lifeData.desaturation_time_minutes == 0)))
38
+ − 920 {
+ − 921 SSurfacetime NoFlyTime = {0,0,0,0};
+ − 922 t7_fill_surfacetime_helper(&NoFlyTime,stateUsed->lifeData.no_fly_time_minutes, 0);
+ − 923
+ − 924 if(NoFlyTime.Days)
+ − 925 {
+ − 926 snprintf(text,30,"\001%02d\016\016d\017 %02d\016\016h\017",NoFlyTime.Days, NoFlyTime.Hours);
+ − 927 }
+ − 928 else
+ − 929 {
+ − 930 snprintf(text,20,"\001%02d:%02d",NoFlyTime.Hours, NoFlyTime.Minutes);
+ − 931 }
+ − 932
+ − 933 GFX_write_string(&FontT54,&t7surfaceR,text,7);
+ − 934
+ − 935 text[0] = '\001';
+ − 936 text[1] = '\022';
+ − 937 text[2] = '\016';
+ − 938 text[3] = '\016';
+ − 939 text[4] = TXT_2BYTE;
+ − 940 text[5] = TXT2BYTE_noFly;
+ − 941 text[6] = 0;
+ − 942 GFX_write_string(&FontT48,&t7surfaceR,text,6);
+ − 943 }
+ − 944 else
+ − 945 if(stateUsed->lifeData.desaturation_time_minutes)
+ − 946 {
+ − 947 SSurfacetime DesatTime = {0,0,0,0};
+ − 948 t7_fill_surfacetime_helper(&DesatTime,stateUsed->lifeData.desaturation_time_minutes, 0);
+ − 949
+ − 950 if(DesatTime.Days)
+ − 951 {
+ − 952 snprintf(text,30,"\001%02d\016\016d\017 %02d\016\016h\017",DesatTime.Days, DesatTime.Hours);
+ − 953 }
+ − 954 else
+ − 955 {
+ − 956 snprintf(text,20,"\001%02d:%02d",DesatTime.Hours, DesatTime.Minutes);
+ − 957 }
+ − 958 GFX_write_string(&FontT54,&t7surfaceR,text,7);
+ − 959
+ − 960 text[0] = '\001';
+ − 961 text[1] = '\022';
+ − 962 text[2] = '\016';
+ − 963 text[3] = '\016';
+ − 964 text[4] = TXT_2BYTE;
+ − 965 text[5] = TXT2BYTE_Desaturation;
+ − 966 text[6] = 0;
+ − 967 GFX_write_string(&FontT48,&t7surfaceR,text,6);
+ − 968 }
+ − 969
+ − 970 /* Time since last dive */
+ − 971 if(stateUsed->lifeData.surface_time_seconds)
+ − 972 {
+ − 973 SSurfacetime SurfTime = {0,0,0,0};
+ − 974 t7_fill_surfacetime_helper(&SurfTime, 0, stateUsed->lifeData.surface_time_seconds);
+ − 975
+ − 976 if(SurfTime.Days == 0)
+ − 977 {
+ − 978 snprintf(text,20,"\001\022%02d:%02d",SurfTime.Hours, SurfTime.Minutes);
+ − 979 }
+ − 980 else
+ − 981 {
+ − 982 snprintf(text,30,"\001\022%02d\016\016d\017 %02d\016\016h\017",SurfTime.Days, SurfTime.Hours);
+ − 983 }
+ − 984
+ − 985 GFX_write_string(&FontT54,&t7surfaceR,text,2);
+ − 986
+ − 987
+ − 988 text[0] = '\001';
+ − 989 text[1] = '\022';
+ − 990 text[2] = '\016';
+ − 991 text[3] = '\016';
+ − 992 text[4] = TXT_2BYTE;
+ − 993 text[5] = TXT2BYTE_TimeSinceLastDive;
+ − 994 text[6] = 0;
+ − 995 GFX_write_string(&FontT48,&t7surfaceR,text,1);
+ − 996 }
+ − 997
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 998 if (stateUsed->timerState == TIMER_STATE_RUNNING && selection_customview != CVIEW_Timer) {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 999 int timerRemainingS = pSettings->timerDurationS - (current_second() - stateUsed->timerStartedS);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 1000 snprintf(text, 20, "\001%u:%02u", timerRemainingS / 60, timerRemainingS % 60);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 1001 GFX_write_string(&FontT54, &t7surfaceR, text, 8);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 1002 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 1003
38
+ − 1004 /* beta version */
+ − 1005 if( firmwareDataGetPointer()->versionBeta )
+ − 1006 {
+ − 1007 snprintf(text,255,"\025 BETA");
+ − 1008 GFX_write_string(&FontT48,&t7surfaceL,text,2);
+ − 1009 }
+ − 1010
+ − 1011 /* surface pressure and temperature */
+ − 1012 if(stateUsed->sensorErrorsRTE == 0)
+ − 1013 {
336
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 1014 if(fabs(stateUsed->lifeData.pressure_surface_bar - stateUsed->lifeData.pressure_ambient_bar) < SHOW_AMBIENTE_SURFACE_DELTA) /* show ambient pressure if difference to surface is significant*/
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 1015 {
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 1016 snprintf(text,30,"%01.0f\022\016\016 %s", stateUsed->lifeData.pressure_surface_bar * 1000.0f,TEXT_PRESSURE_UNIT);
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 1017 }
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 1018 else
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 1019 {
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 1020 if(fabsf(debounceAmbientPressure - stateUsed->lifeData.pressure_ambient_bar) > SHOW_AMBIENTE_DEBOUNCE) /* there might be a jitter ~+-1 HPa on the pressure signal => update only if delta is bigger */
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 1021 {
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 1022 debounceAmbientPressure = stateUsed->lifeData.pressure_ambient_bar;
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 1023 }
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 1024 snprintf(text,30,"%01.0f\022\016\016 %s", debounceAmbientPressure * 1000.0f,TEXT_PRESSURE_UNIT);
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 1025 }
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 1026
38
+ − 1027 GFX_write_string(&FontT48,&t7surfaceL,text,3);
+ − 1028
+ − 1029 if(settingsGetPointer()->nonMetricalSystem)
+ − 1030 snprintf(text,40,"%01.0f\140\022\016\016 fahrenheit",unit_temperature_float(stateUsed->lifeData.temperature_celsius));
+ − 1031 else
+ − 1032 snprintf(text,30,"%01.0f\140\022\016\016 celsius",stateUsed->lifeData.temperature_celsius);
+ − 1033 GFX_write_string(&FontT48,&t7surfaceL,text,4);
+ − 1034 }
+ − 1035 else
+ − 1036 {
103
+ − 1037 snprintf(text,30,"ERR\022\016\016 %s",TEXT_PRESSURE_UNIT);
38
+ − 1038 GFX_write_string(&FontT48,&t7surfaceL,text,3);
+ − 1039
+ − 1040 if(settingsGetPointer()->nonMetricalSystem)
+ − 1041 snprintf(text,40,"ERR\022\016\016 fahrenheit");
+ − 1042 else
+ − 1043 snprintf(text,30,"ERR\022\016\016 celsius");
+ − 1044 GFX_write_string(&FontT48,&t7surfaceL,text,4);
+ − 1045 }
+ − 1046
+ − 1047
+ − 1048 /* gas mix and selection */
+ − 1049 if((stateUsed->diveSettings.diveMode == DIVEMODE_Gauge) || (stateUsed->diveSettings.diveMode == DIVEMODE_Apnea))
+ − 1050 {
+ − 1051 if(stateUsed->diveSettings.diveMode == DIVEMODE_Gauge)
+ − 1052 text[0] = TXT_Gauge;
+ − 1053 else
+ − 1054 text[0] = TXT_Apnoe;
+ − 1055
+ − 1056 text[1] = 0;
+ − 1057 GFX_write_string(&FontT48,&t7surfaceL,text,6);
+ − 1058 }
+ − 1059 else
+ − 1060 {
527
+ − 1061 textIdx = 0;
662
+ − 1062 if(isLoopMode(stateUsed->diveSettings.diveMode))
38
+ − 1063 gasOffset = NUM_OFFSET_DILUENT;
+ − 1064 else
+ − 1065 gasOffset = 0;
527
+ − 1066
+ − 1067 /* Display gas setup */
+ − 1068 for(loop = 1; loop <= NUM_GASES; loop++)
+ − 1069 {
+ − 1070 #ifdef ENABLE_UNUSED_GAS_HIDING
+ − 1071 if(stateUsed->diveSettings.gas[loop+gasOffset].note.ub.off)
+ − 1072 {
+ − 1073 text[textIdx++] = '\021';
+ − 1074 }
+ − 1075 else
+ − 1076 #endif
+ − 1077 if(stateUsed->diveSettings.gas[loop+gasOffset].note.ub.active)
+ − 1078 {
+ − 1079 text[textIdx++]= '\020';
+ − 1080 }
+ − 1081 else
+ − 1082 {
+ − 1083 text[textIdx++]= '\031';
+ − 1084 }
+ − 1085
+ − 1086 text[textIdx++] = '0' + loop;
+ − 1087 text[textIdx++] = '\177';
+ − 1088 text[textIdx++] = '\177';
+ − 1089 text[textIdx++] = 10;
+ − 1090 }
+ − 1091 text[textIdx++] = 0;
38
+ − 1092 GFX_write_string(&FontT48,&t7surfaceL,text,6);
+ − 1093
+ − 1094
+ − 1095 oxygen_percentage = 100;
+ − 1096 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage;
+ − 1097 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage;
+ − 1098
+ − 1099 tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&text[0]);
+ − 1100 GFX_write_string(&FontT48,&t7surfaceL,text,7);
+ − 1101
+ − 1102 actualGasID = stateUsed->lifeData.actualGas.GasIdInSettings;
442
+ − 1103
448
+ − 1104 #ifdef ENABLE_BOTTLE_SENSOR
38
+ − 1105 bottleFirstGas_bar = stateUsed->lifeData.bottle_bar[actualGasID];
+ − 1106 if(bottleFirstGas_bar)
+ − 1107 {
+ − 1108 snprintf(text,255,"%3u\022\016\016 bar",bottleFirstGas_bar);
+ − 1109 GFX_write_string(&FontT48,&t7surfaceL,text,8);
+ − 1110 }
448
+ − 1111 #endif
38
+ − 1112 // after gas name :-)
+ − 1113 if(actualGasID > gasOffset) // security
+ − 1114 {
110
+ − 1115 if(!pSettings->FlipDisplay)
+ − 1116 {
+ − 1117 start.y = t7surfaceL.WindowY0 + (3 * t7surfaceL.WindowLineSpacing);
+ − 1118 start.x = t7surfaceL.WindowX0 + ((stateUsed->lifeData.actualGas.GasIdInSettings - gasOffset - 1) * 35);
+ − 1119 }
+ − 1120 else
+ − 1121 {
+ − 1122 start.y = t7surfaceR.WindowY0 + (3 * t7surfaceR.WindowLineSpacing);
+ − 1123 start.x = t7surfaceR.WindowX0 + ((stateUsed->lifeData.actualGas.GasIdInSettings - gasOffset - 1) * 35);
+ − 1124 }
+ − 1125
38
+ − 1126 stop.x = start.x + 25;
+ − 1127 stop.y = start.y + 52;
+ − 1128 GFX_draw_box2(&t7screen, start, stop, CLUT_Font020, 1);
+ − 1129 }
+ − 1130 }
+ − 1131
+ − 1132 /* dive mode */
193
+ − 1133 switch (stateUsed->diveSettings.diveMode) {
+ − 1134 case DIVEMODE_CCR:
+ − 1135 GFX_write_string(&FontT24, &t7c1, "\f\002" "CCR", 0);
+ − 1136 break;
662
+ − 1137 case DIVEMODE_PSCR:
+ − 1138 GFX_write_string(&FontT24, &t7c1, "\f\002" "PSCR", 0);
+ − 1139 break;
193
+ − 1140 case DIVEMODE_OC:
+ − 1141 GFX_write_string(&FontT24, &t7c1, "\f\002" "OC", 0);
+ − 1142 break;
+ − 1143 case DIVEMODE_Gauge:
+ − 1144 GFX_write_string(&FontT24, &t7c1, "\f\002" "Gauge", 0);
+ − 1145 break;
+ − 1146 case DIVEMODE_Apnea:
+ − 1147 GFX_write_string(&FontT24, &t7c1, "\f\002" "Apnea", 0);
+ − 1148 break;
+ − 1149 default:
+ − 1150 GFX_write_string(&FontT24, &t7c1, "\f\002" "OC", 0);
+ − 1151 }
38
+ − 1152
+ − 1153 /*battery */
+ − 1154
+ − 1155 text[0] = '3';
+ − 1156 text[1] = '1';
+ − 1157 text[2] = '1';
+ − 1158 text[3] = '1';
+ − 1159 text[4] = '1';
+ − 1160 text[5] = '1';
+ − 1161 text[6] = '1';
+ − 1162 text[7] = '1';
+ − 1163 text[8] = '1';
+ − 1164 text[9] = '1';
+ − 1165 text[10] = '1';
+ − 1166 text[11] = '0';
+ − 1167 text[12] = 0;
+ − 1168
+ − 1169 for(int i=1;i<=10;i++)
+ − 1170 {
+ − 1171 if( stateUsed->lifeData.battery_charge > (9 * i))
+ − 1172 text[i] += 1;
+ − 1173 }
+ − 1174
+ − 1175 if(stateUsed->chargeStatus == CHARGER_off)
+ − 1176 {
+ − 1177 if(stateUsed->warnings.lowBattery)
+ − 1178 {
+ − 1179 if(warning_count_high_time)
+ − 1180 {
+ − 1181 for(int i=1;i<=10;i++)
+ − 1182 text[i] = '1';
+ − 1183 }
+ − 1184 else
+ − 1185 {
+ − 1186 text[1] = '2';
+ − 1187 }
+ − 1188 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_WarningRed);
+ − 1189 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140))
+ − 1190 {
448
+ − 1191 #ifdef ALWAYS_SHOW_VOLTAGE
432
+ − 1192 // show battery percent and voltage
+ − 1193 snprintf(text,16,"\f\002%u%% \f%.1fV",(uint8_t)stateUsed->lifeData.battery_charge,stateUsed->lifeData.battery_voltage);
448
+ − 1194 #else
+ − 1195 snprintf(text,16,"\004\025\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge);
+ − 1196 #endif
38
+ − 1197 if(warning_count_high_time)
+ − 1198 text[0] = '\a';
110
+ − 1199 GFX_write_string(&FontT24,&t7voltage,text,0);
38
+ − 1200 }
+ − 1201 else
+ − 1202 {
+ − 1203 snprintf(text,6,"\f%.1fV",stateUsed->lifeData.battery_voltage);
+ − 1204 GFX_write_string(&FontT24,&t7voltage,text,0);
+ − 1205 }
+ − 1206 }
+ − 1207 else
+ − 1208 {
+ − 1209 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_BatteryStandard);
+ − 1210
+ − 1211 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140))
+ − 1212 {
448
+ − 1213 #ifdef ALWAYS_SHOW_VOLTAGE
432
+ − 1214 // show battery percent and voltage
+ − 1215 snprintf(text,16,"\f\002%u%% \f%.1fV",(uint8_t)stateUsed->lifeData.battery_charge,stateUsed->lifeData.battery_voltage);
448
+ − 1216 #else
+ − 1217 snprintf(text,16,"\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge);
+ − 1218 #endif
110
+ − 1219 GFX_write_string(&FontT24,&t7voltage,text,0);
38
+ − 1220 }
+ − 1221 else
+ − 1222 {
+ − 1223 snprintf(text,6,"\f%.1fV",stateUsed->lifeData.battery_voltage);
+ − 1224 GFX_write_string(&FontT24,&t7voltage,text,0);
+ − 1225 }
+ − 1226 }
+ − 1227 }
+ − 1228 else
+ − 1229 {
672
+ − 1230 if(lastChargeStatus == CHARGER_off)
+ − 1231 {
+ − 1232 t7_select_customview(CVIEW_Charger);
+ − 1233 }
+ − 1234
38
+ − 1235 GFX_write_string_color(&Batt24,&t7batt,text,0,CLUT_BatteryCharging);
+ − 1236
+ − 1237 switch(stateUsed->chargeStatus)
+ − 1238 {
+ − 1239 case CHARGER_running:
+ − 1240 default:
+ − 1241 color = CLUT_BatteryStandard;
+ − 1242 break;
+ − 1243 case CHARGER_complete:
+ − 1244 color = CLUT_BatteryCharging;
+ − 1245 break;
+ − 1246 case CHARGER_lostConnection:
+ − 1247 color = CLUT_BatteryProblem;
+ − 1248 break;
+ − 1249 }
+ − 1250 text[0] = '4';
+ − 1251 text[1] = 0;
+ − 1252 GFX_write_string_color(&Batt24,&t7charge,text,0,color);
+ − 1253 }
+ − 1254
672
+ − 1255 lastChargeStatus = stateUsed->chargeStatus;
38
+ − 1256
+ − 1257
+ − 1258 customview_warnings = t7_test_customview_warnings_surface_mode();
+ − 1259 if(customview_warnings && warning_count_high_time)
+ − 1260 t7_show_customview_warnings_surface_mode();
+ − 1261 else
+ − 1262 t7_refresh_customview();
+ − 1263 draw_frame(0,0, CLUT_pluginboxSurface, CLUT_Font020);
+ − 1264 }
+ − 1265
+ − 1266 void t7_refresh_surface_debugmode(void)
+ − 1267 {
+ − 1268 // could be warning, now just to set RTE variables
+ − 1269 DataEX_check_RTE_version__needs_update();
+ − 1270
+ − 1271
+ − 1272 char TextL1[4*TEXTSIZE];
+ − 1273 uint32_t color;
+ − 1274 // uint8_t gasIdFirst;
+ − 1275 SSettings* pSettings = settingsGetPointer();
198
+ − 1276 SDataExchangeSlaveToMaster *dataIn = get_dataInPointer();
38
+ − 1277
+ − 1278 SWindowGimpStyle windowGimp;
+ − 1279
+ − 1280 RTC_DateTypeDef Sdate;
+ − 1281 RTC_TimeTypeDef Stime;
+ − 1282
+ − 1283 translateDate(stateUsed->lifeData.dateBinaryFormat, &Sdate);
+ − 1284 translateTime(stateUsed->lifeData.timeBinaryFormat, &Stime);
+ − 1285
+ − 1286
+ − 1287 if(stateUsed->data_old__lost_connection_to_slave)
+ − 1288 {
+ − 1289 Gfx_write_label_var(&t7screen, 500,800, 0,&FontT42,CLUT_DiveMainLabel,"old");
198
+ − 1290 snprintf(TextL1,TEXTSIZE,"%X %X %X %X",dataIn->header.checkCode[0],dataIn->header.checkCode[1],dataIn->header.checkCode[2],dataIn->header.checkCode[3]);
38
+ − 1291 Gfx_write_label_var(&t7screen, 500,800, 45,&FontT48,CLUT_Font020,TextL1);
+ − 1292 }
+ − 1293 else
+ − 1294 if(DataEX_lost_connection_count())
+ − 1295 {
336
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 1296 snprintf(TextL1,TEXTSIZE,"\002%ld",DataEX_lost_connection_count());
38
+ − 1297 Gfx_write_label_var(&t7screen, 600,800, 45,&FontT48,CLUT_Font020,TextL1);
+ − 1298 }
+ − 1299
+ − 1300 snprintf(TextL1,TEXTSIZE,"\002%i",blockedFramesCount());
+ − 1301 Gfx_write_label_var(&t7screen, 600,800, 0,&FontT48,CLUT_Font020,TextL1);
+ − 1302
+ − 1303 if(stateUsed->lifeData.compass_DX_f | stateUsed->lifeData.compass_DY_f | stateUsed->lifeData.compass_DZ_f)
+ − 1304 {
+ − 1305 snprintf(TextL1,TEXTSIZE,"X %i",stateUsed->lifeData.compass_DX_f);
+ − 1306 Gfx_write_label_var(&t7screen, 0,400, 45,&FontT48,CLUT_Font020,TextL1);
+ − 1307 snprintf(TextL1,TEXTSIZE,"Y %i",stateUsed->lifeData.compass_DY_f);
+ − 1308 Gfx_write_label_var(&t7screen, 0,400,145,&FontT48,CLUT_Font020,TextL1);
+ − 1309 snprintf(TextL1,TEXTSIZE,"Z %i",stateUsed->lifeData.compass_DZ_f);
+ − 1310 Gfx_write_label_var(&t7screen, 0,400,255,&FontT48,CLUT_Font020,TextL1);
+ − 1311 return;
+ − 1312 }
103
+ − 1313 snprintf(TextL1,TEXTSIZE,"%01.0f %s",stateUsed->lifeData.pressure_ambient_bar * 1000.0f,TEXT_PRESSURE_UNIT);
38
+ − 1314 Gfx_write_label_var(&t7screen, 0,400, 0,&FontT42,CLUT_DiveMainLabel,"Ambient Pressure");
+ − 1315 Gfx_write_label_var(&t7screen, 0,400, 45,&FontT48,CLUT_Font020,TextL1);
+ − 1316
+ − 1317 snprintf(TextL1,TEXTSIZE,"%01.2f C",stateUsed->lifeData.temperature_celsius);
+ − 1318 Gfx_write_label_var(&t7screen, 0,400,100,&FontT42,CLUT_DiveMainLabel,"Temperature");
+ − 1319 Gfx_write_label_var(&t7screen, 0,400,145,&FontT48,CLUT_Font020,TextL1);
+ − 1320
+ − 1321 snprintf(TextL1,TEXTSIZE,"%03.0f %03.0f %03.0f",stateUsed->lifeData.compass_heading,stateUsed->lifeData.compass_roll,stateUsed->lifeData.compass_pitch);
+ − 1322 Gfx_write_label_var(&t7screen, 0,400,200,&FontT42,CLUT_DiveMainLabel,"Heading Roll Pitch");
+ − 1323 Gfx_write_label_var(&t7screen, 0,400,255,&FontT48,CLUT_Font020,TextL1);
+ − 1324
103
+ − 1325 snprintf(TextL1,TEXTSIZE,"%01.0f %s",stateUsed->lifeData.pressure_surface_bar * 1000.0f,TEXT_PRESSURE_UNIT);
38
+ − 1326 Gfx_write_label_var(&t7screen, 0,400,310,&FontT42,CLUT_DiveMainLabel,"Surface Pressure");
+ − 1327 Gfx_write_label_var(&t7screen, 0,400,355,&FontT48,CLUT_Font020,TextL1);
+ − 1328
+ − 1329 // gasIdFirst = stateUsed->lifeData.actualGas.GasIdInSettings;
198
+ − 1330 snprintf(TextL1,TEXTSIZE,"%u.%u",dataIn->RTE_VERSION_high,dataIn->RTE_VERSION_low);
38
+ − 1331 Gfx_write_label_var(&t7screen, 320,500,100,&FontT42,CLUT_DiveMainLabel,"RTE");
+ − 1332 Gfx_write_label_var(&t7screen, 320,500,145,&FontT48,CLUT_Font020,TextL1);
+ − 1333
+ − 1334 Gfx_write_label_var(&t7screen, 500,800,100,&FontT42,CLUT_DiveMainLabel,"Battery");
+ − 1335 snprintf(TextL1,TEXTSIZE,"%01.4f V",stateUsed->lifeData.battery_voltage);
+ − 1336 Gfx_write_label_var(&t7screen, 500,800,145,&FontT48,CLUT_Font020,TextL1);
+ − 1337 snprintf(TextL1,TEXTSIZE,"%03.1f %%",stateUsed->lifeData.battery_charge);
+ − 1338 Gfx_write_label_var(&t7screen, 500,800,200,&FontT48,CLUT_Font020,TextL1);
+ − 1339 if(stateUsed->chargeStatus != CHARGER_off)
+ − 1340 {
+ − 1341 switch(stateUsed->chargeStatus)
+ − 1342 {
+ − 1343 case CHARGER_running:
+ − 1344 default:
+ − 1345 color = CLUT_BatteryStandard;
+ − 1346 break;
+ − 1347 case CHARGER_complete:
+ − 1348 color = CLUT_BatteryCharging;
+ − 1349 break;
+ − 1350 case CHARGER_lostConnection:
+ − 1351 color = CLUT_BatteryProblem;
+ − 1352 break;
+ − 1353 }
+ − 1354 TextL1[0] = '4';
+ − 1355 TextL1[1] = 0;
+ − 1356 Gfx_write_label_var(&t7screen, 660,800,200,&Batt24,color,TextL1);
+ − 1357 }
+ − 1358
+ − 1359 extern uint32_t base_tempLightLevel;
+ − 1360
336
449e9e9632e4
Show actual instead of surface (30minute old) pressure if the actual differs significant (e.g. in plane or during pressure testing)
ideenmodellierer
diff
changeset
+ − 1361 snprintf(TextL1,TEXTSIZE,"# %u (%ld)",stateUsed->lifeData.ambient_light_level, base_tempLightLevel);
38
+ − 1362 Gfx_write_label_var(&t7screen, 401,600,310,&FontT42,CLUT_DiveMainLabel,"Light");
+ − 1363 Gfx_write_label_var(&t7screen, 401,800,355,&FontT48,CLUT_Font020,TextL1);
+ − 1364
+ − 1365 // snprintf(TextL1,TEXTSIZE,"# %u",stateUsed->lifeData.ambient_light_level);
+ − 1366 // Gfx_write_label_var(&t7screen, 601,800,310,&FontT42,CLUT_DiveMainLabel,"Light");
+ − 1367 // Gfx_write_label_var(&t7screen, 601,800,355,&FontT48,CLUT_Font020,TextL1);
+ − 1368
348
+ − 1369 /* show surface pressure state */
+ − 1370 if(stateUsed->lifeData.bool_temp1 )
+ − 1371 {
+ − 1372 snprintf(TextL1,TEXTSIZE,"stable");
+ − 1373 }
+ − 1374 else
+ − 1375 {
+ − 1376 snprintf(TextL1,TEXTSIZE,"unstable");
+ − 1377 }
+ − 1378 Gfx_write_label_var(&t7screen, 500,800,400,&FontT48,CLUT_Font020,TextL1);
38
+ − 1379
+ − 1380
+ − 1381 if(Sdate.Year < 15)
+ − 1382 {
+ − 1383 if(warning_count_high_time)
+ − 1384 {
+ − 1385 snprintf(TextL1,4*TEXTSIZE,"\017 %02d-%02d-%02d %02d:%02d:%02d", Sdate.Date, Sdate.Month, 2000 + Sdate.Year,Stime.Hours, Stime.Minutes, Stime.Seconds);
+ − 1386 Gfx_write_label_var(&t7screen, 0,800,420,&FontT48,CLUT_Font020,TextL1);
+ − 1387 }
+ − 1388 }
+ − 1389 else
+ − 1390 {
+ − 1391 if(pSettings->customtext[0])
+ − 1392 {
+ − 1393 if(pSettings->customtext[59])
+ − 1394 pSettings->customtext[59] = 0;
+ − 1395 Gfx_write_label_var(&t7screen, 0,400,420,&FontT24,CLUT_Font020,pSettings->customtext);
+ − 1396 }
+ − 1397 else
+ − 1398 {
+ − 1399 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 );
+ − 1400 Gfx_write_label_var(&t7screen, 0,800,420,&FontT48,CLUT_Font020,TextL1);
+ − 1401 }
+ − 1402 }
+ − 1403
+ − 1404 windowGimp.left = 400;
+ − 1405 windowGimp.top = 0;
+ − 1406 GFX_draw_image_monochrome(&t7screen, windowGimp, &ImgOSTC, 0);
+ − 1407 }
+ − 1408
+ − 1409 /* CUSTOMVIEW
+ − 1410 * in the middle of the screen
+ − 1411 */
+ − 1412
+ − 1413 uint8_t t7_test_customview_warnings(void)
+ − 1414 {
+ − 1415 uint8_t count = 0;
+ − 1416
+ − 1417 count = 0;
+ − 1418 count += stateUsed->warnings.decoMissed;
+ − 1419 count += stateUsed->warnings.ppO2Low;
+ − 1420 count += stateUsed->warnings.ppO2High;
+ − 1421 //count += stateUsed->warnings.lowBattery;
+ − 1422 count += stateUsed->warnings.sensorLinkLost;
+ − 1423 count += stateUsed->warnings.fallback;
756
+ − 1424 count += stateUsed->warnings.co2High;
477
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1425 #ifdef ENABLE_BOTTLE_SENSOR
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1426 if(stateUsed->warnings.newPressure)
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1427 {
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1428 count++;
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1429 }
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1430 #endif
857
+ − 1431 #ifdef HAVE_DEBUG_WARNINGS
+ − 1432 count += stateUsed->warnings.debug;
+ − 1433 #endif
38
+ − 1434 return count;
+ − 1435 }
+ − 1436
+ − 1437
+ − 1438 uint8_t t7_test_customview_warnings_surface_mode(void)
+ − 1439 {
+ − 1440 uint8_t count = 0;
+ − 1441 count = 0;
+ − 1442 count += stateUsed->cnsHigh_at_the_end_of_dive;
+ − 1443 count += stateUsed->decoMissed_at_the_end_of_dive;
477
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1444 #ifdef ENABLE_BOTTLE_SENSOR
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1445 if(stateUsed->warnings.newPressure)
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1446 {
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1447 count++;
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1448 }
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1449 #endif
38
+ − 1450 return count;
+ − 1451 }
+ − 1452
+ − 1453
+ − 1454 void t7_show_customview_warnings_surface_mode(void)
+ − 1455 {
+ − 1456 char text[256];
+ − 1457 uint8_t textpointer, lineFree;
+ − 1458
+ − 1459 text[0] = '\025';
+ − 1460 text[1] = '\f';
+ − 1461 text[2] = '\001';
+ − 1462 text[3] = TXT_Warning;
+ − 1463 text[4] = 0;
+ − 1464 GFX_write_string(&FontT42,&t7cH,text,0);
+ − 1465
+ − 1466 textpointer = 0;
+ − 1467 lineFree = 5;
+ − 1468
+ − 1469 if(stateUsed->decoMissed_at_the_end_of_dive)
+ − 1470 {
+ − 1471 text[textpointer++] = TXT_2BYTE;
+ − 1472 text[textpointer++] = TXT2BYTE_WarnDecoMissed;
+ − 1473 text[textpointer++] = '\n';
+ − 1474 text[textpointer++] = '\r';
+ − 1475 text[textpointer] = 0;
+ − 1476 lineFree--;
+ − 1477 }
+ − 1478
+ − 1479 if(stateUsed->cnsHigh_at_the_end_of_dive)
+ − 1480 {
+ − 1481 text[textpointer++] = TXT_2BYTE;
+ − 1482 text[textpointer++] = TXT2BYTE_WarnCnsHigh;
+ − 1483 text[textpointer++] = '\n';
+ − 1484 text[textpointer++] = '\r';
+ − 1485 text[textpointer] = 0;
+ − 1486 lineFree--;
+ − 1487 }
477
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1488 #ifdef ENABLE_BOTTLE_SENSOR
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1489 if(stateUsed->warnings.newPressure)
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1490 {
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1491 sprintf(&text[textpointer] ," %u Bar\n", stateUsed->warnings.newPressure);
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1492 textpointer++;
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1493 lineFree--;
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1494 }
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1495 #endif
38
+ − 1496 if(textpointer != 0)
+ − 1497 GFX_write_string(&FontT48,&t7cW,text,1);
+ − 1498 }
+ − 1499
+ − 1500
+ − 1501 void t7_show_customview_warnings(void)
+ − 1502 {
+ − 1503 char text[256];
+ − 1504 uint8_t textpointer, lineFree;
951
+ − 1505 #ifdef HAVE_DEBUG_WARNINGS
857
+ − 1506 uint8_t index = 0;
951
+ − 1507 #endif
38
+ − 1508
+ − 1509 text[0] = '\025';
+ − 1510 text[1] = '\f';
+ − 1511 text[2] = '\001';
+ − 1512 text[3] = TXT_Warning;
+ − 1513 text[4] = 0;
+ − 1514 GFX_write_string(&FontT42,&t7cH,text,0);
+ − 1515
+ − 1516 textpointer = 0;
+ − 1517 lineFree = 5;
564
+ − 1518
38
+ − 1519 if(lineFree && stateUsed->warnings.decoMissed)
+ − 1520 {
564
+ − 1521 text[textpointer++] = '\001';
38
+ − 1522 text[textpointer++] = TXT_2BYTE;
+ − 1523 text[textpointer++] = TXT2BYTE_WarnDecoMissed;
+ − 1524 text[textpointer++] = '\n';
+ − 1525 text[textpointer++] = '\r';
+ − 1526 text[textpointer] = 0;
+ − 1527 lineFree--;
+ − 1528 }
+ − 1529
+ − 1530 if(lineFree && stateUsed->warnings.fallback)
+ − 1531 {
564
+ − 1532 text[textpointer++] = '\001';
38
+ − 1533 text[textpointer++] = TXT_2BYTE;
+ − 1534 text[textpointer++] = TXT2BYTE_WarnFallback;
+ − 1535 text[textpointer++] = '\n';
+ − 1536 text[textpointer++] = '\r';
+ − 1537 text[textpointer] = 0;
+ − 1538 lineFree--;
+ − 1539 }
+ − 1540
+ − 1541 if(lineFree && stateUsed->warnings.ppO2Low)
+ − 1542 {
564
+ − 1543 text[textpointer++] = '\001';
38
+ − 1544 text[textpointer++] = TXT_2BYTE;
+ − 1545 text[textpointer++] = TXT2BYTE_WarnPPO2Low;
+ − 1546 text[textpointer++] = '\n';
+ − 1547 text[textpointer++] = '\r';
+ − 1548 text[textpointer] = 0;
+ − 1549 lineFree--;
+ − 1550 }
+ − 1551
+ − 1552 if(lineFree && stateUsed->warnings.ppO2High)
+ − 1553 {
564
+ − 1554 text[textpointer++] = '\001';
38
+ − 1555 text[textpointer++] = TXT_2BYTE;
+ − 1556 text[textpointer++] = TXT2BYTE_WarnPPO2High;
+ − 1557 text[textpointer++] = '\n';
+ − 1558 text[textpointer++] = '\r';
+ − 1559 text[textpointer] = 0;
+ − 1560 lineFree--;
+ − 1561 }
+ − 1562
+ − 1563 if(lineFree && stateUsed->warnings.sensorLinkLost)
+ − 1564 {
564
+ − 1565 text[textpointer++] = '\001';
38
+ − 1566 text[textpointer++] = TXT_2BYTE;
+ − 1567 text[textpointer++] = TXT2BYTE_WarnSensorLinkLost;
+ − 1568 text[textpointer++] = '\n';
+ − 1569 text[textpointer++] = '\r';
+ − 1570 text[textpointer] = 0;
+ − 1571 lineFree--;
+ − 1572 }
477
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1573 #ifdef ENABLE_BOTTLE_SENSOR
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1574 if(stateUsed->warnings.newPressure)
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1575 {
564
+ − 1576 text[textpointer++] = '\001';
477
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1577 sprintf(&text[textpointer]," %u Bar\n", stateUsed->warnings.newPressure);
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1578 textpointer++;
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1579 lineFree--;
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1580 }
5e6a612d03b5
Only switch between "no fly" and "desaturation" in case there is desaturation time left:
ideenmodellierer
diff
changeset
+ − 1581 #endif
756
+ − 1582 #ifdef ENABLE_CO2_SUPPORT
+ − 1583 if(lineFree && stateUsed->warnings.co2High)
+ − 1584 {
+ − 1585 text[textpointer++] = '\001';
+ − 1586 text[textpointer++] = TXT_2BYTE;
+ − 1587 text[textpointer++] = TXT2BYTE_WarnCO2High;
+ − 1588 text[textpointer++] = '\n';
+ − 1589 text[textpointer++] = '\r';
+ − 1590 text[textpointer] = 0;
+ − 1591 lineFree--;
+ − 1592 }
+ − 1593 #endif
857
+ − 1594 #ifdef HAVE_DEBUG_WARNINGS
+ − 1595 if(lineFree && stateUsed->warnings.debug)
+ − 1596 {
+ − 1597 for(index=0; index<3; index++)
+ − 1598 {
+ − 1599 if(((stateUsed->lifeData.extIf_sensor_map[index] == SENSOR_DIGO2M) && (((SSensorDataDiveO2*)(stateUsed->lifeData.extIf_sensor_data[index]))->status & DVO2_FATAL_ERROR)))
+ − 1600 {
+ − 1601 textpointer += snprintf(&text[textpointer],32,"\001Debug: %lx\n",((SSensorDataDiveO2*)(stateUsed->lifeData.extIf_sensor_data[index]))->status);
+ − 1602 }
+ − 1603 }
+ − 1604 lineFree--;
+ − 1605 }
+ − 1606 #endif
38
+ − 1607 /*
+ − 1608 if(lineFree && stateUsed->warnings.lowBattery)
+ − 1609 {
+ − 1610 text[textpointer++] = TXT_2BYTE;
+ − 1611 text[textpointer++] = TXT2BYTE_WarnBatteryLow;
+ − 1612 text[textpointer++] = '\n';
+ − 1613 text[textpointer++] = '\r';
+ − 1614 text[textpointer] = 0;
+ − 1615 lineFree--;
+ − 1616 }
+ − 1617 */
+ − 1618 GFX_write_string(&FontT48,&t7cW,text,1);
951
+ − 1619 requestBuzzerActivation(1);
38
+ − 1620 }
+ − 1621
+ − 1622
+ − 1623 void t7_set_customview_to_primary(void)
+ − 1624 {
+ − 1625 if(stateUsed->mode == MODE_DIVE)
+ − 1626 selection_customview = settingsGetPointer()->tX_customViewPrimary;
+ − 1627 }
+ − 1628
369
+ − 1629 uint8_t t7_GetEnabled_customviews()
38
+ − 1630 {
379
+ − 1631 int8_t i;
369
+ − 1632 uint8_t *pViews;
+ − 1633 uint8_t increment = 1;
+ − 1634
+ − 1635 uint8_t enabledViewCnt = 0;
+ − 1636 uint32_t cv_config = settingsGetPointer()->cv_configuration;
+ − 1637
530
+ − 1638 pViews = (uint8_t*)customviewsDive;
369
+ − 1639
+ − 1640 while((*pViews != CVIEW_END))
+ − 1641 {
+ − 1642 increment = 1;
+ − 1643 /* check if view is enabled */
379
+ − 1644 i=0;
+ − 1645 do
369
+ − 1646 {
379
+ − 1647 if(*pViews == cv_changelist[i])
369
+ − 1648 {
379
+ − 1649 if(!CHECK_BIT_THOME(cv_config, cv_changelist[i]))
+ − 1650 {
+ − 1651 increment = 0;
+ − 1652 }
+ − 1653 break;
369
+ − 1654 }
379
+ − 1655 i++;
+ − 1656 } while(cv_changelist[i] != CVIEW_END);
+ − 1657 if(cv_changelist[i] == CVIEW_END)
+ − 1658 {
+ − 1659 increment = 0;
+ − 1660 }
369
+ − 1661 if (((*pViews == CVIEW_sensors) || (*pViews == CVIEW_sensors_mV)) &&
564
+ − 1662 ((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0)))
369
+ − 1663 {
+ − 1664 increment = 0;
+ − 1665 }
+ − 1666
+ − 1667 pViews++;
+ − 1668 enabledViewCnt += increment;
+ − 1669 }
+ − 1670 return enabledViewCnt;
+ − 1671 }
+ − 1672
405
+ − 1673 uint8_t t7_customview_disabled(uint8_t view)
+ − 1674 {
+ − 1675 uint8_t i = 0;
+ − 1676 uint8_t cv_disabled = 0;
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1677 SSettings *settings = settingsGetPointer();
405
+ − 1678
+ − 1679 while(cv_changelist[i] != CVIEW_END)
+ − 1680 {
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1681 if((view == cv_changelist[i]) && !CHECK_BIT_THOME(settings->cv_configuration, cv_changelist[i]))
405
+ − 1682 {
+ − 1683 cv_disabled = 1;
+ − 1684 break;
+ − 1685 }
+ − 1686 i++;
+ − 1687 }
+ − 1688
+ − 1689 if (((view == CVIEW_sensors) || (view == CVIEW_sensors_mV)) &&
582
+ − 1690 ((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0) || (stateUsed->warnings.fallback)))
405
+ − 1691 {
+ − 1692 cv_disabled = 1;
+ − 1693 }
672
+ − 1694
+ − 1695 if ((view == CVIEW_Charger) && (stateUsed->chargeStatus != CHARGER_running) && (stateUsed->chargeStatus != CHARGER_lostConnection))
+ − 1696 {
+ − 1697 cv_disabled = 1;
+ − 1698 }
+ − 1699
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1700 if (view == CVIEW_CcrSummary && !isLoopMode(settings->dive_mode)) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1701 cv_disabled = 1;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1702 }
672
+ − 1703
405
+ − 1704 return cv_disabled;
+ − 1705 }
+ − 1706
592
+ − 1707 uint8_t t7_change_customview(uint8_t action)
38
+ − 1708 {
365
+ − 1709 uint8_t *pViews;
662
+ − 1710 uint8_t *pStartView,*pLastView;
+ − 1711 uint8_t *pCurView = NULL;
38
+ − 1712 _Bool cv_disabled = 0;
+ − 1713
+ − 1714 if(stateUsed->mode == MODE_DIVE)
374
+ − 1715 pViews = (uint8_t*)customviewsDive;
38
+ − 1716 else
374
+ − 1717 pViews = (uint8_t*)customviewsSurface;
38
+ − 1718
361
+ − 1719 pStartView = pViews;
+ − 1720 /* set pointer to currently selected view and count number of entries */
+ − 1721 while((*pViews != CVIEW_END))
+ − 1722 {
+ − 1723 if (*pViews == selection_customview)
+ − 1724 {
+ − 1725 pCurView = pViews;
+ − 1726 }
+ − 1727 pViews++;
+ − 1728 }
+ − 1729 pLastView = pViews;
+ − 1730 pViews = pCurView;
+ − 1731
366
+ − 1732 do
+ − 1733 {
495
+ − 1734 switch(action)
+ − 1735 {
+ − 1736 case ACTION_BUTTON_ENTER:
+ − 1737 case ACTION_PITCH_POS:
510
+ − 1738 if(*pViews != CVIEW_END)
495
+ − 1739 pViews++;
510
+ − 1740 if(*pViews == CVIEW_END)
366
+ − 1741 {
+ − 1742 pViews = pStartView;
+ − 1743 }
495
+ − 1744 break;
+ − 1745 case ACTION_PITCH_NEG:
+ − 1746 if(pViews == pStartView)
+ − 1747 {
+ − 1748 pViews = pLastView - 1;
+ − 1749 }
+ − 1750 else
+ − 1751 {
+ − 1752 pViews--;
+ − 1753 }
+ − 1754 break;
+ − 1755 default:
+ − 1756 break;
+ − 1757 }
+ − 1758
+ − 1759 cv_disabled = t7_customview_disabled(*pViews);
+ − 1760 if((cv_disabled) && (action == ACTION_END))
+ − 1761 {
+ − 1762 action = ACTION_BUTTON_ENTER;
+ − 1763 }
366
+ − 1764 } while(cv_disabled);
+ − 1765
38
+ − 1766 selection_customview = *pViews;
592
+ − 1767 return *pViews;
38
+ − 1768 }
+ − 1769
577
+ − 1770 void t7_select_customview(uint8_t selectedCustomview)
+ − 1771 {
+ − 1772 if(selectedCustomview < CVIEW_END)
+ − 1773 {
+ − 1774 selection_customview = selectedCustomview;
+ − 1775 }
+ − 1776 }
38
+ − 1777
+ − 1778 uint8_t t7_get_length_of_customtext(void)
+ − 1779 {
+ − 1780 uint8_t i = 0;
+ − 1781 settingsGetPointer()->customtext[60-1] = 0;
+ − 1782 while(settingsGetPointer()->customtext[i] > 0)
+ − 1783 i++;
+ − 1784 return i;
+ − 1785 }
+ − 1786
+ − 1787
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1788 static bool setpointIsActive(SSettings *settings, unsigned setpointIndex)
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1789 {
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1790 if (settings->autoSetpoint && setpointIndex == SETPOINT_INDEX_AUTO_DECO) {
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1791 return settings->setpoint[setpointIndex].note.ub.active;
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1792 }
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1793
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1794 return true;
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1795 }
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1796
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1797
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1798 static void t7_CcrSummary(SSettings *settings)
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1799 {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1800 unsigned numLines = 1; // CCR Mode
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1801
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1802 SGasLine *diluentsToShow[MAX_NUM_SUMMARY_LINES - 1] = { NULL };
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1803 unsigned i = NUM_OFFSET_DILUENT + 1;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1804 // Add diluent at start of dive
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1805 while (i <= NUM_OFFSET_DILUENT + 1 + NUM_GASES) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1806 if (settings->gas[i].note.ub.active && settings->gas[i].note.ub.first) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1807 diluentsToShow[0] = &settings->gas[i];
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1808 numLines++;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1809
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1810 break;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1811 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1812
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1813 i++;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1814 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1815
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1816 bool showScrubberTime = false;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1817 if (settings->scrubTimerMode != SCRUB_TIMER_OFF) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1818 numLines++;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1819 showScrubberTime = true;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1820 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1821
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1822 bool showManualSetpoints = false;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1823 unsigned offset;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1824 SSetpointLine *setpointsToShow[MAX_NUM_SUMMARY_LINES - 1] = { NULL };
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1825 if (settings->CCR_Mode == CCRMODE_FixedSetpoint || settings->fallbackToFixedSetpoint) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1826 offset = numLines;
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1827 if (settings->autoSetpoint) {
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1828 setpointsToShow[numLines++ - offset] = &settings->setpoint[SETPOINT_INDEX_AUTO_LOW];
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1829 setpointsToShow[numLines++ - offset] = &settings->setpoint[SETPOINT_INDEX_AUTO_HIGH];
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1830 if (setpointIsActive(settings, SETPOINT_INDEX_AUTO_DECO)) {
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1831 setpointsToShow[numLines++ - offset] = &settings->setpoint[SETPOINT_INDEX_AUTO_DECO];
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1832 }
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1833 } else {
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1834 // Add setpoint at start of dive
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1835 i = 1;
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1836 while (i <= NUM_GASES) {
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1837 if (setpointIsActive(settings, i) && settings->setpoint[i].note.ub.first) {
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1838 setpointsToShow[numLines - offset] = &settings->setpoint[i];
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1839 numLines++;
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1840
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1841 break;
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1842 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1843
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1844 i++;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1845 }
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1846
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1847 showManualSetpoints = true;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1848 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1849 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1850
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1851 // Add remaining active diluents
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1852 i = NUM_OFFSET_DILUENT + 1;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1853 offset = numLines;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1854 if (diluentsToShow[0]) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1855 offset--;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1856 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1857 while (i < NUM_OFFSET_DILUENT + 1 + NUM_GASES && numLines < MAX_NUM_SUMMARY_LINES) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1858 if (settings->gas[i].note.ub.active && !settings->gas[i].note.ub.first) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1859 diluentsToShow[numLines - offset] = &settings->gas[i];
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1860 numLines++;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1861 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1862
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1863 i++;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1864 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1865
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1866 if (showManualSetpoints) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1867 // Fill up the remaining lines with setpoints
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1868 offset = numLines;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1869 if (setpointsToShow[0]) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1870 offset--;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1871 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1872 i = 2;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1873 while (i <= NUM_GASES && numLines < MAX_NUM_SUMMARY_LINES) {
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1874 if (setpointIsActive(settings, i) && !settings->setpoint[i].note.ub.first) {
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1875 setpointsToShow[numLines - offset] = &settings->setpoint[i];
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1876 numLines++;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1877 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1878
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1879 i++;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1880 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1881 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1882
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1883 char heading[128];
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1884 unsigned headingIndex = 0;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1885
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1886 char data[128];
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1887 unsigned dataIndex = 0;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1888
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1889 heading[headingIndex++] = '\032';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1890 heading[headingIndex++] = '\016';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1891 heading[headingIndex++] = '\016';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1892 heading[headingIndex++] = TXT_CCRmode;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1893
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1894 data[dataIndex++] = '\t';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1895 char *modeText;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1896 if (settings->CCR_Mode == CCRMODE_Sensors) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1897 if (settings->fallbackToFixedSetpoint) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1898 modeText = (char *)&"Sens/FB";
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1899 } else {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1900 modeText = (char *)&"Sensor";
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1901 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1902 } else {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1903 modeText = (char *)&"Fixed";
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1904 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1905 dataIndex += snprintf(&data[dataIndex], 10, "\020%s", modeText);
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1906
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1907 i = 0;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1908 while (setpointsToShow[i] != NULL && i < MAX_NUM_SUMMARY_LINES - 1) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1909 heading[headingIndex++] = '\n';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1910 heading[headingIndex++] = '\r';
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1911 if (settings->autoSetpoint) {
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1912 heading[headingIndex++] = TXT_2BYTE;
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1913 heading[headingIndex++] = TXT2BYTE_SetpointShort;
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1914 headingIndex += printSetpointName(&heading[headingIndex], i + 1, settings, true);
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1915 } else if (i == 0) {
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1916 heading[headingIndex++] = TXT_2BYTE;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1917 heading[headingIndex++] = TXT2BYTE_Setpoint;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1918 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1919
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1920 data[dataIndex++] = '\n';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1921 data[dataIndex++] = '\r';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1922 data[dataIndex++] = '\t';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1923 dataIndex += snprintf(&data[dataIndex], 10, "\020%01.2f", setpointsToShow[i]->setpoint_cbar / 100.0);
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1924 if (setpointsToShow[i]->depth_meter && !(settings->autoSetpoint && i + 1 == SETPOINT_INDEX_AUTO_DECO)) {
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1925 bool setpointDelayed = settings->autoSetpoint && i + 1 == SETPOINT_INDEX_AUTO_LOW && settings->delaySetpointLow;
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 1926 dataIndex += snprintf(&data[dataIndex], 10, "\016\016 %um%s\017", setpointsToShow[i]->depth_meter, setpointDelayed ? "(d)" : "");
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1927 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1928
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1929 i++;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1930 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1931
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1932 i = 0;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1933 while (diluentsToShow[i] != NULL && i < MAX_NUM_SUMMARY_LINES - 1) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1934 heading[headingIndex++] = '\n';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1935 heading[headingIndex++] = '\r';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1936 if (i == 0) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1937 heading[headingIndex++] = TXT_Diluent_Gas_Edit;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1938 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1939
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1940 data[dataIndex++] = '\n';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1941 data[dataIndex++] = '\r';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1942 data[dataIndex++] = '\t';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1943 data[dataIndex++] = '\020';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1944 dataIndex += write_gas(&data[dataIndex], diluentsToShow[i]->oxygen_percentage, diluentsToShow[i]->helium_percentage);
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1945 if (diluentsToShow[i]->note.ub.deco) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1946 char *space = " ";
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1947 if (diluentsToShow[i]->depth_meter > 99) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1948 space = (char *)"";
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1949 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1950 dataIndex += snprintf(&data[dataIndex], 10, "\016\016%s%um\017", space, diluentsToShow[i]->depth_meter);
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1951 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1952
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1953 i++;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1954 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1955
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1956 if (showScrubberTime) {
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1957 heading[headingIndex++] = '\n';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1958 heading[headingIndex++] = '\r';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1959 heading[headingIndex++] = TXT_2BYTE;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1960 heading[headingIndex++] = TXT2BYTE_Scrubber;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1961
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1962 data[dataIndex++] = '\n';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1963 data[dataIndex++] = '\r';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1964 data[dataIndex++] = '\t';
980
+ − 1965 dataIndex += printScrubberText(&data[dataIndex], 10, settings->scrubberData, settings);
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1966 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1967
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1968 heading[headingIndex++] = '\017';
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1969 heading[headingIndex++] = 0;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1970
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1971 data[dataIndex++] = 0;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1972
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1973 t7cY0free.WindowLineSpacing = 48;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1974 t7cY0free.WindowNumberOfTextLines = 6;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1975 t7cY0free.WindowTab = 375;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1976
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1977 if (!settings->FlipDisplay) {
824
+ − 1978 t7cY0free.WindowY0 = t7cC.WindowY0 - 10;
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1979 t7cY0free.WindowX0 += 10;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1980 t7cY0free.WindowY0 += 10;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1981 t7cY0free.WindowY1 = 355;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1982 GFX_write_string(&FontT24, &t7cY0free, heading, 1);
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1983 t7cY0free.WindowX0 -= 10;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1984 t7cY0free.WindowY0 -= 10;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1985 } else {
824
+ − 1986 t7cY0free.WindowY1 = 400;
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1987 t7cY0free.WindowY1 -= 10;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1988 t7cY0free.WindowX1 -= 10;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1989 GFX_write_string(&FontT24, &t7cY0free, heading, 1);
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1990 t7cY0free.WindowY1 += 10;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1991 t7cY0free.WindowX1 += 10;
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1992 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1993
868
+ − 1994 Gfx_colorsscheme_mod(data, 0);
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1995
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1996 GFX_write_string(&FontT42, &t7cY0free, data, 1);
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1997 }
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1998
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 1999
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2000 static void setTimerPrestart(int startTimeS)
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2001 {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2002 stateUsedWrite->timerState = TIMER_STATE_PRESTART;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2003 stateUsedWrite->timerStartedS = startTimeS;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2004 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2005
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2006
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2007 static void setTimerFinished(int startTimeS)
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2008 {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2009 stateUsedWrite->timerState = TIMER_STATE_FINISHED;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2010 stateUsedWrite->timerStartedS = startTimeS;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2011 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2012
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2013
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2014 static void updateTimer(SSettings *settings, int nowS, bool switchedToTimerView)
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2015 {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2016 int timerElapsedS = nowS - stateUsed->timerStartedS;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2017
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2018 if (stateUsed->timerState && timerElapsedS < 0) {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2019 disableTimer();
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2020 } else {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2021 switch (stateUsed->timerState) {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2022 case TIMER_STATE_OFF:
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2023 if (switchedToTimerView) {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2024 setTimerPrestart(nowS);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2025 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2026
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2027 break;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2028 case TIMER_STATE_PRESTART:
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2029 if (timerElapsedS <= TIMER_ACTION_DELAY_S) {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2030 if (switchedToTimerView) {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2031 setTimerPrestart(nowS);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2032 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2033 } else {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2034 if (selection_customview == CVIEW_Timer) {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2035 stateUsedWrite->timerState = TIMER_STATE_RUNNING;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2036 stateUsedWrite->timerStartedS = stateUsed->timerStartedS + TIMER_ACTION_DELAY_S;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2037 } else {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2038 disableTimer();
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2039 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2040 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2041
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2042 break;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2043 case TIMER_STATE_RUNNING:
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2044 if (timerElapsedS >= settings->timerDurationS) {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2045 if (selection_customview == CVIEW_Timer) {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2046 setTimerFinished(stateUsed->timerStartedS + settings->timerDurationS);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2047 } else {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2048 stateUsedWrite->timerState = TIMER_STATE_WAIT_FINISHED;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2049 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2050 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2051
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2052 break;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2053 case TIMER_STATE_WAIT_FINISHED:
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2054 if (switchedToTimerView) {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2055 setTimerFinished(nowS);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2056 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2057
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2058 break;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2059 case TIMER_STATE_FINISHED:
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2060 if (timerElapsedS <= TIMER_ACTION_DELAY_S) {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2061 if (switchedToTimerView) {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2062 setTimerPrestart(stateUsed->timerStartedS);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2063 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2064 } else {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2065 disableTimer();
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2066 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2067
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2068 break;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2069 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2070 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2071 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2072
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2073
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2074 bool t7_isTimerRunning(bool includeBackground)
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2075 {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2076 return stateUsed->timerState && (selection_customview == CVIEW_Timer || (includeBackground && stateUsed->timerState == TIMER_STATE_RUNNING));
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2077 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2078
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2079
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2080 static void showTimer(SSettings *settings, int nowS)
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2081 {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2082 char heading[32];
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2083 unsigned headingIndex = 0;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2084
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2085 char data[32];
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2086 unsigned dataIndex = 0;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2087
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2088 heading[headingIndex++] = '\032';
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2089 heading[headingIndex++] = '\016';
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2090 heading[headingIndex++] = '\016';
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2091
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2092 data[dataIndex++] = '\t';
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2093
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2094 int timerRemainingS = settings->timerDurationS;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2095 switch (stateUsed->timerState) {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2096 case TIMER_STATE_RUNNING:
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2097 timerRemainingS = settings->timerDurationS - (nowS - stateUsed->timerStartedS);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2098
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2099 break;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2100 case TIMER_STATE_PRESTART:
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2101 case TIMER_STATE_FINISHED:
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2102 if (stateUsed->timerState == TIMER_STATE_PRESTART) {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2103 heading[headingIndex++] = TXT_2BYTE;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2104 heading[headingIndex++] = TXT2BYTE_Starting;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2105 } else {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2106 heading[headingIndex++] = TXT_2BYTE;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2107 heading[headingIndex++] = TXT2BYTE_Finished;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2108
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2109 timerRemainingS = 0;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2110 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2111
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2112 dataIndex += snprintf(&data[dataIndex], 10, "\020%u", TIMER_ACTION_DELAY_S - (nowS - stateUsed->timerStartedS));
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2113
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2114 break;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2115 default:
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2116
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2117 break;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2118 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2119
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2120 char timer[16];
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2121 snprintf(timer, 10, "\001\020%u:%02u", timerRemainingS / 60, timerRemainingS % 60);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2122
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2123 heading[headingIndex++] = 0;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2124
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2125 data[dataIndex++] = 0;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2126
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2127 t7cY0free.WindowLineSpacing = 48;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2128 t7cY0free.WindowNumberOfTextLines = 6;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2129 t7cY0free.WindowTab = 375;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2130
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2131 if (!settings->FlipDisplay) {
824
+ − 2132 t7cY0free.WindowY0 = t7cC.WindowY0 - 10;
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2133 t7cY0free.WindowX0 += 10;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2134 t7cY0free.WindowY0 += 10;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2135 t7cY0free.WindowY1 = 355;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2136 GFX_write_string(&FontT24, &t7cY0free, heading, 1);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2137 t7cY0free.WindowX0 -= 10;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2138 t7cY0free.WindowY0 -= 10;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2139 } else {
824
+ − 2140 t7cY0free.WindowY1 = 400;
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2141 t7cY0free.WindowY1 -= 10;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2142 t7cY0free.WindowX1 -= 10;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2143 GFX_write_string(&FontT24, &t7cY0free, heading, 1);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2144 t7cY0free.WindowY1 += 10;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2145 t7cY0free.WindowX1 += 10;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2146 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2147
868
+ − 2148 Gfx_colorsscheme_mod(data, 0);
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2149
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2150 GFX_write_string(&FontT42, &t7cY0free, data, 1);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2151
868
+ − 2152 Gfx_colorsscheme_mod(timer, 0);
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2153
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2154 GFX_write_string(&FontT105, &t7cY0free, timer, 4);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2155 }
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2156
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2157
38
+ − 2158 void t7_refresh_customview(void)
+ − 2159 {
405
+ − 2160 static uint8_t last_customview = CVIEW_END;
38
+ − 2161
+ − 2162 char text[256];
567
+ − 2163 char timeSuffix;
+ − 2164 uint8_t hoursToDisplay;
662
+ − 2165 #ifdef ENABLE_PSCR_MODE
+ − 2166 uint8_t showSimPPO2 = 1;
+ − 2167 #endif
38
+ − 2168 uint16_t textpointer = 0;
539
+ − 2169 uint16_t heading = 0;
38
+ − 2170 int16_t start;
51
+ − 2171 uint8_t lineCountCustomtext = 0;
38
+ − 2172 int16_t shiftWindowY0;
+ − 2173 RTC_DateTypeDef Sdate;
+ − 2174 RTC_TimeTypeDef Stime;
+ − 2175 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth; // CVIEW_Gaslist
+ − 2176 const SGasLine * pGasLine; // CVIEW_Gaslist
+ − 2177 uint8_t oxygen, helium; // CVIEW_Gaslist
+ − 2178 float depth, surface, fraction_nitrogen, fraction_helium, ead, end; // CVIEW_EADTime
819
+ − 2179 SSettingsStatus SettingsStatus;
110
+ − 2180 SSettings* pSettings;
+ − 2181 pSettings = settingsGetPointer();
907
+ − 2182 uint8_t decoPlanEntries = 6;
110
+ − 2183
701
+ − 2184 uint8_t local_ppo2sensors_deactivated = 0;
+ − 2185
+ − 2186 if(stateUsed->mode == MODE_DIVE) /* show sensors based on current dive settings */
+ − 2187 {
+ − 2188 local_ppo2sensors_deactivated = stateUsed->diveSettings.ppo2sensors_deactivated;
+ − 2189 }
+ − 2190 else
+ − 2191 {
907
+ − 2192 local_ppo2sensors_deactivated = pSettings->ppo2sensors_deactivated;
701
+ − 2193 }
+ − 2194
405
+ − 2195 if(last_customview != selection_customview) /* check if current selection is disabled and should be skipped */
+ − 2196 {
+ − 2197 if(t7_customview_disabled(selection_customview))
+ − 2198 {
+ − 2199 t7_change_customview(ACTION_BUTTON_ENTER);
+ − 2200 }
+ − 2201 }
38
+ − 2202 switch(selection_customview)
+ − 2203 {
+ − 2204 case CVIEW_noneOrDebug:
+ − 2205 if(settingsGetPointer()->showDebugInfo)
+ − 2206 {
+ − 2207 // header
+ − 2208 strcpy(text,"\032\f\001Debug");
+ − 2209 GFX_write_string(&FontT42,&t7cH,text,0);
+ − 2210 // content
+ − 2211 t7_debug();
+ − 2212 }
+ − 2213 break;
+ − 2214
672
+ − 2215 case CVIEW_Charger:
+ − 2216 snprintf(text,100,"\032\f\001%c",TXT_Charging);
+ − 2217 GFX_write_string(&FontT42,&t7cH,text,0);
+ − 2218 t7_ChargerView();
+ − 2219
+ − 2220 break;
+ − 2221
38
+ − 2222 case CVIEW_SummaryOfLeftCorner:
+ − 2223 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Summary);
+ − 2224 GFX_write_string(&FontT42,&t7cH,text,0);
+ − 2225 // content
+ − 2226 t7_SummaryOfLeftCorner();
+ − 2227 break;
+ − 2228
+ − 2229 case CVIEW_CompassDebug:
+ − 2230 snprintf(text,100,"\032\f\001Compass raw");
+ − 2231 GFX_write_string(&FontT42,&t7cH,text,0);
+ − 2232 snprintf(text,255,"%1.1f\n\r%1.1f\n\r%1.1f\n\r%i\n\r%i\n\r%i"
+ − 2233 ,stateUsed->lifeData.compass_heading
+ − 2234 ,stateUsed->lifeData.compass_roll
+ − 2235 ,stateUsed->lifeData.compass_pitch
+ − 2236 ,stateUsed->lifeData.compass_DX_f
+ − 2237 ,stateUsed->lifeData.compass_DY_f
+ − 2238 ,stateUsed->lifeData.compass_DZ_f
+ − 2239 );
+ − 2240
+ − 2241 t7cY0free.WindowY0 = t7cC.WindowY0 - 10;
+ − 2242 t7cY0free.WindowLineSpacing = 48;
+ − 2243 t7cY0free.WindowNumberOfTextLines = 6;
+ − 2244 GFX_write_string(&FontT42, &t7cY0free, text, 1);
+ − 2245 break;
+ − 2246
+ − 2247 case CVIEW_Hello:
+ − 2248 t7_logo_OSTC();
+ − 2249 t7cC.WindowLineSpacing = 53;
+ − 2250 t7cC.WindowNumberOfTextLines = 5;
+ − 2251 shiftWindowY0 = 18;
+ − 2252
+ − 2253 if(updateNecessary)//if(DataEX_check_RTE_version__needs_update() || font_update_required())
+ − 2254 {
+ − 2255 if(warning_count_high_time)
+ − 2256 {
+ − 2257 shiftWindowY0 += 20;
+ − 2258 t7cC.WindowY0 -= shiftWindowY0;
+ − 2259 textpointer = 0;
+ − 2260 text[textpointer++] = TXT_2BYTE;
+ − 2261 text[textpointer++] = TXT2BYTE_PleaseUpdate;
+ − 2262 text[textpointer++] = '\n';
+ − 2263 text[textpointer++] = '\r';
+ − 2264 if(DataEX_check_RTE_version__needs_update())
+ − 2265 {
+ − 2266 text[textpointer++] = TXT_2BYTE;
+ − 2267 text[textpointer++] = TXT2BYTE_RTE;
+ − 2268 text[textpointer++] = '\n';
+ − 2269 text[textpointer++] = '\r';
+ − 2270 }
+ − 2271 if(font_update_required())
+ − 2272 {
+ − 2273 text[textpointer++] = TXT_2BYTE;
+ − 2274 text[textpointer++] = TXT2BYTE_Fonts;
+ − 2275 }
+ − 2276 text[textpointer++] = 0;
+ − 2277 GFX_write_string_color(&FontT42,&t7cC,text,1, CLUT_WarningRed);
+ − 2278 t7cC.WindowY0 += shiftWindowY0;
+ − 2279 }
+ − 2280 t7cC.WindowNumberOfTextLines = 3;
+ − 2281 }
662
+ − 2282 else if(isSettingsWarning())
+ − 2283 {
+ − 2284 if(warning_count_high_time)
+ − 2285 {
819
+ − 2286 get_CorrectionStatus(&SettingsStatus);
662
+ − 2287 shiftWindowY0 += 20;
+ − 2288 t7cC.WindowY0 -= shiftWindowY0;
+ − 2289 textpointer = 0;
819
+ − 2290 snprintf(text,255,"\001%c%c\n\r\001%d|%d",TXT_2BYTE,TXT2BYTE_CheckSettings,SettingsStatus.FirstCorrection,SettingsStatus.Corrections);
662
+ − 2291 GFX_write_string_color(&FontT42,&t7cC,text,1, CLUT_WarningRed);
+ − 2292 t7cC.WindowY0 += shiftWindowY0;
+ − 2293 }
+ − 2294 t7cC.WindowNumberOfTextLines = 1;
+ − 2295 }
759
+ − 2296 else if(!isCompassCalibrated()) {
+ − 2297 if(warning_count_high_time) {
+ − 2298 shiftWindowY0 += 20;
+ − 2299 t7cC.WindowY0 -= shiftWindowY0;
+ − 2300 textpointer = 0;
+ − 2301 text[textpointer++] = '\001';
+ − 2302 text[textpointer++] = TXT_2BYTE;
+ − 2303 text[textpointer++] = TXT2BYTE_Compass;
+ − 2304 text[textpointer++] = '\n';
+ − 2305 text[textpointer++] = '\r';
+ − 2306 text[textpointer++] = '\001';
+ − 2307 text[textpointer++] = TXT_2BYTE;
+ − 2308 text[textpointer++] = TXT2BYTE_NotCalibrated;
+ − 2309 text[textpointer++] = '\n';
+ − 2310 text[textpointer++] = '\r';
+ − 2311 text[textpointer++] = 0;
+ − 2312 GFX_write_string_color(&FontT42, &t7cC,text, 1, CLUT_WarningRed);
+ − 2313 t7cC.WindowY0 += shiftWindowY0;
+ − 2314 }
+ − 2315 t7cC.WindowNumberOfTextLines = 2;
+ − 2316 }
38
+ − 2317 else // customtext
+ − 2318 {
+ − 2319 lineCountCustomtext = t7_customtextPrepare(text);
+ − 2320 if(lineCountCustomtext <= 2)
+ − 2321 shiftWindowY0 += 20+26; // nach unten
+ − 2322 else
+ − 2323 if(lineCountCustomtext <= 3)
+ − 2324 shiftWindowY0 += 20; // nach unten
+ − 2325 t7cC.WindowY0 -= shiftWindowY0;
+ − 2326
+ − 2327 GFX_write_string(&FontT42,&t7cC,text,1);
+ − 2328 t7cC.WindowNumberOfTextLines = 3;
+ − 2329 t7cC.WindowY0 += shiftWindowY0;
+ − 2330 }
+ − 2331 if(lineCountCustomtext <= 4)
+ − 2332 {
+ − 2333 snprintf(text,100,"\001#%0u V%01u.%01u.%01u",
+ − 2334 settingsGetPointer()->serialLow + (256 * settingsGetPointer()->serialHigh),
+ − 2335 firmwareDataGetPointer()->versionFirst,
+ − 2336 firmwareDataGetPointer()->versionSecond,
+ − 2337 firmwareDataGetPointer()->versionThird
+ − 2338 );
+ − 2339 GFX_write_string(&FontT24,&t7cC,text,0);
+ − 2340 }
+ − 2341 break;
+ − 2342
+ − 2343 case CVIEW_Gaslist:
+ − 2344 // a lot of code taken from tMenuGas.c
+ − 2345 // header
+ − 2346 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Gaslist);
+ − 2347 GFX_write_string(&FontT42,&t7cH,text,0);
+ − 2348 // content
+ − 2349 textpointer = 0;
110
+ − 2350
+ − 2351 if(!pSettings->FlipDisplay)
+ − 2352 {
+ − 2353 t7cY0free.WindowY0 = t7cC.WindowY0 - 10;
+ − 2354 }
+ − 2355 else
+ − 2356 {
+ − 2357 t7cY0free.WindowY1 = 400;
+ − 2358 }
38
+ − 2359 t7cY0free.WindowLineSpacing = 48+9;
+ − 2360 t7cY0free.WindowNumberOfTextLines = 5; // NUM_GASES == 5
+ − 2361 t7cY0free.WindowTab = 420;
+ − 2362
+ − 2363 pGasLine = settingsGetPointer()->gas;
+ − 2364 if(actualLeftMaxDepth(stateUsed))
+ − 2365 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_deco) / 100;
+ − 2366 else
+ − 2367 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100;
+ − 2368 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100;
+ − 2369 for(int gasId=1;gasId<=NUM_GASES;gasId++)
+ − 2370 {
+ − 2371 textpointer = 0;
527
+ − 2372 #ifdef ENABLE_UNUSED_GAS_HIDING
+ − 2373 if(!pGasLine[gasId].note.ub.off)
+ − 2374 {
+ − 2375 #endif
38
+ − 2376 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100;
+ − 2377 if(pGasLine[gasId].note.ub.active == 0)
527
+ − 2378 strcpy(&text[textpointer++],"\031");
517
+ − 2379 else if(stateUsed->lifeData.actualGas.GasIdInSettings == gasId) /* actual selected gas */
+ − 2380 {
+ − 2381 strcpy(&text[textpointer++],"\030");
+ − 2382 }
38
+ − 2383 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow))
+ − 2384 strcpy(&text[textpointer++],"\025");
517
+ − 2385 else if(actualBetterGasId() == gasId)
+ − 2386 {
+ − 2387 strcpy(&text[textpointer++],"\026"); /* Highlight better gas */
+ − 2388 }
38
+ − 2389 else
517
+ − 2390 strcpy(&text[textpointer++],"\023");
38
+ − 2391
+ − 2392 text[textpointer++] = ' ';
+ − 2393 oxygen = pGasLine[gasId].oxygen_percentage;
+ − 2394 helium = pGasLine[gasId].helium_percentage;
+ − 2395 textpointer += write_gas(&text[textpointer], oxygen, helium);
+ − 2396 // Wechseltiefe
+ − 2397 if(pGasLine[gasId].depth_meter)
+ − 2398 {
631
+ − 2399 textpointer += snprintf(&text[textpointer],10,"\t%u %c%c",unit_depth_integer(pGasLine[gasId].depth_meter), unit_depth_char1(), unit_depth_char2());
38
+ − 2400 }
+ − 2401 GFX_write_string(&FontT42, &t7cY0free, text, gasId);
527
+ − 2402 #ifdef ENABLE_UNUSED_GAS_HIDING
+ − 2403 }
+ − 2404 #endif
38
+ − 2405 }
+ − 2406 break;
+ − 2407
+ − 2408 case CVIEW_EADTime:
+ − 2409 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Info );
+ − 2410 GFX_write_string(&FontT42,&t7cH,text,0);
+ − 2411 textpointer = 0;
+ − 2412
+ − 2413 t7cY0free.WindowY0 = t7cC.WindowY0 - 10;
110
+ − 2414 if(pSettings->FlipDisplay)
+ − 2415 {
+ − 2416 t7cY0free.WindowY1 = 400;
+ − 2417 }
38
+ − 2418 t7cY0free.WindowLineSpacing = 48;
+ − 2419 t7cY0free.WindowNumberOfTextLines = 6;
+ − 2420
+ − 2421 // time
+ − 2422 snprintf(text,100,"\032\001%c%c",TXT_2BYTE,TXT2BYTE_Clock );
+ − 2423 GFX_write_string(&FontT42, &t7cY0free, text, 1);
+ − 2424
+ − 2425 translateDate(stateRealGetPointer()->lifeData.dateBinaryFormat, &Sdate);
+ − 2426 translateTime(stateRealGetPointer()->lifeData.timeBinaryFormat, &Stime);
567
+ − 2427
+ − 2428 if (settingsGetPointer()->amPMTime)
+ − 2429 {
+ − 2430 if (Stime.Hours > 11)
+ − 2431 {
+ − 2432 timeSuffix = 'P';
+ − 2433 }
+ − 2434 else
+ − 2435 {
+ − 2436 timeSuffix = 'A';
+ − 2437 }
+ − 2438
+ − 2439 if (Stime.Hours % 12 == 0)
+ − 2440 {
+ − 2441 hoursToDisplay = 12;
+ − 2442 }
+ − 2443 else
+ − 2444 {
+ − 2445 hoursToDisplay = (Stime.Hours % 12);
+ − 2446 }
+ − 2447
+ − 2448 if(Stime.Seconds % 2)
+ − 2449 textpointer += snprintf(&text[textpointer],100,"\030\001%02d:%02d %cM",hoursToDisplay,Stime.Minutes,timeSuffix);
+ − 2450 else
+ − 2451 textpointer += snprintf(&text[textpointer],100,"\030\001%02d\031:\030%02d %cM",hoursToDisplay,Stime.Minutes,timeSuffix);
+ − 2452 }
38
+ − 2453 else
567
+ − 2454 {
+ − 2455 if(Stime.Seconds % 2)
+ − 2456 textpointer += snprintf(&text[textpointer],100,"\030\001%02d:%02d",Stime.Hours,Stime.Minutes);
+ − 2457 else
+ − 2458 textpointer += snprintf(&text[textpointer],100,"\030\001%02d\031:\030%02d",Stime.Hours,Stime.Minutes);
+ − 2459 }
+ − 2460
38
+ − 2461 GFX_write_string(&FontT42, &t7cY0free, text, 2);
+ − 2462
+ − 2463 // EAD / END
+ − 2464 // The equivalent air depth can be calculated for depths in metres as follows:
+ − 2465 // EAD = (Depth + 10) � Fraction of N2 / 0.79 - 10 (wikipedia)
+ − 2466 // The equivalent narcotic depth can be calculated for depths in metres as follows:
+ − 2467 // END = (Depth + 10) � (1 - Fraction of helium) - 10 (wikipedia)
+ − 2468 decom_get_inert_gases((float)stateUsed->lifeData.pressure_ambient_bar,&(stateUsed->lifeData.actualGas),&fraction_nitrogen,&fraction_helium);
+ − 2469 depth = stateUsed->lifeData.pressure_ambient_bar;
+ − 2470 surface = stateUsed->lifeData.pressure_surface_bar;
+ − 2471 ead = 10.f * ((depth * fraction_nitrogen/0.79f) - surface);
+ − 2472 end = 10.0f * ((depth * (1.f - fraction_helium)) - surface);
+ − 2473 if(ead < 0)
+ − 2474 ead = 0;
+ − 2475 if(end < 0)
+ − 2476 end = 0;
+ − 2477
+ − 2478 snprintf(text,100,"\032\001EAD");
+ − 2479 GFX_write_string(&FontT42, &t7cY0free, text, 3);
+ − 2480 snprintf(text,100,"\030\001%01.1f %c%c"
+ − 2481 , unit_depth_float(ead)
+ − 2482 , unit_depth_char1()
+ − 2483 , unit_depth_char2()
+ − 2484 );
+ − 2485 GFX_write_string(&FontT42, &t7cY0free, text, 4);
+ − 2486
+ − 2487 snprintf(text,100,"\032\001END");
+ − 2488 GFX_write_string(&FontT42, &t7cY0free, text, 5);
+ − 2489 snprintf(text,100,"\030\001%01.1f %c%c"
+ − 2490 , unit_depth_float(ead)
+ − 2491 , unit_depth_char1()
+ − 2492 , unit_depth_char2()
+ − 2493 );
+ − 2494 GFX_write_string(&FontT42, &t7cY0free, text, 6);
+ − 2495 break;
+ − 2496
+ − 2497 case CVIEW_Profile:
+ − 2498 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Profile);
+ − 2499 GFX_write_string(&FontT42,&t7cH,text,0);
+ − 2500 textpointer = 0;
+ − 2501 t7_miniLiveLogProfile();
+ − 2502 break;
+ − 2503
+ − 2504 case CVIEW_Tissues:
+ − 2505 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Tissues);
+ − 2506 GFX_write_string(&FontT42,&t7cH,text,0);
+ − 2507 textpointer = 0;
+ − 2508 t7_tissues(stateUsed);
+ − 2509 break;
+ − 2510
+ − 2511 case CVIEW_sensors:
+ − 2512 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_O2monitor);
+ − 2513 GFX_write_string(&FontT42,&t7cH,text,0);
+ − 2514 textpointer = 0;
+ − 2515 text[textpointer++] = '\030'; // main color
+ − 2516 for(int i=0;i<3;i++)
+ − 2517 {
701
+ − 2518 if((local_ppo2sensors_deactivated & (1<<i)) || (stateUsed->lifeData.ppO2Sensor_bar[i] == 0.0))
38
+ − 2519 {
662
+ − 2520 #ifdef ENABLE_PSCR_MODE
+ − 2521 if((stateUsed->diveSettings.diveMode == DIVEMODE_PSCR) && (showSimPPO2) && (stateUsed->mode == MODE_DIVE)) /* display ppo2 sim in blue letters in case a slot is not used in the ppo2 custom view */
+ − 2522 {
+ − 2523 text[textpointer++] = '\023';
+ − 2524 textpointer += snprintf(&text[textpointer],100,"\001%01.2f\n\r\030",stateUsed->lifeData.ppo2Simulated_bar);
+ − 2525 showSimPPO2 = 0;
+ − 2526 }
+ − 2527 else
+ − 2528 #endif
+ − 2529 {
+ − 2530 text[textpointer++] = '\031'; // labelcolor
+ − 2531 text[textpointer++] = '\001';
+ − 2532 text[textpointer++] = '-';
+ − 2533 text[textpointer++] = '\n';
+ − 2534 text[textpointer++] = '\r';
+ − 2535 text[textpointer++] = '\030'; // main color
+ − 2536 text[textpointer] = 0;
+ − 2537 }
38
+ − 2538 }
+ − 2539 else
+ − 2540 {
+ − 2541 if(stateUsed->warnings.sensorOutOfBounds[i])
+ − 2542 text[textpointer++] = '\025'; // Warning Red
+ − 2543 textpointer += snprintf(&text[textpointer],100,"\001%01.2f\n\r\030",stateUsed->lifeData.ppO2Sensor_bar[i]);
+ − 2544 }
+ − 2545 }
+ − 2546 t7cC.WindowLineSpacing = 95;
+ − 2547 t7cC.WindowNumberOfTextLines = 3;
+ − 2548 text[textpointer] = 0;
315
+ − 2549 if(pSettings->FlipDisplay)
+ − 2550 {
+ − 2551 t7cC.WindowY1 -= 40;
+ − 2552 }
38
+ − 2553 GFX_write_string(&FontT105,&t7cC,text,1);
315
+ − 2554 if(pSettings->FlipDisplay)
+ − 2555 {
+ − 2556 t7cC.WindowY1 += 40;
+ − 2557 }
38
+ − 2558 break;
+ − 2559
+ − 2560 case CVIEW_sensors_mV:
+ − 2561 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_O2voltage);
+ − 2562 GFX_write_string(&FontT42,&t7cH,text,0);
+ − 2563 textpointer = 0;
+ − 2564 text[textpointer++] = '\030';
+ − 2565 for(int i=0;i<3;i++)
+ − 2566 {
701
+ − 2567 if(local_ppo2sensors_deactivated & (1<<i))
38
+ − 2568 {
+ − 2569 text[textpointer++] = '\031';
+ − 2570 text[textpointer++] = '\001';
+ − 2571 text[textpointer++] = '-';
+ − 2572 text[textpointer++] = '\n';
+ − 2573 text[textpointer++] = '\r';
+ − 2574 text[textpointer++] = '\030';
+ − 2575 text[textpointer] = 0;
+ − 2576 }
+ − 2577 else
+ − 2578 {
+ − 2579 if(stateUsed->warnings.sensorOutOfBounds[i])
+ − 2580 text[textpointer++] = '\025';
+ − 2581 textpointer += snprintf(&text[textpointer],100,"\001%01.1f mV\n\r\030",(stateUsed->lifeData.sensorVoltage_mV[i]));
+ − 2582 }
+ − 2583 }
+ − 2584 t7cC.WindowLineSpacing = 95;
+ − 2585 t7cC.WindowNumberOfTextLines = 3;
+ − 2586 text[textpointer] = 0;
315
+ − 2587 if(pSettings->FlipDisplay)
+ − 2588 {
+ − 2589 t7cC.WindowY1 -= 40;
+ − 2590 }
38
+ − 2591 GFX_write_string(&FontT48,&t7cC,text,1);
315
+ − 2592 if(pSettings->FlipDisplay)
+ − 2593 {
+ − 2594 t7cC.WindowY1 += 40;
+ − 2595 }
38
+ − 2596 break;
+ − 2597
+ − 2598 case CVIEW_Compass:
+ − 2599 default:
539
+ − 2600
+ − 2601 if(pSettings->compassInertia)
+ − 2602 {
+ − 2603 heading = (uint16_t)compass_getCompensated();
+ − 2604 }
+ − 2605 else
+ − 2606 {
+ − 2607 heading = (uint16_t)stateUsed->lifeData.compass_heading;
+ − 2608 }
38
+ − 2609 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE, TXT2BYTE_Compass);
+ − 2610 GFX_write_string(&FontT42,&t7cH,text,0);
539
+ − 2611 t7_compass(heading, stateUsed->diveSettings.compassHeading);
110
+ − 2612
+ − 2613 if(!pSettings->FlipDisplay)
+ − 2614 {
+ − 2615 t7cY0free.WindowX0 += 15;
+ − 2616 t7cY0free.WindowY0 = 230;
+ − 2617 }
+ − 2618 else
+ − 2619 {
+ − 2620 t7cY0free.WindowX0 -= 15;
+ − 2621 t7cY0free.WindowY0 = 0;
+ − 2622 t7cY0free.WindowY1 = 250;
+ − 2623 }
539
+ − 2624 snprintf(text,100,"\030\001%03i`",heading);
38
+ − 2625 GFX_write_string(&FontT54,&t7cY0free,text,0);
110
+ − 2626 if(!pSettings->FlipDisplay)
+ − 2627 {
+ − 2628 t7cY0free.WindowX0 -= 15;
+ − 2629 }
+ − 2630 else
+ − 2631 {
+ − 2632 t7cY0free.WindowX0 += 15;
+ − 2633 }
38
+ − 2634 break;
+ − 2635
+ − 2636 case CVIEW_Decolist:
911
+ − 2637
907
+ − 2638
+ − 2639 if(settingsGetPointer()->VPM_conservatism.ub.alternative == 0)
+ − 2640 {
911
+ − 2641 text[0] = '\032';
907
+ − 2642 }
+ − 2643 else
+ − 2644 {
+ − 2645 switch(vpm_get_TableState())
+ − 2646 {
911
+ − 2647 case VPM_TABLE_MISSED: text[0] = '\025';
907
+ − 2648 break;
911
+ − 2649 case VPM_TABLE_WARNING: text[0] = '\024';
907
+ − 2650 break;
+ − 2651 case VPM_TABLE_ACTIVE:
+ − 2652 case VPM_TABLE_INIT:
911
+ − 2653 default: text[0] = '\032';
907
+ − 2654 break;
+ − 2655 }
+ − 2656 }
911
+ − 2657 snprintf(&text[1],100,"\f\001 %c%c", TXT_2BYTE, TXT2BYTE_Decolist);
+ − 2658 GFX_write_string(&FontT42,&t7cH,text,0);
+ − 2659
38
+ − 2660 uint8_t depthNext, depthLast, depthSecond, depthInc;
+ − 2661
+ − 2662 depthLast = (uint8_t)(stateUsed->diveSettings.last_stop_depth_bar * 10);
+ − 2663 depthSecond = (uint8_t)(stateUsed->diveSettings.input_second_to_last_stop_depth_bar * 10);
+ − 2664 depthInc = (uint8_t)(stateUsed->diveSettings.input_next_stop_increment_depth_bar * 10);
+ − 2665
+ − 2666 if(settingsGetPointer()->nonMetricalSystem)
+ − 2667 {
+ − 2668 depthLast = (uint8_t)unit_depth_integer(depthLast);
+ − 2669 depthSecond = (uint8_t)unit_depth_integer(depthSecond);
+ − 2670 depthInc = (uint8_t)unit_depth_integer(depthInc);
+ − 2671 }
907
+ − 2672 if(stateUsed->diveSettings.deco_type.ub.standard == VPM_MODE) /* show additional VPM data in last slot */
+ − 2673 {
+ − 2674 decoPlanEntries = 5;
+ − 2675 }
38
+ − 2676
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 2677 const SDecoinfo * pDecoinfo = getDecoInfo();
38
+ − 2678 for(start=DECOINFO_STRUCT_MAX_STOPS-1; start>0; start--)
+ − 2679 if(pDecoinfo->output_stop_length_seconds[start]) break;
907
+ − 2680 start -= decoPlanEntries;
38
+ − 2681 if(start < 0) start = 0;
+ − 2682
+ − 2683 textpointer = 0;
907
+ − 2684 for(int i=start;i<decoPlanEntries+start;i++)
38
+ − 2685 {
+ − 2686 if(i == 0)
+ − 2687 depthNext = depthLast;
+ − 2688 else
+ − 2689 depthNext = depthSecond + (( i - 1 )* depthInc);
+ − 2690
+ − 2691 if(pDecoinfo->output_stop_length_seconds[i])
+ − 2692 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);
+ − 2693 else
+ − 2694 textpointer += snprintf(&text[textpointer],20,"\031\034 %2u\016\016%c%c\017\n\r",depthNext, unit_depth_char1(), unit_depth_char2());
+ − 2695 if(textpointer > 200) break;
+ − 2696 }
907
+ − 2697 if(decoPlanEntries == 5) /* add VPM deco zone */
+ − 2698 {
911
+ − 2699 textpointer += snprintf(&text[textpointer],30,"\031\034 Zone %2u\016\016%c%c\017\n\r",vpm_get_decozone(), unit_depth_char1(), unit_depth_char2());
907
+ − 2700 }
110
+ − 2701 if(!pSettings->FlipDisplay)
+ − 2702 {
+ − 2703 t7cY0free.WindowY0 = t7cC.WindowY0 - 10;
+ − 2704 }
+ − 2705 else
+ − 2706 {
+ − 2707 t7cY0free.WindowY0 = t7cC.WindowY0 - 10;
+ − 2708 t7cY0free.WindowY1 = 400;
+ − 2709 }
+ − 2710
38
+ − 2711 t7cY0free.WindowLineSpacing = 48;
+ − 2712 t7cY0free.WindowNumberOfTextLines = 6;
+ − 2713 GFX_write_string(&FontT42, &t7cY0free, text, 1);
+ − 2714 break;
770
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 2715 case CVIEW_CcrSummary:
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 2716 snprintf(text, 100, "\032\f\001%c%c", TXT_2BYTE, TXT2BYTE_CcrSummary);
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 2717 GFX_write_string(&FontT42, &t7cH, text, 0);
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 2718 t7_CcrSummary(pSettings);
8deb28b2d4da
CCR overview in surface mode. Makes it easy to quickly check that all settings (mode, setpoints, diluent, scrubber timer) are correct when preparing to dive (also makes the OC gas list available in surface mode for the same reason).
heinrichsweikamp
diff
changeset
+ − 2719 break;
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2720 case CVIEW_Timer:
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2721 snprintf(text, 100, "\032\f\001%c%c", TXT_2BYTE, TXT2BYTE_Timer);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2722 GFX_write_string(&FontT42, &t7cH, text, 0);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2723
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2724 int nowS = current_second();
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2725
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2726 updateTimer(pSettings, nowS, last_customview != CVIEW_Timer);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2727
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2728 showTimer(pSettings, nowS);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2729
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2730 break;
899
+ − 2731
+ − 2732 case CVIEW_Position:
+ − 2733 snprintf(text, 100, "\032\f\001%c%c", TXT_2BYTE, TXT2BYTE_Position);
+ − 2734 GFX_write_string(&FontT42, &t7cH, text, 0);
+ − 2735 t7_showPosition();
38
+ − 2736 }
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2737
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 2738 last_customview = selection_customview;
38
+ − 2739 }
+ − 2740
+ − 2741
+ − 2742 /* DIVE MODE
+ − 2743 */
+ − 2744 void t7_refresh_divemode(void)
+ − 2745 {
+ − 2746 char TextL1[TEXTSIZE];
+ − 2747 char TextL2[TEXTSIZE];
+ − 2748
+ − 2749 char TextR1[TEXTSIZE];
+ − 2750 char TextR2[TEXTSIZE];
+ − 2751 char TextR3[TEXTSIZE];
+ − 2752
+ − 2753 char TextC1[2*TEXTSIZE];
+ − 2754 char TextC2[TEXTSIZE];
+ − 2755 uint8_t textPointer;
+ − 2756
884
+ − 2757 uint8_t color = 0;
38
+ − 2758 int textlength;
+ − 2759
+ − 2760 uint16_t nextstopLengthSeconds = 0;
+ − 2761 uint8_t nextstopDepthMeter = 0;
+ − 2762 uint8_t oxygen_percentage = 0;
+ − 2763 SDivetime Divetime = {0,0,0, 0};
+ − 2764 SDivetime SafetyStopTime = {0,0,0,0};
+ − 2765 SDivetime TimeoutTime = {0,0,0,0};
+ − 2766 uint8_t customview_warnings = 0;
+ − 2767
110
+ − 2768 SSettings* pSettings;
+ − 2769 pSettings = settingsGetPointer();
+ − 2770
38
+ − 2771 Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time;
+ − 2772 Divetime.Minutes = Divetime.Total / 60;
+ − 2773 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 );
+ − 2774
+ − 2775 SafetyStopTime.Total = timer_Safetystop_GetCountDown();
+ − 2776 SafetyStopTime.Minutes = SafetyStopTime.Total / 60;
+ − 2777 SafetyStopTime.Seconds = SafetyStopTime.Total - (SafetyStopTime.Minutes * 60);
+ − 2778
882
+ − 2779 TimeoutTime.Total = pSettings->timeoutDiveReachedZeroDepth - stateUsed->lifeData.counterSecondsShallowDepth;
+ − 2780 if(TimeoutTime.Total > pSettings->timeoutDiveReachedZeroDepth)
38
+ − 2781 {
+ − 2782 TimeoutTime.Total = 0;
+ − 2783 }
+ − 2784 TimeoutTime.Minutes = TimeoutTime.Total / 60;
+ − 2785 TimeoutTime.Seconds = TimeoutTime.Total - (TimeoutTime.Minutes * 60);
+ − 2786
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
diff
changeset
+ − 2787 const SDecoinfo * pDecoinfo = getDecoInfo();
38
+ − 2788 if(pDecoinfo->output_time_to_surface_seconds)
+ − 2789 {
+ − 2790 tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds);
+ − 2791 }
+ − 2792 else
+ − 2793 {
+ − 2794 nextstopDepthMeter = 0;
+ − 2795 nextstopLengthSeconds = 0;
+ − 2796 }
+ − 2797
882
+ − 2798
+ − 2799 /* max depth */
+ − 2800 snprintf(TextL2,TEXTSIZE,"\032\f%c",TXT_MaxDepth);
+ − 2801 GFX_write_string(&FontT42,&t7l2,TextL2,0);
+ − 2802
+ − 2803 if(unit_depth_float(stateUsed->lifeData.max_depth_meter) < 100)
+ − 2804 snprintf(TextL2,TEXTSIZE,"\020%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter));
+ − 2805 else
+ − 2806 snprintf(TextL2,TEXTSIZE,"\020%01.0f",unit_depth_float(stateUsed->lifeData.max_depth_meter));
+ − 2807
+ − 2808 Gfx_colorsscheme_mod(TextL2, 0);
+ − 2809 GFX_write_string(&FontT105,&t7l2,TextL2,1);
+ − 2810
+ − 2811 /* ascent rate graph */
954
+ − 2812 color = 0xff;
915
+ − 2813 if((pSettings->slowExitTime != 0) && (nextstopDepthMeter == 0) && (stateUsed->lifeData.depth_meter < pSettings->last_stop_depth_meter))
882
+ − 2814 {
+ − 2815 color = t7_drawSlowExitGraph();
+ − 2816 }
954
+ − 2817 if(color == 0xff)
882
+ − 2818 {
954
+ − 2819 color = drawingColor_from_ascentspeed(stateUsed->lifeData.ascent_rate_meter_per_min);
+ − 2820 if(stateUsed->lifeData.ascent_rate_meter_per_min > 1) /* a value < 1 would cause a bar in negative direction brush rectangle of 12 and step width of 6 */
+ − 2821 {
+ − 2822
+ − 2823 t7_drawAcentGraph(color);
+ − 2824 }
882
+ − 2825 }
+ − 2826
38
+ − 2827 /* depth */
174
+ − 2828 float depth = unit_depth_float(stateUsed->lifeData.depth_meter);
38
+ − 2829
+ − 2830 if(depth <= 0.3f)
+ − 2831 depth = 0;
+ − 2832
+ − 2833 if(settingsGetPointer()->nonMetricalSystem)
+ − 2834 snprintf(TextL1,TEXTSIZE,"\032\f[feet]");
+ − 2835 else
+ − 2836 snprintf(TextL1,TEXTSIZE,"\032\f%c",TXT_Depth);
868
+ − 2837
38
+ − 2838 GFX_write_string(&FontT24,&t7l1,TextL1,0);
+ − 2839
+ − 2840 if((stateUsed->lifeData.ascent_rate_meter_per_min > 8) || (stateUsed->lifeData.ascent_rate_meter_per_min < -10))
+ − 2841 {
+ − 2842 snprintf(TextL1,TEXTSIZE,"\f\002%.0f %c%c/min "
+ − 2843 , unit_depth_float(stateUsed->lifeData.ascent_rate_meter_per_min)
+ − 2844 , unit_depth_char1()
+ − 2845 , unit_depth_char2()
+ − 2846 );
+ − 2847 GFX_write_string(&FontT24,&t7l1,TextL1,0);
+ − 2848 }
+ − 2849
+ − 2850 if( depth < 100)
+ − 2851 snprintf(TextL1,TEXTSIZE,"\020%01.1f",depth);
+ − 2852 else
+ − 2853 snprintf(TextL1,TEXTSIZE,"\020%01.0f",depth);
+ − 2854
868
+ − 2855 Gfx_colorsscheme_mod(TextL1, color);
+ − 2856
+ − 2857 GFX_write_string(&FontT144,&t7l1,TextL1,0);
38
+ − 2858
882
+ − 2859 /* divetime */
38
+ − 2860 if(stateUsed->lifeData.counterSecondsShallowDepth)
+ − 2861 {
+ − 2862 snprintf(TextR1,TEXTSIZE,"\f\002\136 %u:%02u",TimeoutTime.Minutes, TimeoutTime.Seconds);
+ − 2863 GFX_write_string(&FontT42,&t7r1,TextR1,0);
+ − 2864 }
+ − 2865 else
+ − 2866 {
+ − 2867 snprintf(TextR1,TEXTSIZE,"\032\f\002%c",TXT_Divetime);
+ − 2868 GFX_write_string(&FontT42,&t7r1,TextR1,0);
+ − 2869 }
+ − 2870
+ − 2871 if(Divetime.Minutes < 1000)
564
+ − 2872 snprintf(TextR1,TEXTSIZE,"\020\002\016%u:%02u",Divetime.Minutes, Divetime.Seconds);
38
+ − 2873 else
564
+ − 2874 snprintf(TextR1,TEXTSIZE,"\020\002\016%u'",Divetime.Minutes);
868
+ − 2875 Gfx_colorsscheme_mod(TextR1, 0);
38
+ − 2876 GFX_write_string(&FontT105,&t7r1,TextR1,1);
+ − 2877
+ − 2878 /* next deco stop */
+ − 2879 if(nextstopDepthMeter)
+ − 2880 {
911
+ − 2881 snprintf(TextR2,TEXTSIZE,"\032\f\002%c",TXT_Decostop);
+ − 2882 GFX_write_string(&FontT42,&t7r2,TextR2,0);
+ − 2883
945
+ − 2884 if((stateUsed->diveSettings.deco_type.ub.standard == VPM_MODE) && (pSettings->VPM_conservatism.ub.alternative)
+ − 2885 && (fabs(stateUsed->lifeData.depth_meter - nextstopDepthMeter)) < 1.5)
911
+ − 2886 {
+ − 2887 TextR2[0] = '\026';
+ − 2888 textlength = 1;
+ − 2889 }
+ − 2890 else
+ − 2891 {
+ − 2892 TextR2[0] = '\020';
+ − 2893 textlength = 1;
+ − 2894 }
+ − 2895
+ − 2896 textlength += snprintf(&TextR2[textlength],TEXTSIZE,"\002%u%c%c %u'"
38
+ − 2897 , unit_depth_integer(nextstopDepthMeter)
+ − 2898 , unit_depth_char1_T105()
+ − 2899 , unit_depth_char2_T105()
+ − 2900 , (nextstopLengthSeconds+59)/60);
868
+ − 2901 Gfx_colorsscheme_mod(TextR2, 0);
38
+ − 2902 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS)
527
+ − 2903 TextR2[0] = '\031';
38
+ − 2904 if(textlength <= 9)
+ − 2905 GFX_write_string(&FontT105,&t7r2,TextR2,1);
567
+ − 2906 else if(textlength <= 10)
+ − 2907 GFX_write_string(&FontT84Spaced,&t7r2,TextR2,1);
38
+ − 2908 else
+ − 2909 GFX_write_string(&FontT54,&t7r2,TextR2,1);
+ − 2910 }
+ − 2911 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit()))
+ − 2912 {
+ − 2913 snprintf(TextR2,TEXTSIZE,"\032\f\002%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2);
+ − 2914 GFX_write_string(&FontT42,&t7r2,TextR2,0);
564
+ − 2915 snprintf(TextR2,TEXTSIZE,"\020\002\016%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds);
868
+ − 2916 Gfx_colorsscheme_mod(TextR2, 0);
38
+ − 2917 GFX_write_string(&FontT105,&t7r2,TextR2,1);
+ − 2918 }
+ − 2919
+ − 2920 /* tts - option 1
+ − 2921 * ndl - option 2
+ − 2922 * empty - option 3 */
+ − 2923 if(pDecoinfo->output_time_to_surface_seconds)
+ − 2924 {
+ − 2925 snprintf(TextR3,TEXTSIZE,"\032\f\002%c",TXT_TTS);
+ − 2926 GFX_write_string(&FontT42,&t7r3,TextR3,0);
+ − 2927 if(pDecoinfo->output_time_to_surface_seconds < 1000 * 60)
214
+ − 2928 snprintf(TextR3,TEXTSIZE,"\020\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60);
38
+ − 2929 else
214
+ − 2930 snprintf(TextR3,TEXTSIZE,"\020\002%ih",(pDecoinfo->output_time_to_surface_seconds + 59)/ 3600);
868
+ − 2931 Gfx_colorsscheme_mod(TextR3, 0);
38
+ − 2932 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS)
527
+ − 2933 TextR2[0] = '\031';
38
+ − 2934 GFX_write_string(&FontT105,&t7r3,TextR3,1);
+ − 2935 }
+ − 2936 else if(pDecoinfo->output_ndl_seconds)
+ − 2937 {
+ − 2938 snprintf(TextR3,TEXTSIZE,"\032\f\002%c",TXT_Nullzeit);
+ − 2939 GFX_write_string(&FontT42,&t7r3,TextR3,0);
+ − 2940 if(pDecoinfo->output_ndl_seconds < 1000 * 60)
+ − 2941 snprintf(TextR3,TEXTSIZE,"\020\002%i'",pDecoinfo->output_ndl_seconds/60);
+ − 2942 else
+ − 2943 snprintf(TextR3,TEXTSIZE,"\020\002%ih",pDecoinfo->output_ndl_seconds/3600);
868
+ − 2944 Gfx_colorsscheme_mod(TextR3, 0);
38
+ − 2945 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS)
527
+ − 2946 TextR2[0] = '\031';
38
+ − 2947 GFX_write_string(&FontT105,&t7r3,TextR3,1);
+ − 2948 }
+ − 2949
+ − 2950 /* Menu Selection (and gas mix) */
+ − 2951 if(get_globalState() == StDMGAS)
+ − 2952 {
+ − 2953 textPointer = 0;
+ − 2954 TextR1[textPointer++] = '\a';
+ − 2955 // TextR1[textPointer++] = '\f';
+ − 2956 TextR1[textPointer++] = '\001';
+ − 2957 TextR1[textPointer++] = ' ';
+ − 2958 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[actualBetterGasId()].oxygen_percentage,stateUsed->diveSettings.gas[actualBetterGasId()].helium_percentage,&TextR1[textPointer]);
+ − 2959 TextR1[textPointer++] = '?';
+ − 2960 TextR1[textPointer++] = ' ';
+ − 2961 TextR1[textPointer++] = 0;
+ − 2962 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow);
+ − 2963 }
+ − 2964 else if(get_globalState() == StDMSPT)
+ − 2965 {
+ − 2966 textPointer = 0;
+ − 2967 TextR1[textPointer++] = '\a';
+ − 2968 TextR1[textPointer++] = '\001';
+ − 2969 TextR1[textPointer++] = ' ';
680
+ − 2970 textPointer += snprintf(&TextR1[textPointer],TEXTSIZE,"%01.2f",(float)(stateUsed->diveSettings.setpoint[actualBetterSetpointId()].setpoint_cbar) / 100.0);
38
+ − 2971 TextR1[textPointer++] = '?';
+ − 2972 TextR1[textPointer++] = ' ';
+ − 2973 TextR1[textPointer++] = 0;
+ − 2974 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow);
+ − 2975 }
+ − 2976 else if(get_globalState() == StDMENU)
+ − 2977 {
+ − 2978 snprintf(TextR1,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveMenuQ);
+ − 2979 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow);
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
diff
changeset
+ − 2980 } else if (get_globalState() == StDBAILOUT) {
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
diff
changeset
+ − 2981 if (isLoopMode(stateUsed->diveSettings.diveMode)) {
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
diff
changeset
+ − 2982 textPointer = snprintf(TextR1, TEXTSIZE, "\a\001 %c%c ", TXT_2BYTE, TXT2BYTE_BailoutShort);
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
diff
changeset
+ − 2983 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[actualBetterBailoutGasId()].oxygen_percentage, stateUsed->diveSettings.gas[actualBetterBailoutGasId()].helium_percentage, &TextR1[textPointer]);
979
+ − 2984 TextR1[textPointer++] = '?';
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
diff
changeset
+ − 2985 TextR1[textPointer++] = ' ';
979
+ − 2986 TextR1[textPointer++] = 0;
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
diff
changeset
+ − 2987 } else {
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
diff
changeset
+ − 2988 textPointer = snprintf(TextR1, TEXTSIZE, "\a\001 %c%c %01.2f/", TXT_2BYTE, TXT2BYTE_LoopShort, stateUsed->diveSettings.setpoint[actualBetterSetpointId()].setpoint_cbar / 100.0);
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
diff
changeset
+ − 2989 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[stateUsed->lifeData.lastDiluent_GasIdInSettings].oxygen_percentage, stateUsed->diveSettings.gas[stateUsed->lifeData.lastDiluent_GasIdInSettings].helium_percentage, &TextR1[textPointer]);
979
+ − 2990 TextR1[textPointer++] = '?';
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
diff
changeset
+ − 2991 TextR1[textPointer++] = ' ';
979
+ − 2992 TextR1[textPointer++] = 0;
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
diff
changeset
+ − 2993 }
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
diff
changeset
+ − 2994
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
diff
changeset
+ − 2995 GFX_write_string_color(&FontT48, &t7c2, TextR1, 0, CLUT_WarningYellow);
775
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
diff
changeset
+ − 2996 } else if (get_globalState() == StDSETPOINT) {
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
diff
changeset
+ − 2997 snprintf(TextR1, TEXTSIZE, "\a\001 %c%c %01.2f? ", TXT_2BYTE, TXT2BYTE_SetpointShort, getSwitchToSetpointCbar() / 100.0);
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
diff
changeset
+ − 2998
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
diff
changeset
+ − 2999 GFX_write_string_color(&FontT48, &t7c2, TextR1, 0, CLUT_WarningYellow);
38
+ − 3000 }
777
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
diff
changeset
+ − 3001 else if(get_globalState() == StDBEAR)
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
diff
changeset
+ − 3002 {
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
diff
changeset
+ − 3003 snprintf(TextR1, TEXTSIZE, "\a\001 %c%c? ", TXT_2BYTE, TXT2BYTE_DiveBearingQ);
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
diff
changeset
+ − 3004 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow);
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
diff
changeset
+ − 3005 }
38
+ − 3006 else if(get_globalState() == StDSIM1)
+ − 3007 {
+ − 3008 snprintf(TextR1,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveQuitQ);
+ − 3009 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow);
+ − 3010 }
+ − 3011 else if(get_globalState() == StDSIM2)
+ − 3012 {
+ − 3013 if(settingsGetPointer()->nonMetricalSystem)
+ − 3014 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:-3.33ft ");
+ − 3015 else
+ − 3016 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:-1m ");
+ − 3017 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow);
+ − 3018
+ − 3019 snprintf(TextR1,TEXTSIZE,"\a\f %u %c%c"
+ − 3020 , unit_depth_integer(simulation_get_aim_depth())
+ − 3021 , unit_depth_char1()
+ − 3022 , unit_depth_char2()
+ − 3023 );
+ − 3024 GFX_write_string_color(&FontT42,&t7l1,TextR1,0,CLUT_WarningYellow);
+ − 3025
+ − 3026 }
+ − 3027 else if(get_globalState() == StDSIM3)
+ − 3028 {
+ − 3029 if(settingsGetPointer()->nonMetricalSystem)
+ − 3030 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+3.33ft ");
+ − 3031 else
+ − 3032 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+1m ");
+ − 3033 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow);
+ − 3034 snprintf(TextR1,TEXTSIZE,"\a\f %u %c%c"
+ − 3035 , unit_depth_integer(simulation_get_aim_depth())
+ − 3036 , unit_depth_char1()
+ − 3037 , unit_depth_char2()
+ − 3038 );
+ − 3039 GFX_write_string_color(&FontT42,&t7l1,TextR1,0,CLUT_WarningYellow);
+ − 3040 }
+ − 3041 else if(get_globalState() == StDSIM4)
+ − 3042 {
+ − 3043 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+5' ");
+ − 3044 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow);
+ − 3045 snprintf(TextR1,TEXTSIZE,"\a\f %u %c%c"
+ − 3046 , unit_depth_integer(simulation_get_aim_depth())
+ − 3047 , unit_depth_char1()
+ − 3048 , unit_depth_char2()
+ − 3049 );
+ − 3050 GFX_write_string_color(&FontT42,&t7l1,TextR1,0,CLUT_WarningYellow);
+ − 3051 }
+ − 3052 else
+ − 3053 {
+ − 3054 /* gas mix */
+ − 3055 oxygen_percentage = 100;
+ − 3056 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage;
+ − 3057 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage;
+ − 3058
+ − 3059 textPointer = 0;
+ − 3060 TextC2[textPointer++] = '\020';
+ − 3061 if(stateUsed->warnings.betterGas && warning_count_high_time)
+ − 3062 {
+ − 3063 TextC2[textPointer++] = '\a';
+ − 3064 }
+ − 3065 else
+ − 3066 {
+ − 3067 float fPpO2limitHigh, fPpO2now;
+ − 3068
+ − 3069 if(actualLeftMaxDepth(stateUsed))
+ − 3070 fPpO2limitHigh = settingsGetPointer()->ppO2_max_deco;
+ − 3071 else
+ − 3072 fPpO2limitHigh = settingsGetPointer()->ppO2_max_std;
+ − 3073
+ − 3074 fPpO2now = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * oxygen_percentage;
+ − 3075
+ − 3076 if((fPpO2now > fPpO2limitHigh) || (fPpO2now < (float)(settingsGetPointer()->ppO2_min)))
+ − 3077 TextC2[textPointer++] = '\025';
+ − 3078 }
+ − 3079 TextC2[textPointer++] = '\002';
+ − 3080 textPointer += tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&TextC2[textPointer]);
+ − 3081
+ − 3082 if(stateUsed->warnings.betterGas && warning_count_high_time)
+ − 3083 {
+ − 3084 if(TextC2[0] == '\020')
+ − 3085 {
+ − 3086 TextC2[0] = '\004'; // NOP
+ − 3087 }
+ − 3088 GFX_write_string_color(&FontT48,&t7c2,TextC2,0,CLUT_WarningYellow);
+ − 3089 }
+ − 3090 else
+ − 3091 {
868
+ − 3092 Gfx_colorsscheme_mod(TextC2, 0);
38
+ − 3093 GFX_write_string(&FontT48,&t7c2,TextC2,0); // T54 has only numbers
+ − 3094 }
+ − 3095
+ − 3096 if(stateUsed->diveSettings.ccrOption)
+ − 3097 {
662
+ − 3098 if(isLoopMode(stateUsed->diveSettings.diveMode))
38
+ − 3099 {
+ − 3100 snprintf(TextC2,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2);
662
+ − 3101
38
+ − 3102 if(stateUsed->warnings.betterSetpoint && warning_count_high_time && (stateUsed->diveSettings.diveMode == DIVEMODE_CCR))
+ − 3103 {
+ − 3104 TextC2[0] = '\a'; // inverse instead of color \020
+ − 3105 GFX_write_string_color(&FontT48,&t7c2,TextC2,0,CLUT_WarningYellow);
+ − 3106 }
+ − 3107 else
+ − 3108 {
868
+ − 3109 Gfx_colorsscheme_mod(TextC2, 0);
38
+ − 3110 GFX_write_string(&FontT48,&t7c2,TextC2,0);
+ − 3111 }
+ − 3112 }
+ − 3113 }
+ − 3114 else if(settingsGetPointer()->alwaysShowPPO2)
+ − 3115 {
+ − 3116 snprintf(TextC2,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2);
868
+ − 3117 Gfx_colorsscheme_mod(TextC2, 0);
38
+ − 3118 GFX_write_string(&FontT48,&t7c2,TextC2,0);
+ − 3119 }
+ − 3120 }
+ − 3121
+ − 3122 /* algorithm, ccr, bailout and battery */
+ − 3123 /* and permanent warnings (CNS) */
+ − 3124
+ − 3125 if((stateUsed->warnings.cnsHigh) && display_count_high_time)
+ − 3126 {
+ − 3127 TextC2[0] = '\f';
+ − 3128 TextC2[1] = TXT_2BYTE;
+ − 3129 TextC2[2] = TXT2BYTE_WarnCnsHigh;
+ − 3130 TextC2[3] = 0;
662
+ − 3131 GFX_write_string_color(&FontT42,&t7c1,TextC2,0,CLUT_WarningRed);
38
+ − 3132 }
+ − 3133 else
+ − 3134 {
+ − 3135 if(stateUsed->warnings.aGf)
+ − 3136 {
+ − 3137 GFX_write_string_color(&FontT48,&t7c1,"\f" "aGF",0,CLUT_WarningYellow);
+ − 3138 }
+ − 3139 else if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE)
+ − 3140 {
+ − 3141 GFX_write_string(&FontT48,&t7c1,"\027\f" "GF",0);
+ − 3142 }
+ − 3143 else
+ − 3144 {
+ − 3145 GFX_write_string(&FontT48,&t7c1,"\027\f" "VPM",0);
+ − 3146 }
+ − 3147
+ − 3148 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR)
+ − 3149 GFX_write_string(&FontT24,&t7c1,"\027\f\002" "CCR",0);
+ − 3150 // GFX_write_string(&FontT24,&t7c1,"\f\177\177\x80" "CCR",0);
+ − 3151 else
662
+ − 3152 if(stateUsed->diveSettings.diveMode == DIVEMODE_PSCR)
+ − 3153 GFX_write_string(&FontT24,&t7c1,"\027\f\002" "PSCR",0);
+ − 3154 else
38
+ − 3155 if(stateUsed->diveSettings.ccrOption)
+ − 3156 GFX_write_string(&FontT24,&t7c1,"\f\002\024" "Bailout",0);
+ − 3157 // GFX_write_string(&FontT24,&t7c1,"\f\177\177\x80\024" "Bailout",0);
+ − 3158 }
+ − 3159 TextC1[0] = '\020';
+ − 3160 TextC1[1] = '3';
+ − 3161 TextC1[2] = '1';
+ − 3162 TextC1[3] = '1';
+ − 3163 TextC1[4] = '1';
+ − 3164 TextC1[5] = '1';
+ − 3165 TextC1[6] = '1';
+ − 3166 TextC1[7] = '1';
+ − 3167 TextC1[8] = '1';
+ − 3168 TextC1[9] = '1';
+ − 3169 TextC1[10] = '1';
+ − 3170 TextC1[11] = '1';
+ − 3171 TextC1[12] = '0';
+ − 3172 TextC1[13] = 0;
+ − 3173
+ − 3174 for(int i=1;i<=10;i++)
+ − 3175 {
+ − 3176 if( stateUsed->lifeData.battery_charge > (9 * i))
+ − 3177 TextC1[i+1] += 1;
+ − 3178 }
+ − 3179
+ − 3180 if(stateUsed->warnings.lowBattery)
+ − 3181 {
+ − 3182 TextC1[0] = '\025';
+ − 3183 if(warning_count_high_time)
+ − 3184 {
+ − 3185 for(int i=2;i<=11;i++)
+ − 3186 TextC1[i] = '1';
+ − 3187 }
+ − 3188 else
+ − 3189 {
+ − 3190 TextC1[2] = '2';
+ − 3191 }
+ − 3192 GFX_write_string(&Batt24,&t7batt,TextC1,0);
+ − 3193
+ − 3194 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140))
+ − 3195 {
+ − 3196 snprintf(TextC1,16,"\004\025\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge);
+ − 3197 if(warning_count_high_time)
+ − 3198 TextC1[0] = '\a';
110
+ − 3199 GFX_write_string(&FontT24,&t7voltage,TextC1,0);
38
+ − 3200 }
+ − 3201 }
+ − 3202 else
+ − 3203 {
868
+ − 3204 Gfx_colorsscheme_mod(TextC1, 0);
38
+ − 3205 GFX_write_string(&Batt24,&t7batt,TextC1,0);
+ − 3206
+ − 3207 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140))
+ − 3208 {
+ − 3209 snprintf(TextC1,16,"\020\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge);
868
+ − 3210 Gfx_colorsscheme_mod(TextC1, 0);
110
+ − 3211 GFX_write_string(&FontT24,&t7voltage,TextC1,0); // t7batt
38
+ − 3212 }
+ − 3213 }
+ − 3214
+ − 3215 /* customizable left lower corner */
+ − 3216 t7_refresh_divemode_userselected_left_lower_corner();
+ − 3217
+ − 3218
+ − 3219 /* customview - option 1
+ − 3220 * warning - option 2 */
+ − 3221 if(stateUsed->warnings.numWarnings)
+ − 3222 customview_warnings = t7_test_customview_warnings();
+ − 3223
166
+ − 3224 background.pointer = 0;
38
+ − 3225 if(customview_warnings && warning_count_high_time)
+ − 3226 t7_show_customview_warnings();
+ − 3227 else
951
+ − 3228 {
38
+ − 3229 t7_refresh_customview();
951
+ − 3230 requestBuzzerActivation(0);
+ − 3231 }
38
+ − 3232
+ − 3233 /* the frame */
+ − 3234 draw_frame(1,1, CLUT_DIVE_pluginbox, CLUT_DIVE_FieldSeperatorLines);
+ − 3235 }
+ − 3236
+ − 3237 void t7_set_field_to_primary(void)
+ − 3238 {
+ − 3239 if(stateUsed->mode == MODE_DIVE)
+ − 3240 selection_custom_field = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary;
+ − 3241 }
+ − 3242
+ − 3243 void t7_change_field(void)
+ − 3244 {
+ − 3245 selection_custom_field++;
+ − 3246
442
+ − 3247 if((stateUsed->diveSettings.deco_type.ub.standard == VPM_MODE) && (selection_custom_field == LLC_GF)) /* no GF if in VPM mode */
+ − 3248 {
+ − 3249 selection_custom_field++;
+ − 3250 }
662
+ − 3251 if((selection_custom_field == LLC_ScrubberTime) && ((settingsGetPointer()->scrubTimerMode == SCRUB_TIMER_OFF) || (!isLoopMode(settingsGetPointer()->dive_mode))))
656
+ − 3252 {
+ − 3253 selection_custom_field++;
+ − 3254 }
662
+ − 3255 #ifdef ENABLE_PSCR_MODE
+ − 3256 if((selection_custom_field == LCC_SimPpo2) && (settingsGetPointer()->dive_mode != DIVEMODE_PSCR))
+ − 3257 {
+ − 3258 selection_custom_field++;
+ − 3259 }
+ − 3260 #endif
840
+ − 3261 #ifdef ENABLE_CO2_SUPPORT
+ − 3262 if((selection_custom_field == LCC_CO2) && (settingsGetPointer()->co2_sensor_active == 0))
+ − 3263 {
+ − 3264 selection_custom_field++;
+ − 3265 }
+ − 3266
+ − 3267 #endif
+ − 3268
442
+ − 3269 if(selection_custom_field >= LLC_END)
+ − 3270 {
+ − 3271 selection_custom_field = LLC_Empty;
+ − 3272 }
38
+ − 3273 }
+ − 3274
+ − 3275
+ − 3276 void t7_refresh_divemode_userselected_left_lower_corner(void)
+ − 3277 {
+ − 3278 if(!selection_custom_field)
+ − 3279 return;
+ − 3280
+ − 3281 char headerText[10];
+ − 3282 char text[TEXTSIZE];
+ − 3283 uint8_t textpointer = 0;
+ − 3284 _Bool tinyHeaderFont = 0;
+ − 3285 uint8_t line = 0;
457
+ − 3286 #ifdef ENABLE_BOTTLE_SENSOR
442
+ − 3287 uint16_t agedColor = 0;
457
+ − 3288 #endif
38
+ − 3289
+ − 3290 SDivetime Stopwatch = {0,0,0,0};
+ − 3291 float fAverageDepth, fAverageDepthAbsolute;
+ − 3292 const SDecoinfo * pDecoinfoStandard;
+ − 3293 const SDecoinfo * pDecoinfoFuture;
+ − 3294 float fCNS;
+ − 3295 float temperature;
710
+ − 3296 SSettings* pSettings = settingsGetPointer();
38
+ − 3297
+ − 3298 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE)
+ − 3299 {
+ − 3300 pDecoinfoStandard = &stateUsed->decolistBuehlmann;
+ − 3301 pDecoinfoFuture = &stateUsed->decolistFutureBuehlmann;
+ − 3302 }
+ − 3303 else
+ − 3304 {
+ − 3305 pDecoinfoStandard = &stateUsed->decolistVPM;
+ − 3306 pDecoinfoFuture = &stateUsed->decolistFutureVPM;
+ − 3307 }
+ − 3308
+ − 3309 Stopwatch.Total = timer_Stopwatch_GetTime();
+ − 3310 Stopwatch.Minutes = Stopwatch.Total / 60;
+ − 3311 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 );
+ − 3312 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter();
+ − 3313 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter;
+ − 3314
+ − 3315 headerText[0] = '\032';
+ − 3316 headerText[1] = '\f';
+ − 3317
+ − 3318 switch(selection_custom_field)
+ − 3319 {
+ − 3320 /* Temperature */
442
+ − 3321 case LLC_Temperature:
38
+ − 3322 default:
189
8b8074080d7b
Bugfix: average temperature on arrival from RTE instead of display time
Jan Mulder <jlmulder@xs4all.nl>
diff
changeset
+ − 3323 temperature = unit_temperature_float(stateUsed->lifeData.temperature_celsius);
38
+ − 3324 headerText[2] = TXT_Temperature;
+ − 3325 textpointer = snprintf(text,TEXTSIZE,"\020\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F
+ − 3326 if(settingsGetPointer()->nonMetricalSystem == 0)
+ − 3327 text[textpointer++] = 'C';
+ − 3328 else
+ − 3329 text[textpointer++] = 'F';
+ − 3330 text[textpointer++] = 0;
+ − 3331 tinyHeaderFont = 0;
+ − 3332 break;
+ − 3333
+ − 3334 /* Average Depth */
442
+ − 3335 case LLC_AverageDepth:
38
+ − 3336 headerText[2] = TXT_AvgDepth;
710
+ − 3337 if(pSettings->nonMetricalSystem)
38
+ − 3338 snprintf(text,TEXTSIZE,"\020%01.0f",unit_depth_float(fAverageDepthAbsolute));
+ − 3339 else
+ − 3340 snprintf(text,TEXTSIZE,"\020%01.1f",fAverageDepthAbsolute);
+ − 3341 break;
+ − 3342
+ − 3343 /* ppO2 */
442
+ − 3344 case LLC_ppO2:
38
+ − 3345 headerText[2] = TXT_ppO2;
+ − 3346 snprintf(text,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2);
+ − 3347 break;
+ − 3348
+ − 3349 /* Stop Uhr */
442
+ − 3350 case LLC_Stopwatch:
38
+ − 3351 headerText[2] = TXT_Stopwatch;
710
+ − 3352 if(pSettings->nonMetricalSystem)
38
+ − 3353 snprintf(text,TEXTSIZE,"\020\016\016%u:%02u\n\r%01.0f",Stopwatch.Minutes, Stopwatch.Seconds,unit_depth_float(fAverageDepth));
+ − 3354 else
+ − 3355 snprintf(text,TEXTSIZE,"\020\016\016%u:%02u\n\r%01.1f",Stopwatch.Minutes, Stopwatch.Seconds,fAverageDepth);
+ − 3356 tinyHeaderFont = 1;
+ − 3357 line = 1;
+ − 3358 break;
+ − 3359
+ − 3360 /* Ceiling */
442
+ − 3361 case LLC_Ceiling:
38
+ − 3362 headerText[2] = TXT_Ceiling;
710
+ − 3363 if((pDecoinfoStandard->output_ceiling_meter > 99.9f) || (pSettings->nonMetricalSystem))
38
+ − 3364 snprintf(text,TEXTSIZE,"\020%01.0f",unit_depth_float(pDecoinfoStandard->output_ceiling_meter));
+ − 3365 else
+ − 3366 snprintf(text,TEXTSIZE,"\020%01.1f",pDecoinfoStandard->output_ceiling_meter);
+ − 3367 break;
+ − 3368
+ − 3369 /* Future TTS */
442
+ − 3370 case LLC_FutureTTS:
38
+ − 3371 headerText[2] = TXT_FutureTTS;
214
+ − 3372 if (pDecoinfoFuture->output_time_to_surface_seconds < 1000 * 60)
710
+ − 3373 snprintf(text,TEXTSIZE,"\020\016\016@+%u'\n\r" "%i' TTS",pSettings->future_TTS, (pDecoinfoFuture->output_time_to_surface_seconds + 59) / 60);
214
+ − 3374 else
710
+ − 3375 snprintf(text,TEXTSIZE,"\020\016\016@+%u'\n\r" "%ih TTS",pSettings->future_TTS, (pDecoinfoFuture->output_time_to_surface_seconds + 59) / 3600);
38
+ − 3376 tinyHeaderFont = 1;
+ − 3377 line = 1;
+ − 3378 break;
+ − 3379
+ − 3380 /* CNS */
442
+ − 3381 case LLC_CNS:
38
+ − 3382 headerText[2] = TXT_CNS;
+ − 3383 fCNS = stateUsed->lifeData .cns;
+ − 3384 if(fCNS > 999)
+ − 3385 fCNS = 999;
+ − 3386 snprintf(text,TEXTSIZE,"\020%.0f\016\016%%\017",fCNS);
+ − 3387 break;
+ − 3388
+ − 3389 /* actual GF */
442
+ − 3390 case LLC_GF:
38
+ − 3391 headerText[2] = TXT_ActualGradient;
247
+ − 3392 snprintf(text,TEXTSIZE,"\020%.0f\016\016%%\017",100 * pDecoinfoStandard->super_saturation);
38
+ − 3393 break;
656
+ − 3394
+ − 3395 case LLC_ScrubberTime:
+ − 3396 tinyHeaderFont = 1;
+ − 3397 headerText[2] = TXT_ScrubTime;
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 3398
980
+ − 3399 printScrubberText(text, TEXTSIZE, stateUsed->scrubberDataDive, pSettings);
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 3400
656
+ − 3401 break;
662
+ − 3402 #ifdef ENABLE_PSCR_MODE
+ − 3403 case LCC_SimPpo2:
+ − 3404 headerText[2] = TXT_SimPpo2;
+ − 3405 snprintf(text,TEXTSIZE,"\020%.2f\016\016Bar\017",stateUsed->lifeData.ppo2Simulated_bar);
+ − 3406 break;
+ − 3407 #endif
656
+ − 3408
446
+ − 3409 #ifdef ENABLE_BOTTLE_SENSOR
442
+ − 3410 case LCC_BottleBar:
+ − 3411 headerText[2] = TXT_AtemGasVorrat;
+ − 3412 tinyHeaderFont = 1;
448
+ − 3413 snprintf(text,TEXTSIZE,"%d\016\016\017", stateUsed->lifeData.bottle_bar[stateUsed->lifeData.actualGas.GasIdInSettings]);
442
+ − 3414 break;
446
+ − 3415 #endif
749
+ − 3416 #ifdef ENABLE_CO2_SUPPORT
+ − 3417 case LCC_CO2:
+ − 3418 headerText[2] = TXT_CO2Sensor;
+ − 3419 if(stateUsed->lifeData.CO2_data.CO2_ppm < CO2_WARNING_LEVEL_PPM)
+ − 3420 {
+ − 3421 text[textpointer++] = '\020';
+ − 3422 }
+ − 3423 else if(stateUsed->lifeData.CO2_data.CO2_ppm < CO2_ALARM_LEVEL_PPM)
+ − 3424 {
+ − 3425 text[textpointer++] = '\024'; /* yellow */
+ − 3426 }
+ − 3427 else
+ − 3428 {
+ − 3429 text[textpointer++] = '\025'; /* red */
+ − 3430 }
+ − 3431 snprintf(&text[textpointer],TEXTSIZE,"\%5ldppm", stateUsed->lifeData.CO2_data.CO2_ppm);
799
+ − 3432 break;
749
+ − 3433 #endif
737
+ − 3434 case LLC_Compass:
+ − 3435 headerText[2] = TXT_2BYTE;
+ − 3436 headerText[3] = TXT2BYTE_Compass;
+ − 3437 tinyHeaderFont = 1;
+ − 3438
+ − 3439 uint16_t heading;
+ − 3440 if(settingsGetPointer()->compassInertia) {
+ − 3441 heading = (uint16_t)compass_getCompensated();
+ − 3442 } else {
+ − 3443 heading = (uint16_t)stateUsed->lifeData.compass_heading;
+ − 3444 }
+ − 3445
+ − 3446 uint16_t userSetHeading = stateUsed->diveSettings.compassHeading;
+ − 3447 if (!userSetHeading) {
+ − 3448 snprintf(text, TEXTSIZE, "\020\002\034%u ", heading);
+ − 3449 } else {
+ − 3450 snprintf(text, TEXTSIZE, "\020\002\034\016\016%u ", heading);
+ − 3451
+ − 3452 int16_t declinationFromForwardMark = ((userSetHeading - heading + 180 + 360) % 360) - 180;
+ − 3453 int16_t declinationFromNearestMark = ((declinationFromForwardMark + 90 + 180) % 180) - 90;
+ − 3454
+ − 3455 uint16_t colour;
+ − 3456 if (abs(declinationFromForwardMark) <= 90) {
+ − 3457 colour = CLUT_CompassUserHeadingTick;
+ − 3458 } else {
+ − 3459 colour = CLUT_CompassUserBackHeadingTick;
+ − 3460 }
+ − 3461
+ − 3462 char direction[] = "\001 \004 \004 ";
+ − 3463 if (abs(declinationFromNearestMark) <= 10) {
+ − 3464 direction[2] = '>';
+ − 3465 direction[6] = '<';
+ − 3466
+ − 3467 if (abs(declinationFromForwardMark) <= 10) {
+ − 3468 direction[4] = 'X';
+ − 3469 } else {
+ − 3470 direction[4] = 'O';
+ − 3471 }
+ − 3472
+ − 3473 if (abs(declinationFromNearestMark) <= 3) {
+ − 3474 direction[3] = '\a';
+ − 3475 direction[5] = '\a';
+ − 3476 }
+ − 3477 } else {
+ − 3478 if (declinationFromForwardMark < -90) {
+ − 3479 direction[7] = 'O';
+ − 3480 } else if (declinationFromForwardMark < 0) {
+ − 3481 direction[1] = 'X';
+ − 3482 } else if (declinationFromForwardMark <= 90) {
+ − 3483 direction[7] = 'X';
+ − 3484 } else {
+ − 3485 direction[1] = 'O';
+ − 3486 }
+ − 3487
+ − 3488 if (declinationFromNearestMark >= 0) {
+ − 3489 direction[6] = '>';
+ − 3490 }
+ − 3491 if (declinationFromNearestMark > 30) {
+ − 3492 direction[4] = '>';
+ − 3493 }
+ − 3494 if (declinationFromNearestMark > 60 || declinationFromForwardMark == 90) {
+ − 3495 direction[2] = '>';
+ − 3496 }
+ − 3497 if (declinationFromNearestMark < 0) {
+ − 3498 direction[2] = '<';
+ − 3499 }
+ − 3500 if (declinationFromNearestMark < -30) {
+ − 3501 direction[4] = '<';
+ − 3502 }
+ − 3503 if (declinationFromNearestMark < -60 || declinationFromForwardMark == -90) {
+ − 3504 direction[6] = '<';
+ − 3505 }
+ − 3506 }
+ − 3507
+ − 3508 GFX_write_string_color(&FontT48, &t7l3, direction, 1, colour);
+ − 3509 }
+ − 3510
+ − 3511 break;
38
+ − 3512 }
737
+ − 3513
+ − 3514 if (headerText[2] != TXT_2BYTE) {
+ − 3515 headerText[3] = 0;
+ − 3516 } else {
+ − 3517 headerText[4] = 0;
+ − 3518 }
38
+ − 3519
+ − 3520 if(tinyHeaderFont)
+ − 3521 GFX_write_string(&FontT24,&t7l3,headerText,0);
+ − 3522 else
+ − 3523 GFX_write_string(&FontT42,&t7l3,headerText,0);
+ − 3524
868
+ − 3525 Gfx_colorsscheme_mod(text, 0);
446
+ − 3526 #ifndef ENABLE_BOTTLE_SENSOR
748
+ − 3527 #ifdef ENABLE_CO2_SUPPORT
+ − 3528 if(selection_custom_field != LCC_CO2)
+ − 3529 {
+ − 3530 GFX_write_string(&FontT105,&t7l3,text,line);
+ − 3531 }
+ − 3532 else
+ − 3533 {
+ − 3534 GFX_write_string(&FontT48,&t7l3,text,line);
+ − 3535 }
+ − 3536 #else
+ − 3537 GFX_write_string(&FontT105,&t7l3,text,line);
+ − 3538 #endif
446
+ − 3539 #else
+ − 3540 if(selection_custom_field != LCC_BottleBar) /* a changing color set is used for bar display */
442
+ − 3541 {
+ − 3542 GFX_write_string(&FontT105,&t7l3,text,line);
+ − 3543 }
+ − 3544 else
+ − 3545 {
448
+ − 3546 agedColor = stateUsed->lifeData.bottle_bar_age_MilliSeconds[stateUsed->lifeData.actualGas.GasIdInSettings];
442
+ − 3547 if(agedColor > 1200)
+ − 3548 {
448
+ − 3549 agedColor = CLUT_WarningRed;
442
+ − 3550 }
+ − 3551 else
+ − 3552 if(agedColor > 600)
448
+ − 3553 {
+ − 3554 agedColor = CLUT_MenuLineUnselected;
+ − 3555 }
+ − 3556 else
+ − 3557 if(agedColor > 20)
442
+ − 3558 {
448
+ − 3559 agedColor = CLUT_Font031;
442
+ − 3560 }
+ − 3561 else
+ − 3562 {
448
+ − 3563 agedColor = CLUT_Font020;
442
+ − 3564 }
+ − 3565
+ − 3566 GFX_write_string_color(&FontT105,&t7l3,text,line,agedColor);
+ − 3567 }
446
+ − 3568 #endif
38
+ − 3569 }
+ − 3570
+ − 3571 /* Private functions ---------------------------------------------------------*/
+ − 3572
+ − 3573 uint8_t t7_customtextPrepare(char * text)
+ − 3574 {
+ − 3575 uint8_t i, j, textptr, lineCount;
+ − 3576 char nextChar;
539
+ − 3577 uint8_t alignmentChanged = 0;
38
+ − 3578
+ − 3579 textptr = 0;
+ − 3580 lineCount = 0;
+ − 3581
+ − 3582 text[textptr++] = TXT_MINIMAL;
+ − 3583
+ − 3584 j = 0;
+ − 3585 i = 0;
+ − 3586 do
+ − 3587 {
+ − 3588 j += i;
+ − 3589 i = 0;
+ − 3590 do
+ − 3591 {
+ − 3592 nextChar = settingsGetPointer()->customtext[i+j];
539
+ − 3593 if((nextChar == '^') && (alignmentChanged == 0)) /* center */
537
+ − 3594 {
+ − 3595 text[textptr++] = '\001';
539
+ − 3596 alignmentChanged = 1;
537
+ − 3597 i++;
+ − 3598 }else
539
+ − 3599 if((nextChar == 180) && (alignmentChanged == 0)) /* '�' => Right */
537
+ − 3600 {
+ − 3601 text[textptr++] = '\002';
539
+ − 3602 alignmentChanged = 1;
537
+ − 3603 i++;
+ − 3604 }else
+ − 3605 {
+ − 3606 i++;
+ − 3607 if((!nextChar) || (nextChar =='\n') || (nextChar =='\r'))
+ − 3608 {
+ − 3609 break;
+ − 3610 }
+ − 3611 text[textptr++] = nextChar;
+ − 3612 }
38
+ − 3613 } while (i < 12);
+ − 3614
537
+ − 3615 if(i == 12) /* exit by limit => check for blanks at the end of the string */
+ − 3616 {
+ − 3617 while((textptr - 1 > 0) && (text[textptr - 1] == 32))
+ − 3618 {
+ − 3619 textptr--;
+ − 3620 }
+ − 3621 }
+ − 3622
38
+ − 3623 if(!nextChar)
+ − 3624 break;
+ − 3625
+ − 3626 if(lineCount < 3)
+ − 3627 {
+ − 3628 text[textptr++] = '\n';
+ − 3629 text[textptr++] = '\r';
+ − 3630 }
539
+ − 3631 alignmentChanged = 0;
38
+ − 3632 lineCount++;
+ − 3633 for(uint8_t k=0;k<2;k++)
+ − 3634 {
+ − 3635 nextChar = settingsGetPointer()->customtext[i+j+k];
+ − 3636 if((nextChar =='\n') || (nextChar =='\r'))
+ − 3637 i++;
+ − 3638 else
+ − 3639 break;
+ − 3640 }
+ − 3641
+ − 3642 } while (lineCount < 4);
+ − 3643
+ − 3644 text[textptr] = 0;
+ − 3645 return lineCount;
+ − 3646 }
+ − 3647
+ − 3648 void draw_frame(_Bool PluginBoxHeader, _Bool LinesOnTheSides, uint8_t colorBox, uint8_t colorLinesOnTheSide)
+ − 3649 {
+ − 3650 point_t LeftLow, WidthHeight;
+ − 3651 point_t start, stop;
+ − 3652
110
+ − 3653 SSettings* pSettings;
+ − 3654 pSettings = settingsGetPointer();
+ − 3655
38
+ − 3656 // plugin box
+ − 3657 LeftLow.x = CUSTOMBOX_LINE_LEFT;
+ − 3658 WidthHeight.x = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_LINE_LEFT;
+ − 3659 LeftLow.y = 60;
+ − 3660 WidthHeight.y = 440 - LeftLow.y;
642
+ − 3661 if((viewInFocus() && (!viewDetectionSuspended())))
553
+ − 3662 {
+ − 3663 GFX_draw_box(&t7screen, LeftLow, WidthHeight, 1, CLUT_Font023);
+ − 3664 }
+ − 3665 else
+ − 3666 {
+ − 3667 GFX_draw_box(&t7screen, LeftLow, WidthHeight, 1, colorBox);
+ − 3668 }
38
+ − 3669
+ − 3670 if(PluginBoxHeader)
+ − 3671 {
+ − 3672 // plugin box - header
+ − 3673 start.x = CUSTOMBOX_LINE_LEFT;
+ − 3674 stop.x = CUSTOMBOX_LINE_RIGHT;
+ − 3675 stop.y = start.y = 440 - 60;
+ − 3676 GFX_draw_line(&t7screen, start, stop, colorBox);
+ − 3677 }
+ − 3678
+ − 3679 if(LinesOnTheSides)
+ − 3680 {
+ − 3681 // aufteilung links
+ − 3682 start.x = 0;
+ − 3683 stop.x = CUSTOMBOX_LINE_LEFT;
110
+ − 3684 if(!pSettings->FlipDisplay)
+ − 3685 {
+ − 3686 stop.y = start.y = t7l1.WindowY0 - 1;
+ − 3687 }
+ − 3688 else
+ − 3689 {
+ − 3690 stop.y = start.y = 480 - t7l1.WindowY1 - 1;
+ − 3691 }
+ − 3692
38
+ − 3693 GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide);
110
+ − 3694 if(!pSettings->FlipDisplay)
+ − 3695 {
+ − 3696 stop.y = start.y = t7l2.WindowY0 -1;
+ − 3697 }
+ − 3698 else
+ − 3699 {
+ − 3700 stop.y = start.y = 480 - t7l2.WindowY1 -1;
+ − 3701 }
38
+ − 3702 GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide);
+ − 3703
+ − 3704 // aufteilung rechts
+ − 3705 start.x = CUSTOMBOX_LINE_RIGHT;
+ − 3706 stop.x = 799;
110
+ − 3707 if(!pSettings->FlipDisplay)
+ − 3708 {
+ − 3709 stop.y = start.y = t7l1.WindowY0 - 1;
+ − 3710 }
+ − 3711 else
+ − 3712 {
+ − 3713 stop.y = start.y = 480 - t7l1.WindowY1 - 1;
+ − 3714 }
+ − 3715
38
+ − 3716 GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide);
110
+ − 3717 if(!pSettings->FlipDisplay)
+ − 3718 {
+ − 3719 stop.y = start.y = t7l2.WindowY0 - 1;
+ − 3720 }
+ − 3721 else
+ − 3722 {
+ − 3723 stop.y = start.y = 480 - t7l2.WindowY1 - 1;
+ − 3724 }
38
+ − 3725 GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide);
+ − 3726 }
+ − 3727 }
+ − 3728
+ − 3729
+ − 3730 /* Compass like TCOS shellfish
+ − 3731 * input is 0 to 359
+ − 3732 * 2 px / 1 degree
+ − 3733 * Range is 148 degree with CUSTOMBOX_SPACE_INSIDE = 296
+ − 3734 * one side is 74 degree (less than 90 degree)
+ − 3735 * internal 360 + 180 degree of freedom
+ − 3736 * use positive values only, shift by 360 below 90 mid position
+ − 3737 */
+ − 3738
+ − 3739
+ − 3740 point_t t7_compass_circle(uint8_t id, uint16_t degree)
+ − 3741 {
+ − 3742 float fCos, fSin;
+ − 3743 const float piMult = ((2 * 3.14159) / 360);
+ − 3744 // const int radius[4] = {95,105,115,60};
+ − 3745 const int radius[4] = {95,105,115,100};
+ − 3746 const point_t offset = {.x = 400, .y = 250};
+ − 3747
+ − 3748 static point_t r[4][360] = { 0 };
+ − 3749
110
+ − 3750 if(r[0][0].y == 0) /* calc table at first call only */
38
+ − 3751 {
+ − 3752 for(int i=0;i<360;i++)
+ − 3753 {
+ − 3754 fCos = cos(i * piMult);
+ − 3755 fSin = sin(i * piMult);
+ − 3756 for(int j=0;j<4;j++)
+ − 3757 {
+ − 3758 r[j][i].x = offset.x + (int)(fSin * radius[j]);
+ − 3759 r[j][i].y = offset.y + (int)(fCos * radius[j]);
+ − 3760 }
+ − 3761 }
+ − 3762 }
+ − 3763 if(id > 3) id = 0;
+ − 3764 if(degree > 359) degree = 0;
+ − 3765 return r[id][degree];
+ − 3766 }
+ − 3767
+ − 3768 /* range should be 0 to 30 bar if 300 meter with 100% of nitrogen or helium
+ − 3769 * T24 is 28 high
+ − 3770 */
+ − 3771 void t7_tissues(const SDiveState * pState)
+ − 3772 {
+ − 3773 point_t start, change, stop;
+ − 3774 float value;
+ − 3775 uint16_t front, cns100pixel;
+ − 3776 char text[256];
+ − 3777 uint8_t textpointer = 0;
+ − 3778 uint8_t color;
+ − 3779
+ − 3780 float percent_N2;
+ − 3781 float percent_He;
+ − 3782 float partial_pressure_N2;
+ − 3783 float partial_pressure_He;
+ − 3784
110
+ − 3785 SSettings* pSettings;
+ − 3786 pSettings = settingsGetPointer();
+ − 3787
38
+ − 3788
+ − 3789 /* N2 */
+ − 3790 t7cY0free.WindowLineSpacing = 28 + 48 + 14;
110
+ − 3791 if(!pSettings->FlipDisplay)
+ − 3792 {
+ − 3793 t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing;
+ − 3794 }
+ − 3795 else
+ − 3796 {
+ − 3797 t7cY0free.WindowY0 = t7cH.WindowY0 + 15;
+ − 3798 t7cY0free.WindowY1 = t7cY0free.WindowY0 + 250;
+ − 3799 }
38
+ − 3800 t7cY0free.WindowNumberOfTextLines = 3;
+ − 3801
+ − 3802 text[textpointer++] = '\030';
+ − 3803 text[textpointer++] = TXT_2BYTE;
+ − 3804 text[textpointer++] = TXT2BYTE_Nitrogen;
+ − 3805 text[textpointer++] = '\n';
+ − 3806 text[textpointer++] = '\r';
+ − 3807 text[textpointer++] = TXT_2BYTE;
+ − 3808 text[textpointer++] = TXT2BYTE_Helium;
+ − 3809 text[textpointer++] = '\n';
+ − 3810 text[textpointer++] = '\r';
+ − 3811 text[textpointer++] = TXT_2BYTE;
+ − 3812 text[textpointer++] = TXT2BYTE_CNS;
+ − 3813 text[textpointer++] = 0;
+ − 3814
+ − 3815 GFX_write_string(&FontT24, &t7cY0free, text, 1);
+ − 3816
110
+ − 3817 if(!pSettings->FlipDisplay)
+ − 3818 {
+ − 3819 start.y = t7cH.WindowY0 - 5;
+ − 3820 }
+ − 3821 else
+ − 3822 {
+ − 3823 start.y = t7cH.WindowY1 - 5;
+ − 3824 }
38
+ − 3825 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
+ − 3826 stop.x = start.x + CUSTOMBOX_SPACE_INSIDE;
+ − 3827
+ − 3828 for(int i=0;i<16;i++)
+ − 3829 {
+ − 3830 stop.y = start.y;
+ − 3831 change.y = start.y;
+ − 3832
+ − 3833 value = pState->lifeData.tissue_nitrogen_bar[i] - 0.7512f;
222
+ − 3834 value *= 80;
38
+ − 3835
+ − 3836 if(value < 0)
+ − 3837 front = 0;
+ − 3838 else
+ − 3839 if(value > CUSTOMBOX_SPACE_INSIDE)
+ − 3840 front = CUSTOMBOX_SPACE_INSIDE;
+ − 3841 else
+ − 3842 front = (uint16_t)value;
+ − 3843
+ − 3844 change.x = start.x + front;
+ − 3845 if(change.x != start.x)
+ − 3846 GFX_draw_thick_line(1,&t7screen, start, change, CLUT_Font030);
+ − 3847 if(change.x != stop.x)
+ − 3848 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font031);
+ − 3849
+ − 3850 start.y -= 3;
+ − 3851 }
+ − 3852
+ − 3853 /* He */
+ − 3854 start.y -= 28 + 14;
+ − 3855 for(int i=0;i<16;i++)
+ − 3856 {
+ − 3857 stop.y = start.y;
+ − 3858 change.y = start.y;
+ − 3859
+ − 3860 value = pState->lifeData.tissue_helium_bar[i];
+ − 3861 value *= 80;//20
+ − 3862
+ − 3863 if(value < 0)
+ − 3864 front = 0;
+ − 3865 else if(value > CUSTOMBOX_SPACE_INSIDE)
+ − 3866 front = CUSTOMBOX_SPACE_INSIDE;
+ − 3867 else
+ − 3868 front = (uint16_t)value;
+ − 3869
+ − 3870 change.x = start.x + front;
+ − 3871 if(change.x != start.x)
+ − 3872 GFX_draw_thick_line(1,&t7screen, start, change, CLUT_Font030);
+ − 3873 if(change.x != stop.x)
+ − 3874 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font031);
+ − 3875
+ − 3876 start.y -= 3;
+ − 3877 }
+ − 3878
+ − 3879 /* CNS == Oxygen */
+ − 3880 start.y -= 28 + 14;
+ − 3881
+ − 3882 cns100pixel = (8 * CUSTOMBOX_SPACE_INSIDE) / 10;
+ − 3883 value = pState->lifeData.cns;
+ − 3884 value *= cns100pixel;
+ − 3885 value /= 100;
+ − 3886
+ − 3887 if(value < 0)
+ − 3888 front = 0;
+ − 3889 else if(value > CUSTOMBOX_SPACE_INSIDE)
+ − 3890 front = CUSTOMBOX_SPACE_INSIDE;
+ − 3891 else
+ − 3892 front = (uint16_t)value;
+ − 3893
+ − 3894 if(pState->lifeData.cns < 95)
+ − 3895 color = CLUT_Font030;
+ − 3896 else if(pState->lifeData.cns < 100)
+ − 3897 color = CLUT_WarningYellow;
+ − 3898 else
+ − 3899 color = CLUT_WarningRed;
+ − 3900
+ − 3901 for(int i=0;i<16;i++)
+ − 3902 {
+ − 3903 stop.y = start.y;
+ − 3904 change.y = start.y;
+ − 3905
+ − 3906 change.x = start.x + front;
+ − 3907 if(change.x != start.x)
+ − 3908 GFX_draw_thick_line(1,&t7screen, start, change, color);
+ − 3909 if(change.x != stop.x)
+ − 3910 GFX_draw_thick_line(1,&t7screen, change, stop, CLUT_Font031);
+ − 3911
+ − 3912 start.y -= 3;
+ − 3913 }
+ − 3914
+ − 3915 /* where is the onload/offload limit for N2 and He */
+ − 3916 decom_get_inert_gases(pState->lifeData.pressure_ambient_bar, &pState->lifeData.actualGas, &percent_N2, &percent_He);
+ − 3917 partial_pressure_N2 = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_N2;
+ − 3918 partial_pressure_He = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_He;
+ − 3919
+ − 3920 // Nitrogen vertical bar
110
+ − 3921 if(!pSettings->FlipDisplay)
+ − 3922 {
+ − 3923 start.y = t7cH.WindowY0 + 1 - 5;
+ − 3924 }
+ − 3925 else
+ − 3926 {
+ − 3927 start.y = t7cH.WindowY1 - 5;
+ − 3928 }
+ − 3929
38
+ − 3930 stop.y = start.y - (3 * 15) - 1;
222
+ − 3931 if((percent_N2 > 0) && (partial_pressure_N2 > 0.7512f))
38
+ − 3932 {
222
+ − 3933 value = partial_pressure_N2 - 0.7512f;
+ − 3934 value *= 80;
38
+ − 3935
+ − 3936 if(value < 0)
+ − 3937 front = 3;
+ − 3938 else if(value + 5 > CUSTOMBOX_SPACE_INSIDE)
+ − 3939 front = CUSTOMBOX_SPACE_INSIDE - 3;
+ − 3940 else
+ − 3941 front = (uint16_t)value;
+ − 3942 }
+ − 3943 else
+ − 3944 {
+ − 3945 front = 1;
+ − 3946 }
+ − 3947 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + front;
+ − 3948 stop.x = start.x;
+ − 3949 GFX_draw_thick_line(2,&t7screen, start, stop, CLUT_EverythingOkayGreen);
+ − 3950
+ − 3951
+ − 3952 // Helium vertical bar
110
+ − 3953 if(!pSettings->FlipDisplay)
+ − 3954 {
+ − 3955 start.y = t7cH.WindowY0 + 1 - 5 - 3*16 - 28 - 14;
+ − 3956 }
+ − 3957 else
+ − 3958 {
+ − 3959 start.y = t7cH.WindowY1 - 5 - 3*16 - 28 - 14;
+ − 3960 }
+ − 3961
38
+ − 3962 stop.y = start.y - (3 * 15) - 1;
+ − 3963 if((percent_He > 0) && (partial_pressure_He > 0.01f)) // 0.5f
+ − 3964 {
+ − 3965
+ − 3966 value = partial_pressure_He;
222
+ − 3967 value *= 80;
38
+ − 3968
+ − 3969 if(value < 0)
+ − 3970 front = 3;
+ − 3971 else if(value + 5 > CUSTOMBOX_SPACE_INSIDE)
+ − 3972 front = CUSTOMBOX_SPACE_INSIDE - 3;
+ − 3973 else
+ − 3974 front = (uint16_t)value;
+ − 3975 }
+ − 3976 else
+ − 3977 {
+ − 3978 front = 1;
+ − 3979 }
+ − 3980
+ − 3981 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + front;
+ − 3982 stop.x = start.x;
+ − 3983 GFX_draw_thick_line(2,&t7screen, start, stop, CLUT_EverythingOkayGreen);
+ − 3984
+ − 3985 // Oxygen vertical bar
110
+ − 3986 if(!pSettings->FlipDisplay)
+ − 3987 {
+ − 3988 start.y = t7cH.WindowY0 + 1 - 5 - 6*16 - 2*28 - 2*14;
+ − 3989 }
+ − 3990 else
+ − 3991 {
+ − 3992 start.y = t7cH.WindowY1 - 5 - 6*16 - 2*28 - 2*14;
+ − 3993 }
+ − 3994
38
+ − 3995 stop.y = start.y - (3 * 15) - 1;
+ − 3996
+ − 3997 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + cns100pixel;
+ − 3998 stop.x = start.x;
+ − 3999 GFX_draw_thick_line(2, &t7screen, start, stop, CLUT_WarningRed);
110
+ − 4000
38
+ − 4001 }
+ − 4002
+ − 4003
+ − 4004 void t7_debug(void)
+ − 4005 {
+ − 4006 char text[256+50];
+ − 4007 uint8_t textpointer = 0;
+ − 4008
+ − 4009 t7cY0free.WindowLineSpacing = 28 + 48 + 14;
+ − 4010 t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing;
+ − 4011 t7cY0free.WindowNumberOfTextLines = 3;
+ − 4012
896
+ − 4013 #ifdef T7_DEBUG_RUNTIME
+ − 4014 textpointer += snprintf(&text[textpointer],50,"Main loop %ld\n\r",getMainLoopTime());
+ − 4015 textpointer += snprintf(&text[textpointer],50,"Grafic loop %ld\n\r",getGfxLoopTime());
+ − 4016 textpointer += snprintf(&text[textpointer],50,"Decoloop %ld\n\r",getDecoLoopTime());
+ − 4017 GFX_write_string(&FontT24, &t7cY0free, text, 1);
+ − 4018 #else
38
+ − 4019 textpointer += snprintf(&text[textpointer],50,"Ambient [bar]\n\r");
+ − 4020 textpointer += snprintf(&text[textpointer],50,"Surface [bar] + salt\n\r");
+ − 4021 // textpointer += snprintf(&text[textpointer],50,"Difference [mbar]\n\r");
+ − 4022 textpointer += snprintf(&text[textpointer],50,"ShallowCounter [s]\n\r");
+ − 4023 GFX_write_string(&FontT24, &t7cY0free, text, 1);
+ − 4024
+ − 4025 t7cY0free.WindowY0 -= 52;
+ − 4026 // 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));
+ − 4027 snprintf(text,60,
+ − 4028 "%0.2f\n\r"
+ − 4029 "%0.2f %u%%\n\r"
+ − 4030 "%u"
+ − 4031 ,stateUsed->lifeData.pressure_ambient_bar
+ − 4032 ,stateUsed->lifeData.pressure_surface_bar
+ − 4033 ,settingsGetPointer()->salinity
+ − 4034 ,stateUsed->lifeData.counterSecondsShallowDepth);
+ − 4035 GFX_write_string(&FontT42, &t7cY0free, text, 1);
896
+ − 4036 #endif
38
+ − 4037 }
+ − 4038
899
+ − 4039 void t7_showPosition(void)
+ − 4040 {
+ − 4041 char text[256+50];
+ − 4042 uint8_t textpointer = 0;
934
+ − 4043 point_t start, stop;
+ − 4044 uint8_t index = 0;
+ − 4045 uint8_t color = 0;
962
+ − 4046 SSettings* pSettings = settingsGetPointer();
899
+ − 4047
+ − 4048 t7cY0free.WindowLineSpacing = 28 + 48 + 14;
+ − 4049 t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing;
+ − 4050 t7cY0free.WindowNumberOfTextLines = 3;
934
+ − 4051 t7cY0free.WindowY0 -= 20;
962
+ − 4052
+ − 4053 t7cY0free.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
+ − 4054 t7cY0free.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET;
+ − 4055
+ − 4056 if(pSettings->FlipDisplay)
+ − 4057 {
+ − 4058 t7cY0free.WindowY0 = t7cH.WindowY0 + 15;
+ − 4059 t7cY0free.WindowY1 = t7cY0free.WindowY0 + 250;
+ − 4060 }
+ − 4061
934
+ − 4062 if(stateUsed->lifeData.gnssData.fixType < 2)
+ − 4063 {
+ − 4064 textpointer += snprintf(&text[textpointer],50,"\001Satellites\n\r");
955
+ − 4065 if(stateUsed->lifeData.gnssData.alive & GNSS_ALIVE_STATE_ALIVE)
940
+ − 4066 {
+ − 4067 textpointer += snprintf(&text[textpointer],50,"\001\020Status\n\r");
+ − 4068 }
+ − 4069 else
+ − 4070 {
+ − 4071 textpointer += snprintf(&text[textpointer],50,"\001\021Status\n\r");
+ − 4072 }
934
+ − 4073 }
+ − 4074 else
+ − 4075 {
+ − 4076 textpointer += snprintf(&text[textpointer],50,"\001Longitude\n\r");
+ − 4077 textpointer += snprintf(&text[textpointer],50,"\001Latitude\n\r");
+ − 4078 }
899
+ − 4079 GFX_write_string(&FontT24, &t7cY0free, text, 1);
+ − 4080
962
+ − 4081 if(!pSettings->FlipDisplay)
+ − 4082 {
+ − 4083 t7cY0free.WindowY0 -= 52;
+ − 4084 }
+ − 4085 else
+ − 4086 {
+ − 4087 t7cY0free.WindowY1 = 370;
+ − 4088 }
+ − 4089
934
+ − 4090 if(stateUsed->lifeData.gnssData.fixType < 2)
+ − 4091 {
+ − 4092 snprintf(text,60,"\001%d\n\r",stateUsed->lifeData.gnssData.numSat);
+ − 4093 }
+ − 4094 else
+ − 4095 {
+ − 4096 snprintf(text,60,
+ − 4097 "\001%0.5f\n\r"
+ − 4098 "\001%0.5f\n\r"
941
+ − 4099 ,stateUsed->lifeData.gnssData.coord.fLat ,stateUsed->lifeData.gnssData.coord.fLon);
934
+ − 4100 }
899
+ − 4101 GFX_write_string(&FontT42, &t7cY0free, text, 1);
934
+ − 4102
+ − 4103 if(stateUsed->lifeData.gnssData.fixType < 2) /* draw status bars */
+ − 4104 {
962
+ − 4105 if(!pSettings->FlipDisplay)
+ − 4106 {
+ − 4107 start.x = t7cY0free.WindowX0 + 85;
+ − 4108 stop.x = start.x;
+ − 4109 start.y = t7cY0free.WindowY0 + 75;
+ − 4110 stop.y = start.y + 20;
+ − 4111 }
+ − 4112 else
+ − 4113 {
+ − 4114 start.x = t7cY0free.WindowX0 - 50;
+ − 4115 stop.x = start.x;
+ − 4116 start.y = t7cY0free.WindowY0 - 75;
+ − 4117 stop.y = start.y - 20;
+ − 4118 }
+ − 4119
934
+ − 4120 while((index < stateUsed->lifeData.gnssData.numSat) && (index < 4))
+ − 4121 {
+ − 4122 if(stateUsed->lifeData.gnssData.signalQual[index] > 4) color = CLUT_NiceGreen;
+ − 4123 if((stateUsed->lifeData.gnssData.signalQual[index] > 2) && (stateUsed->lifeData.gnssData.signalQual[index] <= 4)) color = CLUT_WarningYellow;
+ − 4124 if(stateUsed->lifeData.gnssData.signalQual[index] <= 2) color = CLUT_WarningRed;
+ − 4125 GFX_draw_thick_line(20, &t7screen, start, stop, color);
+ − 4126 start.x += 40;
+ − 4127 stop.x += 40;
+ − 4128
+ − 4129 index++;
+ − 4130 }
955
+ − 4131 if(stateUsed->lifeData.gnssData.alive & GNSS_ALIVE_BACKUP_POS)
+ − 4132 {
+ − 4133 snprintf(text,50,"\001%2.2f %2.2f", stateUsed->lifeData.gnssData.coord.fLat,stateUsed->lifeData.gnssData.coord.fLon);
+ − 4134 GFX_write_string(&FontT24, &t7cY0free, text, 3);
+ − 4135 }
934
+ − 4136 }
+ − 4137
+ − 4138
899
+ − 4139 }
38
+ − 4140 void t7_SummaryOfLeftCorner(void)
+ − 4141 {
+ − 4142 char text[256+60];
+ − 4143 uint8_t textpointer = 0;
656
+ − 4144 SSettings* pSettings = settingsGetPointer();
38
+ − 4145
+ − 4146 const SDecoinfo * pDecoinfoStandard;
+ − 4147 const SDecoinfo * pDecoinfoFuture;
+ − 4148 float fCNS;
+ − 4149
+ − 4150 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE)
+ − 4151 {
+ − 4152 pDecoinfoStandard = &stateUsed->decolistBuehlmann;
+ − 4153 pDecoinfoFuture = &stateUsed->decolistFutureBuehlmann;
+ − 4154 }
+ − 4155 else
+ − 4156 {
+ − 4157 pDecoinfoStandard = &stateUsed->decolistVPM;
+ − 4158 pDecoinfoFuture = &stateUsed->decolistFutureVPM;
+ − 4159 }
+ − 4160
+ − 4161 fCNS = stateUsed->lifeData .cns;
+ − 4162 if(fCNS > 999)
+ − 4163 fCNS = 999;
+ − 4164
+ − 4165 t7cY0free.WindowY0 = t7cC.WindowY0 - 10;
656
+ − 4166 if(pSettings->FlipDisplay)
315
+ − 4167 {
+ − 4168 t7cY0free.WindowY1 = 400;
+ − 4169 }
+ − 4170
38
+ − 4171 t7cY0free.WindowLineSpacing = 48;
+ − 4172 t7cY0free.WindowNumberOfTextLines = 6;
+ − 4173 t7cY0free.WindowTab = 420;
+ − 4174
+ − 4175 // header
+ − 4176 textpointer = 0;
+ − 4177 text[textpointer++] = '\032';
+ − 4178 text[textpointer++] = '\016';
+ − 4179 text[textpointer++] = '\016';
+ − 4180 text[textpointer++] = TXT_ppO2;
+ − 4181 text[textpointer++] = '\n';
+ − 4182 text[textpointer++] = '\r';
+ − 4183 text[textpointer++] = TXT_Ceiling;
+ − 4184 text[textpointer++] = '\n';
+ − 4185 text[textpointer++] = '\r';
+ − 4186 text[textpointer++] = TXT_ActualGradient;
+ − 4187 text[textpointer++] = '\n';
+ − 4188 text[textpointer++] = '\r';
+ − 4189 text[textpointer++] = TXT_CNS;
+ − 4190 text[textpointer++] = '\n';
+ − 4191 text[textpointer++] = '\r';
+ − 4192 text[textpointer++] = TXT_FutureTTS;
656
+ − 4193 text[textpointer++] = '\n';
+ − 4194 text[textpointer++] = '\r';
662
+ − 4195 if((pSettings->scrubTimerMode != SCRUB_TIMER_OFF) && (isLoopMode(pSettings->dive_mode)))
656
+ − 4196 {
+ − 4197 text[textpointer++] = TXT_ScrubTime;
+ − 4198
+ − 4199 }
38
+ − 4200 text[textpointer++] = '\017';
656
+ − 4201 text[textpointer++] = 0;
+ − 4202 if(!pSettings->FlipDisplay)
315
+ − 4203 {
+ − 4204 t7cY0free.WindowX0 += 10;
+ − 4205 t7cY0free.WindowY0 += 10;
+ − 4206 GFX_write_string(&FontT24, &t7cY0free, text, 1);
+ − 4207 t7cY0free.WindowX0 -= 10;
+ − 4208 t7cY0free.WindowY0 -= 10;
+ − 4209 }
+ − 4210 else
+ − 4211 {
+ − 4212 t7cY0free.WindowY1 -= 10;
+ − 4213 t7cY0free.WindowX1 -= 10;
+ − 4214 GFX_write_string(&FontT24, &t7cY0free, text, 1);
+ − 4215 t7cY0free.WindowY1 += 10;
+ − 4216 t7cY0free.WindowX1 += 10;
+ − 4217 }
38
+ − 4218 textpointer = 0;
+ − 4219 text[textpointer++] = '\t';
+ − 4220 textpointer += snprintf(&text[textpointer],10,"\020%01.2f", stateUsed->lifeData.ppO2);
+ − 4221 text[textpointer++] = '\n';
+ − 4222 text[textpointer++] = '\r';
+ − 4223 text[textpointer++] = '\t';
+ − 4224 if((pDecoinfoStandard->output_ceiling_meter > 99.9f) || (settingsGetPointer()->nonMetricalSystem))
215
+ − 4225 textpointer += snprintf(&text[textpointer],10,"\020%01.0f",unit_depth_float(pDecoinfoStandard->output_ceiling_meter));
38
+ − 4226 else
215
+ − 4227 textpointer += snprintf(&text[textpointer],10,"\020%01.1f",pDecoinfoStandard->output_ceiling_meter);
38
+ − 4228 text[textpointer++] = '\n';
+ − 4229 text[textpointer++] = '\r';
+ − 4230 text[textpointer++] = '\t';
247
+ − 4231 textpointer += snprintf(&text[textpointer],10,"\020%.0f\016\016%%\017", 100 * pDecoinfoStandard->super_saturation);
38
+ − 4232 text[textpointer++] = '\n';
+ − 4233 text[textpointer++] = '\r';
+ − 4234 text[textpointer++] = '\t';
+ − 4235 textpointer += snprintf(&text[textpointer],10,"\020%.0f\016\016%%\017",fCNS);
+ − 4236 text[textpointer++] = '\n';
+ − 4237 text[textpointer++] = '\r';
+ − 4238 text[textpointer++] = '\t';
214
+ − 4239 if (pDecoinfoFuture->output_time_to_surface_seconds < 1000 * 60)
+ − 4240 textpointer += snprintf(&text[textpointer],10,"\020%i'", (pDecoinfoFuture->output_time_to_surface_seconds + 59) / 60);
+ − 4241 else
+ − 4242 textpointer += snprintf(&text[textpointer],10,"\020%ih", (pDecoinfoFuture->output_time_to_surface_seconds + 59) / 3600);
656
+ − 4243
662
+ − 4244 if((pSettings->scrubTimerMode != SCRUB_TIMER_OFF) && (isLoopMode(pSettings->dive_mode)))
656
+ − 4245 {
+ − 4246 text[textpointer++] = '\n';
+ − 4247 text[textpointer++] = '\r';
+ − 4248 text[textpointer++] = '\t';
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 4249
980
+ − 4250 textpointer += printScrubberText(&text[textpointer], 10, stateUsed->scrubberDataDive, pSettings);
656
+ − 4251 }
38
+ − 4252 text[textpointer++] = 0;
868
+ − 4253 Gfx_colorsscheme_mod(text, 0);
38
+ − 4254 GFX_write_string(&FontT42, &t7cY0free, text, 1);
+ − 4255 }
+ − 4256
+ − 4257 void t7_compass(uint16_t ActualHeading, uint16_t UserSetHeading)
+ − 4258 {
110
+ − 4259 uint16_t ActualHeadingRose;
38
+ − 4260 uint16_t LeftBorderHeading, LineHeading;
+ − 4261 uint32_t offsetPicture;
+ − 4262 point_t start, stop, center;
+ − 4263 static int32_t LastHeading = 0;
+ − 4264 int32_t newHeading = 0;
+ − 4265 int32_t diff = 0;
+ − 4266 int32_t diff2 = 0;
+ − 4267
+ − 4268 int32_t diffAbs = 0;
+ − 4269 int32_t diffAbs2 = 0;
+ − 4270
110
+ − 4271 SSettings* pSettings;
+ − 4272 pSettings = settingsGetPointer();
+ − 4273
38
+ − 4274 newHeading = ActualHeading;
+ − 4275
+ − 4276 diff = newHeading - LastHeading;
+ − 4277
+ − 4278 if(newHeading < LastHeading)
+ − 4279 diff2 = newHeading + 360 - LastHeading;
+ − 4280 else
+ − 4281 diff2 = newHeading - 360 - LastHeading;
+ − 4282
+ − 4283 diffAbs = diff;
+ − 4284 if(diffAbs < 0)
+ − 4285 diffAbs *= -1;
+ − 4286
+ − 4287 diffAbs2 = diff2;
+ − 4288 if(diffAbs2 < 0)
+ − 4289 diffAbs2 *= -1;
+ − 4290
+ − 4291
+ − 4292 if(diffAbs <= diffAbs2)
+ − 4293 newHeading = LastHeading + (diff / 2);
+ − 4294 else
+ − 4295 newHeading = LastHeading + (diff2 / 2);
+ − 4296
+ − 4297 if(newHeading < 0)
+ − 4298 newHeading += 360;
+ − 4299 else
+ − 4300 if(newHeading >= 360)
+ − 4301 newHeading -= 360;
+ − 4302
+ − 4303 LastHeading = newHeading;
+ − 4304 ActualHeading = newHeading;
110
+ − 4305 ActualHeadingRose = ActualHeading;
225
+ − 4306
110
+ − 4307 if(pSettings->FlipDisplay)
+ − 4308 {
+ − 4309 ActualHeadingRose = 360 - ActualHeadingRose;
+ − 4310 if (ActualHeadingRose < 170) ActualHeadingRose += 360;
+ − 4311 }
+ − 4312 else
+ − 4313 {
+ − 4314 if (ActualHeadingRose < 90) ActualHeadingRose += 360;
+ − 4315 ActualHeading = ActualHeadingRose;
+ − 4316 }
38
+ − 4317
+ − 4318 // new hw 160822
+ − 4319 // if (ActualHeading >= 360 + 90)
+ − 4320 // ActualHeading = 360;
+ − 4321
110
+ − 4322 LeftBorderHeading = 2 * (ActualHeadingRose - (CUSTOMBOX_SPACE_INSIDE/4));
+ − 4323
+ − 4324 if(pSettings->FlipDisplay) /* add offset caused by mirrowed drawing */
+ − 4325 {
+ − 4326 LeftBorderHeading += 2 * 80;
+ − 4327 }
38
+ − 4328
+ − 4329 offsetPicture = LeftBorderHeading * t7screenCompass.ImageHeight * 2;
+ − 4330
110
+ − 4331 /* the background is used to draw the rotating compass rose */
38
+ − 4332 background.pointer = t7screenCompass.FBStartAdress+offsetPicture;
+ − 4333 background.x0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
110
+ − 4334 if(!pSettings->FlipDisplay)
+ − 4335 {
+ − 4336 background.y0 = 65;
+ − 4337 }
+ − 4338 else
+ − 4339 {
+ − 4340 background.y0 = 480 - t7screenCompass.ImageHeight - 65;
+ − 4341 }
+ − 4342
38
+ − 4343 background.width = CUSTOMBOX_SPACE_INSIDE;
+ − 4344 background.height = t7screenCompass.ImageHeight;
+ − 4345
+ − 4346
+ − 4347 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + (CUSTOMBOX_SPACE_INSIDE/2);
+ − 4348 stop.x = start.x;
+ − 4349 start.y = 65;
+ − 4350 stop.y = start.y + 55;
+ − 4351 GFX_draw_line(&t7screen, start, stop, CLUT_Font030);
+ − 4352
+ − 4353
+ − 4354 center.x = start.x;
+ − 4355 center.y = 300;
+ − 4356
+ − 4357 stop.x = center.x + 44;
+ − 4358 stop.y = center.y + 24;
+ − 4359
+ − 4360
+ − 4361 while(ActualHeading > 359) ActualHeading -= 360;
+ − 4362
+ − 4363 LineHeading = 360 - ActualHeading;
+ − 4364 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(0,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font030); // North
+ − 4365 LineHeading += 90;
+ − 4366 if(LineHeading > 359) LineHeading -= 360;
+ − 4367 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); // Maintick
+ − 4368 LineHeading += 90;
+ − 4369 if(LineHeading > 359) LineHeading -= 360;
+ − 4370 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031);
+ − 4371 LineHeading += 90;
+ − 4372 if(LineHeading > 359) LineHeading -= 360;
+ − 4373 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031);
+ − 4374
+ − 4375 LineHeading = 360 - ActualHeading;
+ − 4376 LineHeading += 45;
+ − 4377 if(LineHeading > 359) LineHeading -= 360;
+ − 4378 GFX_draw_thick_line(5,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); // Subtick
+ − 4379 LineHeading += 90;
+ − 4380 if(LineHeading > 359) LineHeading -= 360;
+ − 4381 GFX_draw_thick_line(5,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031);
+ − 4382 LineHeading += 90;
+ − 4383 if(LineHeading > 359) LineHeading -= 360;
+ − 4384 GFX_draw_thick_line(5,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031);
+ − 4385 LineHeading += 90;
+ − 4386 if(LineHeading > 359) LineHeading -= 360;
+ − 4387 GFX_draw_thick_line(5,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031);
+ − 4388
+ − 4389 LineHeading = 360 - ActualHeading;
+ − 4390 LineHeading += 22;
+ − 4391 if(LineHeading > 359) LineHeading -= 360;
+ − 4392 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); // Subtick
+ − 4393 LineHeading += 45;
+ − 4394 if(LineHeading > 359) LineHeading -= 360;
+ − 4395 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031);
+ − 4396 LineHeading += 45;
+ − 4397 if(LineHeading > 359) LineHeading -= 360;
+ − 4398 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031);
+ − 4399 LineHeading += 45;
+ − 4400 if(LineHeading > 359) LineHeading -= 360;
+ − 4401 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031);
+ − 4402 LineHeading += 45;
+ − 4403 if(LineHeading > 359) LineHeading -= 360;
+ − 4404 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031); // Subtick
+ − 4405 LineHeading += 45;
+ − 4406 if(LineHeading > 359) LineHeading -= 360;
+ − 4407 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031);
+ − 4408 LineHeading += 45;
+ − 4409 if(LineHeading > 359) LineHeading -= 360;
+ − 4410 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031);
+ − 4411 LineHeading += 45;
+ − 4412 if(LineHeading > 359) LineHeading -= 360;
+ − 4413 GFX_draw_thick_line(3,&t7screen, t7_compass_circle(1,LineHeading), t7_compass_circle(2,LineHeading), CLUT_Font031);
+ − 4414
+ − 4415 if(UserSetHeading)
+ − 4416 {
+ − 4417 LineHeading = UserSetHeading + 360 - ActualHeading;
+ − 4418 if(LineHeading > 359) LineHeading -= 360;
+ − 4419 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(3,LineHeading), t7_compass_circle(2,LineHeading), CLUT_CompassUserHeadingTick);
+ − 4420
+ − 4421 // R�ckpeilung, User Back Heading
+ − 4422 LineHeading = UserSetHeading + 360 + 180 - ActualHeading;
+ − 4423 if(LineHeading > 359) LineHeading -= 360;
+ − 4424 if(LineHeading > 359) LineHeading -= 360;
+ − 4425 GFX_draw_thick_line(9,&t7screen, t7_compass_circle(3,LineHeading), t7_compass_circle(2,LineHeading), CLUT_CompassUserBackHeadingTick);
+ − 4426 }
+ − 4427
+ − 4428 center.x = start.x;
+ − 4429 center.y = 250;
+ − 4430 GFX_draw_circle(&t7screen, center, 116, CLUT_Font030);
+ − 4431 GFX_draw_circle(&t7screen, center, 118, CLUT_Font030);
+ − 4432 GFX_draw_circle(&t7screen, center, 117, CLUT_Font030);
+ − 4433
+ − 4434
+ − 4435 }
+ − 4436
+ − 4437
+ − 4438 /* Font_T42: N is 27 px, S is 20 px, W is 36 px, E is 23 px
+ − 4439 * max is NW with 63 px
+ − 4440 * Font_T24: N is 15 px, S is 12 px, W is 20 px, E is 13 px
+ − 4441 * max is NW with 35 px
+ − 4442 * NE is 28 px
+ − 4443 * SW is 32 px
+ − 4444 * SE is 25 px
+ − 4445 * space between each is 45 px * 2
+ − 4446 * FirstItem List
+ − 4447 * \177 \177 prepare for size
+ − 4448 */
+ − 4449 void init_t7_compass(void)
+ − 4450 {
+ − 4451 t7screenCompass.FBStartAdress = getFrame(21);
+ − 4452
+ − 4453 char text[256];
+ − 4454 uint8_t textpointer = 0;
+ − 4455
+ − 4456 text[textpointer++] = '\030';
+ − 4457 text[textpointer++] = '\177';
+ − 4458 text[textpointer++] = '\177';
+ − 4459 text[textpointer++] = 76; // 90 - 14
+ − 4460 text[textpointer++] = '\016';
+ − 4461 text[textpointer++] = '\016';
+ − 4462 text[textpointer++] = 'N';
+ − 4463 text[textpointer++] = 'E'; // 96 + 28 = 124 total
+ − 4464 text[textpointer++] = '\017';
+ − 4465 text[textpointer++] = '\177';
+ − 4466 text[textpointer++] = '\177';
+ − 4467 text[textpointer++] = 64; // 90 - 14 - 12
+ − 4468 text[textpointer++] = 'E'; // 124 + 74 + 23 = 221 total
+ − 4469 text[textpointer++] = '\177';
+ − 4470 text[textpointer++] = '\177';
+ − 4471 text[textpointer++] = 66; // 90 - 11 - 13
+ − 4472 text[textpointer++] = '\016';
+ − 4473 text[textpointer++] = '\016';
+ − 4474 text[textpointer++] = 'S';
+ − 4475 text[textpointer++] = 'E';
+ − 4476 text[textpointer++] = '\017';
+ − 4477 text[textpointer++] = '\177';
+ − 4478 text[textpointer++] = '\177';
+ − 4479 text[textpointer++] = 68; // 90 - 12 - 10
+ − 4480 text[textpointer++] = 'S';
+ − 4481 text[textpointer++] = '\177';
+ − 4482 text[textpointer++] = '\177';
+ − 4483 text[textpointer++] = 64; // 90 - 10 - 16
+ − 4484 text[textpointer++] = '\016';
+ − 4485 text[textpointer++] = '\016';
+ − 4486 text[textpointer++] = 'S';
+ − 4487 text[textpointer++] = 'W';
+ − 4488 text[textpointer++] = '\017';
+ − 4489 text[textpointer++] = '\177';
+ − 4490 text[textpointer++] = '\177';
+ − 4491 text[textpointer++] = 56; // 90 - 16 - 18
+ − 4492 text[textpointer++] = 'W';
+ − 4493 text[textpointer++] = '\177';
+ − 4494 text[textpointer++] = '\177';
+ − 4495 text[textpointer++] = 54; // 90 - 18 - 18
+ − 4496 text[textpointer++] = '\016';
+ − 4497 text[textpointer++] = '\016';
+ − 4498 text[textpointer++] = 'N';
+ − 4499 text[textpointer++] = 'W';
+ − 4500 text[textpointer++] = '\017';
+ − 4501 text[textpointer++] = '\177';
+ − 4502 text[textpointer++] = '\177';
+ − 4503 text[textpointer++] = 59; // 90 - 17 - 14
+ − 4504 text[textpointer++] = 'N';
+ − 4505 text[textpointer++] = '\177';
+ − 4506 text[textpointer++] = '\177';
+ − 4507 text[textpointer++] = 63; // 90 - 13 - 14
+ − 4508 text[textpointer++] = '\016';
+ − 4509 text[textpointer++] = '\016';
+ − 4510 text[textpointer++] = 'N';
+ − 4511 text[textpointer++] = 'E';
+ − 4512 text[textpointer++] = '\017';
+ − 4513 text[textpointer++] = '\177';
+ − 4514 text[textpointer++] = '\177';
+ − 4515 text[textpointer++] = 64; // 90 - 14 - 12
+ − 4516 text[textpointer++] = 'E';
+ − 4517 text[textpointer++] = '\177';
+ − 4518 text[textpointer++] = '\177';
+ − 4519 text[textpointer++] = 66; // 90 - 11 - 13
+ − 4520 text[textpointer++] = '\016';
+ − 4521 text[textpointer++] = '\016';
+ − 4522 text[textpointer++] = 'S';
+ − 4523 text[textpointer++] = 'E';
+ − 4524 text[textpointer++] = '\017';
+ − 4525 text[textpointer++] = '\177';
+ − 4526 text[textpointer++] = '\177';
+ − 4527 text[textpointer++] = 68; // 90 - 12 - 10
+ − 4528 text[textpointer++] = 'S';
+ − 4529 text[textpointer++] = '\177';
+ − 4530 text[textpointer++] = '\177';
+ − 4531 text[textpointer++] = 64; // 90 - 10 - 16
+ − 4532 text[textpointer++] = '\016';
+ − 4533 text[textpointer++] = '\016';
+ − 4534 text[textpointer++] = 'S';
+ − 4535 text[textpointer++] = 'W';
+ − 4536 text[textpointer++] = '\017';
+ − 4537 text[textpointer++] = 0; // end
+ − 4538
+ − 4539 GFX_write_string(&FontT42,&t7pCompass,text,1);
+ − 4540
+ − 4541 releaseAllFramesExcept(21,t7screenCompass.FBStartAdress);
+ − 4542 }
+ − 4543
+ − 4544
+ − 4545 void t7_miniLiveLogProfile(void)
+ − 4546 {
+ − 4547 SWindowGimpStyle wintemp;
110
+ − 4548 SSettings* pSettings;
+ − 4549 pSettings = settingsGetPointer();
+ − 4550
38
+ − 4551 wintemp.left = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
+ − 4552 wintemp.right = wintemp.left + CUSTOMBOX_SPACE_INSIDE;
110
+ − 4553 if(!pSettings->FlipDisplay)
+ − 4554 {
+ − 4555 wintemp.top = 480 - t7l1.WindowY0;
+ − 4556 wintemp.bottom = wintemp. top + 200;
+ − 4557 }
+ − 4558 else
+ − 4559 {
+ − 4560 wintemp.top = t7l1.WindowY1;
+ − 4561 wintemp.bottom = wintemp. top + 200;
+ − 4562 }
38
+ − 4563
+ − 4564 uint16_t max_depth = (uint16_t)(stateUsed->lifeData.max_depth_meter * 10);
+ − 4565
+ − 4566 GFX_graph_print(&t7screen, &wintemp, 0,1,0, max_depth, getMiniLiveLogbookPointerToData(), getMiniLiveLogbookActualDataLength(), CLUT_Font030, NULL);
+ − 4567 }
+ − 4568
+ − 4569 void t7_logo_OSTC(void)
+ − 4570 {
+ − 4571 SWindowGimpStyle windowGimp;
110
+ − 4572 SSettings* pSettings;
+ − 4573 pSettings = settingsGetPointer();
+ − 4574
38
+ − 4575 /* OSTC logo */
110
+ − 4576 if(!pSettings->FlipDisplay)
+ − 4577 {
+ − 4578 windowGimp.left = t7l1.WindowX1 + 32;
+ − 4579 }
+ − 4580 else
+ − 4581 {
+ − 4582 windowGimp.left = t7r1.WindowX1 + 32;
+ − 4583 }
+ − 4584
38
+ − 4585 windowGimp.top = 40 + 32;
+ − 4586 GFX_draw_image_monochrome(&t7screen, windowGimp, &ImgOSTC, 0);
+ − 4587 }
672
+ − 4588
+ − 4589 static uint16_t ChargerLog[60] = {10,10,10,10,10,10,10,10,10,10,
+ − 4590 10,10,10,10,10,10,10,10,10,10,
+ − 4591 10,10,10,10,10,10,10,10,10,10,
+ − 4592 10,10,10,10,10,10,10,10,10,10,
+ − 4593 10,10,10,10,10,10,10,10,10,10,
+ − 4594 10,10,10,10,10,10,10,10,10,10};
+ − 4595
+ − 4596 uint16_t LogDeltaCharge(float charge)
+ − 4597 {
+ − 4598 static uint8_t curIndex = 0;
+ − 4599 static float averageSpeed = 0.0;
+ − 4600 uint16_t level = 0;
+ − 4601 uint16_t completeSec = 0;
+ − 4602
+ − 4603 if(charge > 0.003)
+ − 4604 {
+ − 4605 level = 2;
+ − 4606 }
+ − 4607 else if(charge > 0.0025)
+ − 4608 {
+ − 4609 level = 3;
+ − 4610 }
+ − 4611 else if(charge > 0.002)
+ − 4612 {
+ − 4613 level = 4;
+ − 4614 }
+ − 4615 else if(charge > 0.0015)
+ − 4616 {
+ − 4617 level = 5;
+ − 4618 }
+ − 4619 else if(charge > 0.001)
+ − 4620 {
+ − 4621 level = 6;
+ − 4622 }
+ − 4623 else if(charge > 0.0005)
+ − 4624 {
+ − 4625 level = 7;
+ − 4626 }
+ − 4627 else if(charge > 0.00)
+ − 4628 {
+ − 4629 level = 8;
+ − 4630 }
+ − 4631 else
+ − 4632 {
+ − 4633 level = 10;
+ − 4634 }
859
+ − 4635 if(curIndex > 1)
+ − 4636 {
+ − 4637 level = (level + ChargerLog[curIndex - 1]) / 2; /* smooth small jumps */
+ − 4638 }
672
+ − 4639 if(curIndex < 59)
+ − 4640 {
+ − 4641 ChargerLog[curIndex++] = level;
+ − 4642 }
+ − 4643 else
+ − 4644 {
+ − 4645 memcpy (&ChargerLog[0],&ChargerLog[1],sizeof(ChargerLog) - 1);
+ − 4646 ChargerLog[curIndex] = level;
+ − 4647 }
859
+ − 4648 if(curIndex > 1) /* estimate time til charging is complete */
672
+ − 4649 {
+ − 4650 averageSpeed = ((averageSpeed * (curIndex-1)) + charge) / curIndex;
+ − 4651 completeSec = (100.0 - stateUsed->lifeData.battery_charge) / averageSpeed;
+ − 4652 }
+ − 4653 else
+ − 4654 {
+ − 4655 completeSec = 0xffff;
+ − 4656 }
+ − 4657 return completeSec;
+ − 4658 }
+ − 4659
+ − 4660 uint16_t* getChargeLog()
+ − 4661 {
+ − 4662 return ChargerLog;
+ − 4663 }
+ − 4664
+ − 4665 void t7_ChargerView(void)
+ − 4666 {
+ − 4667 static float lastCharge = 0.0;
+ − 4668 float localCharge = 0.0;
+ − 4669 static uint32_t lastTick = 0;
+ − 4670 uint32_t curTick = 0;
+ − 4671 static float speed = 0.0;
+ − 4672 float deltatime = 0.0;
+ − 4673
+ − 4674 char text[256+50];
+ − 4675 uint8_t textpointer = 0;
+ − 4676 static uint16_t remainingSec = 0;
+ − 4677 uint16_t hoursto100 = 0;
+ − 4678 char indicator = '~';
+ − 4679
+ − 4680 point_t start, stop;
+ − 4681
675
+ − 4682 SWindowGimpStyle wintemp;
+ − 4683 SSettings* pSettings;
+ − 4684 pSettings = settingsGetPointer();
+ − 4685
672
+ − 4686 t7cY0free.WindowLineSpacing = 28 + 48 + 14;
+ − 4687 t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing;
+ − 4688 t7cY0free.WindowNumberOfTextLines = 3;
+ − 4689
675
+ − 4690
+ − 4691 if(pSettings->FlipDisplay)
+ − 4692 {
+ − 4693 t7cY0free.WindowY0 = t7cH.WindowY0 + 15;
+ − 4694 t7cY0free.WindowY1 = t7cY0free.WindowY0 + 250;
+ − 4695 }
+ − 4696
672
+ − 4697 localCharge = stateUsed->lifeData.battery_charge;
+ − 4698 if(localCharge < 0.0)
+ − 4699 {
+ − 4700 localCharge *= -1.0;
+ − 4701 }
+ − 4702
+ − 4703 if(stateUsed->chargeStatus != CHARGER_off)
+ − 4704 {
859
+ − 4705 curTick = HAL_GetTick();
+ − 4706 deltatime = (curTick - lastTick);
+ − 4707
+ − 4708 if((deltatime > 3000) || (lastCharge != localCharge)) /* Charge value update is expected every 2 second. */
+ − 4709 { /* Added timeout to keep graph moving in case charger is temporary idle */
+ − 4710 if(lastCharge != localCharge)
672
+ − 4711 {
859
+ − 4712 if(lastCharge < localCharge)
+ − 4713 {
+ − 4714 speed = (localCharge - lastCharge) * 1000.0 / deltatime;
+ − 4715 }
+ − 4716
+ − 4717 if(localCharge > 100.0)
+ − 4718 {
+ − 4719 localCharge = 100.0;
+ − 4720 }
+ − 4721 lastCharge = localCharge;
672
+ − 4722 }
+ − 4723 deltatime = 0;
+ − 4724 remainingSec = LogDeltaCharge(speed);
+ − 4725 speed = 0;
859
+ − 4726 lastTick = curTick;
672
+ − 4727 }
+ − 4728 }
+ − 4729 textpointer += snprintf(&text[textpointer],50,"\n\r");
+ − 4730 textpointer += snprintf(&text[textpointer],50,"\001%c\n\r",TXT_ChargeHour);
+ − 4731
+ − 4732 GFX_write_string(&FontT24, &t7cY0free, text, 1);
+ − 4733
+ − 4734 hoursto100 = remainingSec / 3600; /* reduce to hours */
+ − 4735 if(hoursto100 < 1)
+ − 4736 {
+ − 4737 indicator = '<';
+ − 4738 hoursto100 = 1;
+ − 4739 }
675
+ − 4740
+ − 4741 if(!pSettings->FlipDisplay)
+ − 4742 {
+ − 4743 t7cY0free.WindowY0 -= 52;
+ − 4744 }
+ − 4745 else
+ − 4746 {
962
+ − 4747 t7cY0free.WindowY1 += 52;
675
+ − 4748 }
672
+ − 4749
+ − 4750 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->chargeStatus != CHARGER_off))
+ − 4751 {
+ − 4752 snprintf(text,60,
693
+ − 4753 "\001%0.2f\016\016%%\017\n\r"
672
+ − 4754 "\001%c%d\n\r"
+ − 4755 ,stateUsed->lifeData.battery_charge
+ − 4756 ,indicator
+ − 4757 ,hoursto100);
+ − 4758 }
+ − 4759 else
+ − 4760 {
+ − 4761 snprintf(text,60,
+ − 4762 "\001---\n\r"
+ − 4763 "\001---\n\r");
+ − 4764 }
+ − 4765 GFX_write_string(&FontT42, &t7cY0free, text, 1);
+ − 4766
+ − 4767 wintemp.left = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + 50;
+ − 4768 wintemp.right = wintemp.left + CUSTOMBOX_SPACE_INSIDE - 100;
+ − 4769
+ − 4770
+ − 4771 if(!pSettings->FlipDisplay)
+ − 4772 {
+ − 4773 wintemp.top = 480 - t7l1.WindowY0 + 115;
+ − 4774 wintemp.bottom = wintemp.top + 100;
+ − 4775 }
+ − 4776 else
+ − 4777 {
675
+ − 4778 wintemp.top = t7l1.WindowY1 + 102;
+ − 4779 wintemp.bottom = wintemp.top + 100;
672
+ − 4780 }
+ − 4781
+ − 4782 start.x = wintemp.left-5;
+ − 4783 start.y = 90;
+ − 4784
+ − 4785 stop.x = wintemp.right + 5 - start.x;
+ − 4786 stop.y = 100;
+ − 4787 GFX_draw_box(&t7screen, start, stop,1, CLUT_Font020);
+ − 4788
+ − 4789 if(stateUsed->chargeStatus != CHARGER_off)
+ − 4790 {
+ − 4791 GFX_graph_print(&t7screen, &wintemp, 1,1,0, 10, getChargeLog(), 60, CLUT_Font030, NULL);
+ − 4792 }
+ − 4793 else
+ − 4794 {
+ − 4795 GFX_graph_print(&t7screen, &wintemp, 1,1,0, 10, getChargeLog(), 60, CLUT_Font031, NULL);
+ − 4796 }
+ − 4797
+ − 4798 }
777
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
diff
changeset
+ − 4799
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 4800
777
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
diff
changeset
+ − 4801 bool t7_isCompassShowing(void)
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
diff
changeset
+ − 4802 {
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
diff
changeset
+ − 4803 return selection_customview == CVIEW_Compass || selection_custom_field == LLC_Compass;
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
diff
changeset
+ − 4804 }
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 4805
882
+ − 4806 void t7_drawAcentGraph(uint8_t color)
+ − 4807 {
+ − 4808 point_t start, stop;
+ − 4809
+ − 4810 SSettings* pSettings;
+ − 4811 pSettings = settingsGetPointer();
+ − 4812
+ − 4813
+ − 4814 if(!pSettings->FlipDisplay)
+ − 4815 {
+ − 4816 start.y = t7l1.WindowY0 - 1;
+ − 4817 }
+ − 4818 else
+ − 4819 {
+ − 4820 start.y = t7l3.WindowY0 - 25;
+ − 4821 }
+ − 4822
+ − 4823 for(int i = 0; i<4;i++)
+ − 4824 {
+ − 4825 start.y += 5*6;
+ − 4826 stop.y = start.y;
+ − 4827 start.x = CUSTOMBOX_LINE_LEFT - 1;
+ − 4828 stop.x = start.x - 17;
+ − 4829 GFX_draw_line(&t7screen, start, stop, 0);
+ − 4830 // start.x = CUSTOMBOX_LINE_RIGHT + 2; old right too
+ − 4831 // stop.x = start.x + 17;
+ − 4832 // GFX_draw_line(&t7screen, start, stop, 0);
+ − 4833 }
+ − 4834 // new thick bar design Sept. 2015
+ − 4835 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 3 - 5;
+ − 4836 stop.x = start.x;
+ − 4837 if(!pSettings->FlipDisplay)
+ − 4838 {
+ − 4839 start.y = t7l1.WindowY0 - 1;
+ − 4840 }
+ − 4841 else
+ − 4842 {
+ − 4843 start.y = t7l3.WindowY0 - 25;
+ − 4844 }
+ − 4845 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 6);
+ − 4846 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9
+ − 4847 if(stop.y >= 470)
+ − 4848 stop.y = 470;
+ − 4849 start.y += 7; // starte etwas weiter oben
+ − 4850 if(color == 0)
+ − 4851 {
+ − 4852 color = CLUT_EverythingOkayGreen; /* do not use white color for drawing graph */
+ − 4853 }
+ − 4854
+ − 4855 GFX_draw_thick_line(12,&t7screen, start, stop, color);
+ − 4856 }
+ − 4857
915
+ − 4858 #define ASCENT_GRAPH_YPIXEL 110
+ − 4859
882
+ − 4860
907
+ − 4861 uint8_t t7_drawSlowExitGraph() /* this function is only called if diver is below last last stop depth */
882
+ − 4862 {
+ − 4863 static uint16_t countDownSec = 0;
945
+ − 4864 uint8_t drawingMeterStep;
882
+ − 4865 static float exitDepthMeter = 0.0;
+ − 4866
+ − 4867 uint8_t index = 0;
945
+ − 4868 uint8_t color = 0;
882
+ − 4869 point_t start, stop;
+ − 4870
+ − 4871 SSettings* pSettings;
+ − 4872 pSettings = settingsGetPointer();
+ − 4873
945
+ − 4874
+ − 4875 if(calculateSlowExit(&countDownSec, &exitDepthMeter, &color)) /* graph to be drawn? */
882
+ − 4876 {
945
+ − 4877 if(!pSettings->FlipDisplay)
882
+ − 4878 {
945
+ − 4879 start.y = t7l1.WindowY0 - 1;
882
+ − 4880 }
945
+ − 4881 else
+ − 4882 {
+ − 4883 start.y = t7l3.WindowY0 - 25;
+ − 4884 }
+ − 4885 drawingMeterStep = ASCENT_GRAPH_YPIXEL / pSettings->last_stop_depth_meter; /* based on 120 / 4 = 30 of standard ascent graph */
+ − 4886 for(index = 0; index < pSettings->last_stop_depth_meter; index++) /* draw meter indicators */
882
+ − 4887 {
945
+ − 4888 start.y += drawingMeterStep;
+ − 4889 stop.y = start.y;
+ − 4890 start.x = CUSTOMBOX_LINE_LEFT - 1;
+ − 4891 stop.x = start.x - 38;
+ − 4892 GFX_draw_line(&t7screen, start, stop, 0);
+ − 4893 }
+ − 4894
+ − 4895 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 20;
+ − 4896 stop.x = start.x;
+ − 4897 if(!pSettings->FlipDisplay)
+ − 4898 {
+ − 4899 start.y = t7l1.WindowY0 + ASCENT_GRAPH_YPIXEL + 5;
882
+ − 4900 }
945
+ − 4901 else
+ − 4902 {
+ − 4903 start.y = t7l3.WindowY0 - 25 + ASCENT_GRAPH_YPIXEL + 5;
+ − 4904 }
+ − 4905 stop.y = start.y - countDownSec * (ASCENT_GRAPH_YPIXEL / (float)(pSettings->slowExitTime * 60.0));
+ − 4906 if(stop.y >= 470) stop.y = 470;
+ − 4907 if(!pSettings->FlipDisplay)
+ − 4908 {
+ − 4909 stop.y += 5;
+ − 4910 }
+ − 4911 GFX_draw_thick_line(15,&t7screen, start, stop, 3);
+ − 4912 /* mark diver depth */
+ − 4913 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 30;
+ − 4914 stop.x = start.x + 24;
+ − 4915
+ − 4916 start.y = start.y - (stateUsed->lifeData.depth_meter * (ASCENT_GRAPH_YPIXEL) / pSettings->last_stop_depth_meter);
+ − 4917 stop.y = start.y;
+ − 4918 GFX_draw_thick_line(10,&t7screen, start, stop, 9);
882
+ − 4919 }
954
+ − 4920 else
+ − 4921 {
+ − 4922 color = 0xff;
+ − 4923 }
882
+ − 4924 return color;
+ − 4925 }
979
+ − 4926
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 4927 void t7_tick(void)
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 4928 {
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 4929 SSettings *settings = settingsGetPointer();
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 4930
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 4931 int nowS = current_second();
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 4932 updateTimer(settings, nowS, false);
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 4933 }