annotate Discovery/Src/t5_gauge.c @ 837:18946846b95b Evo_2_23

Bugfixes and code cleanup for BF views: BF views gauge and apnoe were using "dive computer" T3 view functions which caused some problem because these legacy views were not intended to work with customer view selection. A switch condition has been added to skip these kind of functions in case a design other T3 is in use. Another potential problem was that there were two definitions for T3 and T7 views which were basically the same. If they wold not be the same the switching functionality wold not work properly. To avoid this problem in futur the arrays have been merged => the view are handled sing the (newer) cv_view arrays instead of the standard_views which were in used before the user could the views which should be shown.
author ideenmodellierer
date Wed, 27 Dec 2023 19:37:17 +0100
parents 0a09afac969f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 /// -*- coding: UTF-8 -*-
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 /// \file Discovery/Src/t5_gauge.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief dive screen for Gauge mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 1-Feb-2017
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /// \details
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /// $Id$
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /// This program is free software: you can redistribute it and/or modify
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /// it under the terms of the GNU General Public License as published by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 /// the Free Software Foundation, either version 3 of the License, or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /// (at your option) any later version.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /// This program is distributed in the hope that it will be useful,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /// GNU General Public License for more details.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 /// You should have received a copy of the GNU General Public License
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 #include "t5_gauge.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "data_exchange_main.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 #include "decom.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 #include "gfx_fonts.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 #include "math.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 #include "tHome.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 #include "simulation.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 #include "timer.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 #include "unit.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 GFX_DrawCfgScreen t5screen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 GFX_DrawCfgWindow t5l1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 GFX_DrawCfgWindow t5r1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 GFX_DrawCfgWindow t5c1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 GFX_DrawCfgWindow t5c2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 GFX_DrawCfgWindow t5c3; // for menu text
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 uint8_t t5_selection_customview = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 /* Importend function prototypes ---------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 //extern uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 /* Private types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 #define CUSTOMBOX_LINE_LEFT (250)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 #define CUSTOMBOX_LINE_RIGHT (549)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 #define CUSTOMBOX_INSIDE_OFFSET (2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 #define CUSTOMBOX_OUTSIDE_OFFSET (2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 #define TEXTSIZE 16
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 const uint8_t t5_customviewsStandard[] =
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 {
837
18946846b95b Bugfixes and code cleanup for BF views:
ideenmodellierer
parents: 518
diff changeset
66 CVIEW_T3_sensors,
18946846b95b Bugfixes and code cleanup for BF views:
ideenmodellierer
parents: 518
diff changeset
67 CVIEW_T3_Compass,
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 CVIEW_T3_MaxDepth,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 CVIEW_T3_StopWatch,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 CVIEW_T3_Temperature,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 CVIEW_T3_GasList,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 CVIEW_T3_Decostop,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 CVIEW_T3_END
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 const uint8_t *t5_customviews = t5_customviewsStandard;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 void t5_refresh_divemode(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 void t5_refresh_customview(float depth);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 uint8_t t5_test_customview_warnings(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 //void t5_show_customview_warnings(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 //void t5_compass(uint16_t ActualHeading, uint16_t UserSetHeading);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 // for tHomeDiveMenuControl() in tHome.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 uint8_t t5_getCustomView(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 return t5_selection_customview;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 void t5_init(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 {
413
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
98 SSettings* pSettings;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
99 pSettings = settingsGetPointer();
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
100
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 t5_selection_customview = t5_customviewsStandard[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 t5screen.FBStartAdress = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 t5screen.ImageHeight = 480;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 t5screen.ImageWidth = 800;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 t5screen.LayerIndex = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 t5l1.Image = &t5screen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 t5l1.WindowNumberOfTextLines = 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 t5l1.WindowLineSpacing = 19; // Abstand von Y0
413
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
111 t5l1.WindowTab = 100;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
112 if(!pSettings->FlipDisplay)
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
113 {
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
114 t5l1.WindowX0 = 0;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
115 t5l1.WindowX1 = BigFontSeperationLeftRight - 5;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
116 t5l1.WindowY0 = BigFontSeperationTopBottom + 5;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
117 t5l1.WindowY1 = 479;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
118 }
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
119 else
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
120 {
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
121 t5l1.WindowX0 = 800 - BigFontSeperationLeftRight + 5;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
122 t5l1.WindowX1 = 799;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
123 t5l1.WindowY0 = 0;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
124 t5l1.WindowY1 = 479 - BigFontSeperationTopBottom + 5 ;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
125 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 t5r1.Image = &t5screen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 t5r1.WindowNumberOfTextLines = t5l1.WindowNumberOfTextLines;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 t5r1.WindowLineSpacing = t5l1.WindowLineSpacing;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 t5r1.WindowTab = t5l1.WindowTab;
413
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
131 if(!pSettings->FlipDisplay)
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
132 {
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
133 t5r1.WindowX0 = BigFontSeperationLeftRight + 5;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
134 t5r1.WindowX1 = 799;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
135 }
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
136 else
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
137 {
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
138 t5r1.WindowX0 = 0;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
139 t5r1.WindowX1 = BigFontSeperationLeftRight - 5;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
140 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 t5r1.WindowY0 = t5l1.WindowY0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 t5r1.WindowY1 = t5l1.WindowY1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 t5c1.Image = &t5screen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 t5c1.WindowNumberOfTextLines = 2;
518
0a09afac969f Added T3_gaslist:
Ideenmodellierer
parents: 413
diff changeset
146 t5c1.WindowLineSpacing = 84 + 5;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 t5c1.WindowX0 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 t5c1.WindowX1 = 799;
413
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
149 if(!pSettings->FlipDisplay)
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
150 {
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
151 t5c1.WindowY0 = 0;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
152 t5c1.WindowY1 = BigFontSeperationTopBottom - 5;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
153 }
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
154 else
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
155 {
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
156 t5c1.WindowY0 = 480 - BigFontSeperationTopBottom + 5;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
157 t5c1.WindowY1 = 479;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
158 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 t5c2.Image = &t5screen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 t5c2.WindowNumberOfTextLines = 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 t5c2.WindowLineSpacing = 58;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 t5c2.WindowX0 = 370;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 t5c2.WindowX1 = 799;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 t5c2.WindowY0 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 t5c2.WindowY1 = BigFontSeperationTopBottom - 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 t5c2.WindowTab = 600;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 t5c3.Image = &t5screen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 t5c3.WindowNumberOfTextLines = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 t5c3.WindowLineSpacing = 0; // Abstand von Y0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 t5c3.WindowTab = 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 t5c3.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 t5c3.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET;
413
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
175 if(!pSettings->FlipDisplay)
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
176 {
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
177 t5c3.WindowY0 = 0;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
178 t5c3.WindowY1 = 69;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
179 }
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
180 else
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
181 {
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
182 t5c3.WindowY0 = 480 - 69;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
183 t5c3.WindowY1 = 479;
65c7b009136f Bugfix Flipdisplay Gauge and Apnoe mode:
ideenmodellierer
parents: 386
diff changeset
184 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 void t5_refresh(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 static uint8_t last_mode = MODE_SURFACE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 SStateList status;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 get_globalStateList(&status);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 if(stateUsed->mode != MODE_DIVE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 last_mode = MODE_SURFACE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 settingsGetPointer()->design = 7;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 if(t5screen.FBStartAdress)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 releaseFrame(24,t5screen.FBStartAdress);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 t5screen.FBStartAdress = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 if(status.base != BaseHome)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 t5screen.FBStartAdress = getFrame(24);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 if(last_mode != MODE_DIVE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 last_mode = MODE_DIVE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 t5_selection_customview = *t5_customviews;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 if(status.page == PageSurface)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 set_globalState(StD);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 t5_refresh_divemode();
166
255eedad4155 cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents: 138
diff changeset
222 GFX_SetFramesTopBottom(t5screen.FBStartAdress, 0,480);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 releaseAllFramesExcept(24,t5screen.FBStartAdress);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 void t5_refresh_divemode(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 char text[512];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 uint8_t customview_warnings = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 float depth_meter = 0.0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 // everything like lines, depth, ascent graph and divetime
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 depth_meter = t3_basics_lines_depth_and_divetime(&t5screen, &t5l1, &t5r1, DIVEMODE_Gauge);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 // customview
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 if(stateUsed->warnings.numWarnings)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 customview_warnings = t5_test_customview_warnings();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 if(customview_warnings && warning_count_high_time)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 t3_basics_show_customview_warnings(&t5c1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 t5_refresh_customview(depth_meter);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 if(stateUsed->warnings.lowBattery)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 t3_basics_battery_low_customview_extra(&t5c1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 /* Menu Selection (and gas mix) */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 if(get_globalState() == StDBEAR)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 snprintf(text,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveBearingQ);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 GFX_write_string_color(&FontT48,&t5c3,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 if(get_globalState() == StDRAVG)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 snprintf(text,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveResetAvgQ);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 GFX_write_string_color(&FontT48,&t5c3,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 // else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 // if(get_globalState() == StDMENU)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 // {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 // snprintf(text,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveMenuQ);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 // GFX_write_string_color(&FontT48,&t5c3,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 // }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 if(get_globalState() == StDSIM1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 snprintf(text,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveQuitQ);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 GFX_write_string_color(&FontT48,&t5c3,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 if(get_globalState() == StDSIM2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 if(settingsGetPointer()->nonMetricalSystem)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 snprintf(text,TEXTSIZE,"\a\001" " Sim:-3.33ft ");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 snprintf(text,TEXTSIZE,"\a\001" " Sim:-1m ");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 GFX_write_string_color(&FontT48,&t5c3,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 snprintf(text,TEXTSIZE,"\a\f %u %c%c"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 , unit_depth_integer(simulation_get_aim_depth())
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 , unit_depth_char1()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 , unit_depth_char2()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 GFX_write_string_color(&FontT42,&t5l1,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 if(get_globalState() == StDSIM3)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 if(settingsGetPointer()->nonMetricalSystem)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 snprintf(text,TEXTSIZE,"\a\001" " Sim:+3.33ft ");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297 snprintf(text,TEXTSIZE,"\a\001" " Sim:+1m ");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298 GFX_write_string_color(&FontT48,&t5c3,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 snprintf(text,TEXTSIZE,"\a\f %u %c%c"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300 , unit_depth_integer(simulation_get_aim_depth())
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 , unit_depth_char1()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 , unit_depth_char2()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304 GFX_write_string_color(&FontT42,&t5l1,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 if(get_globalState() == StDSIM4)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309 snprintf(text,TEXTSIZE,"\a\001" " Sim:+5' ");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 GFX_write_string_color(&FontT48,&t5c3,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 snprintf(text,TEXTSIZE,"\a\f %u %c%c"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 , unit_depth_integer(simulation_get_aim_depth())
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 , unit_depth_char1()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 , unit_depth_char2()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 GFX_write_string_color(&FontT42,&t5l1,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 // keep empty
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324
386
39c147e47c1c Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents: 175
diff changeset
325 void t5_change_customview(uint8_t action)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 {
386
39c147e47c1c Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents: 175
diff changeset
327 t3_basics_change_customview(&t5_selection_customview, t5_customviews, action);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 void t5_refresh_customview(float depth)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 {
386
39c147e47c1c Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents: 175
diff changeset
333 // if((t5_selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0))
39c147e47c1c Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents: 175
diff changeset
334 // t5_change_customview();
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 t3_basics_refresh_customview(depth, t5_selection_customview, &t5screen, &t5c1, &t5c2, DIVEMODE_Gauge);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 uint8_t t5_test_customview_warnings(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 uint8_t count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 return count;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348