annotate Discovery/Src/t6_apnea.c @ 182:7e749084f347 Cleanup_Compass_Wireless

Resolve fixme comments Two fixme comments were placed in the code which have been resolved
author ideenmodellierer
date Thu, 14 Mar 2019 20:43:47 +0100
parents 9da7dd50e2ec
children 8b8074080d7b
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/t6_apnea.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 "t6_apnea.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 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 GFX_DrawCfgScreen t6screen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 GFX_DrawCfgWindow t6l1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 GFX_DrawCfgWindow t6r1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 GFX_DrawCfgWindow t6c1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 GFX_DrawCfgWindow t6c2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 GFX_DrawCfgWindow t6c3; // for menu text
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 uint8_t t6_selection_customview = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 /* Importend function prototypes ---------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 /* Private types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 #define CUSTOMBOX_LINE_LEFT (250)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 #define CUSTOMBOX_LINE_RIGHT (549)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 #define CUSTOMBOX_INSIDE_OFFSET (2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 #define CUSTOMBOX_OUTSIDE_OFFSET (2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 #define TEXTSIZE 16
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 const uint8_t t6_customviewsStandard[] =
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 CVIEW_noneOrDebug,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 CVIEW_T3_Temperature,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 CVIEW_T3_END
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 const uint8_t *t6_customviews = t6_customviewsStandard;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 const uint8_t t6_customviewSurfaceMode = CVIEW_T3_ApnoeSurfaceInfo;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 void t6_refresh_divemode(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 void t6_refresh_customview(float depth);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 uint8_t t6_test_customview_warnings(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 void t6_show_customview_warnings(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 void t6_compass(uint16_t ActualHeading, uint16_t UserSetHeading);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 // for tHomeDiveMenuControl() in tHome.c and t6_refresh_customview
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 uint8_t t6_getCustomView(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 if(stateUsed->lifeData.counterSecondsShallowDepth)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 return t6_customviewSurfaceMode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 return t6_selection_customview;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 void t6_init(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 t6_selection_customview = t6_customviewsStandard[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 t6screen.FBStartAdress = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 t6screen.ImageHeight = 480;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 t6screen.ImageWidth = 800;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 t6screen.LayerIndex = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 t6l1.Image = &t6screen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 t6l1.WindowNumberOfTextLines = 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 t6l1.WindowLineSpacing = 19; // Abstand von Y0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 t6l1.WindowTab = 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 t6l1.WindowX0 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 t6l1.WindowX1 = BigFontSeperationLeftRight - 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 t6l1.WindowY0 = BigFontSeperationTopBottom + 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 t6l1.WindowY1 = 479;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 t6r1.Image = &t6screen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 t6r1.WindowNumberOfTextLines = t6l1.WindowNumberOfTextLines;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 t6r1.WindowLineSpacing = t6l1.WindowLineSpacing;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 t6r1.WindowTab = t6l1.WindowTab;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 t6r1.WindowX0 = BigFontSeperationLeftRight + 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 t6r1.WindowX1 = 799;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 t6r1.WindowY0 = t6l1.WindowY0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 t6r1.WindowY1 = t6l1.WindowY1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 t6c1.Image = &t6screen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 t6c1.WindowNumberOfTextLines = 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 t6c1.WindowLineSpacing = t6l1.WindowLineSpacing;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 t6c1.WindowX0 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 t6c1.WindowX1 = 799;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 t6c1.WindowY0 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 t6c1.WindowY1 = BigFontSeperationTopBottom - 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 t6c2.Image = &t6screen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 t6c2.WindowNumberOfTextLines = 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 t6c2.WindowLineSpacing = 58;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 t6c2.WindowX0 = 370;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 t6c2.WindowX1 = 799;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 t6c2.WindowY0 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 t6c2.WindowY1 = BigFontSeperationTopBottom - 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 t6c2.WindowTab = 600;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 t6c3.Image = &t6screen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 t6c3.WindowNumberOfTextLines = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 t6c3.WindowLineSpacing = 0; // Abstand von Y0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 t6c3.WindowTab = 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 t6c3.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 t6c3.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 t6c3.WindowY0 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 t6c3.WindowY1 = 69;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 void t6_refresh(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 static uint8_t last_mode = MODE_SURFACE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 SStateList status;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 get_globalStateList(&status);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 if(stateUsed->mode != MODE_DIVE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 last_mode = MODE_SURFACE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 settingsGetPointer()->design = 7;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 if(t6screen.FBStartAdress)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 releaseFrame(24,t6screen.FBStartAdress);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 t6screen.FBStartAdress = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 if(status.base != BaseHome)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 t6screen.FBStartAdress = getFrame(24);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 if(last_mode != MODE_DIVE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 last_mode = MODE_DIVE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 t6_selection_customview = *t6_customviews;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 if(status.page == PageSurface)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 set_globalState(StD);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 t6_refresh_divemode();
166
255eedad4155 cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents: 138
diff changeset
180 GFX_SetFramesTopBottom(t6screen.FBStartAdress, 0,480);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 releaseAllFramesExcept(24,t6screen.FBStartAdress);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 void t6_refresh_divemode(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 char text[512];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 uint8_t customview_warnings = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 float depth_meter = 0.0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 // everything like lines, depth, ascent graph and divetime or counterSecondsShallowDepth
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 depth_meter = t3_basics_lines_depth_and_divetime(&t6screen, &t6l1, &t6r1, DIVEMODE_Apnea);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 // customview
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 if(stateUsed->warnings.numWarnings)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 customview_warnings = t6_test_customview_warnings();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 if(customview_warnings && warning_count_high_time)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 t3_basics_show_customview_warnings(&t6c1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 t6_refresh_customview(depth_meter);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 if(stateUsed->warnings.lowBattery)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 t3_basics_battery_low_customview_extra(&t6c1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 /* Menu Selection (and gas mix) */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 if(get_globalState() == StDBEAR)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 snprintf(text,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveBearingQ);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 GFX_write_string_color(&FontT48,&t6c3,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 else if(get_globalState() == StDRAVG)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 snprintf(text,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveResetAvgQ);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 GFX_write_string_color(&FontT48,&t6c3,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 else if(get_globalState() == StDQUIT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 snprintf(text,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveQuitQ);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 GFX_write_string_color(&FontT48,&t6c3,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 else if(get_globalState() == StDSIM1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 snprintf(text,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveQuitQ);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 GFX_write_string_color(&FontT48,&t6c3,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 else if(get_globalState() == StDSIM2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 if(settingsGetPointer()->nonMetricalSystem)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 snprintf(text,TEXTSIZE,"\a\001" " Sim:-3.33ft ");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 snprintf(text,TEXTSIZE,"\a\001" " Sim:-1m ");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 GFX_write_string_color(&FontT48,&t6c3,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 snprintf(text,TEXTSIZE,"\a\f %u %c%c"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 , unit_depth_integer(simulation_get_aim_depth())
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 , unit_depth_char1()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 , unit_depth_char2()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 GFX_write_string_color(&FontT42,&t6l1,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 else if(get_globalState() == StDSIM3)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 if(settingsGetPointer()->nonMetricalSystem)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 snprintf(text,TEXTSIZE,"\a\001" " Sim:+3.33ft ");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 snprintf(text,TEXTSIZE,"\a\001" " Sim:+1m ");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 GFX_write_string_color(&FontT48,&t6c3,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 snprintf(text,TEXTSIZE,"\a\f %u %c%c"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 , unit_depth_integer(simulation_get_aim_depth())
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 , unit_depth_char1()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 , unit_depth_char2()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 GFX_write_string_color(&FontT42,&t6l1,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 else if(get_globalState() == StDSIM4)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 snprintf(text,TEXTSIZE,"\a\001" " Sim:+5' ");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 GFX_write_string_color(&FontT48,&t6c3,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 snprintf(text,TEXTSIZE,"\a\f %u %c%c"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 , unit_depth_integer(simulation_get_aim_depth())
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 , unit_depth_char1()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 , unit_depth_char2()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 GFX_write_string_color(&FontT42,&t6l1,text,0,CLUT_WarningYellow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 // keep empty
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 void t6_battery_low_customview_extra(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 char TextC1[256];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 TextC1[0] = '\002';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 TextC1[1] = '\f';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 TextC1[2] = '\025';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 TextC1[3] = '3';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 TextC1[4] = '1';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 TextC1[5] = '1';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 TextC1[6] = '1';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 TextC1[7] = '1';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 TextC1[8] = '1';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 TextC1[9] = '1';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 TextC1[10] = '1';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 TextC1[11] = '1';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 TextC1[12] = '1';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 TextC1[13] = '1';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 TextC1[14] = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 TextC1[15] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298 if(!warning_count_high_time)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 TextC1[4] = '2';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 GFX_write_string(&Batt24,&t6c1,TextC1,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 void t6_change_customview(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 t3_basics_change_customview(&t6_selection_customview, t6_customviews);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 void t6_refresh_customview(float depth)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 uint8_t customViewLeftSide = CVIEW_T3_MaxDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 if((t6_selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 t6_change_customview();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 if(t6_getCustomView() == CVIEW_T3_ApnoeSurfaceInfo)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 customViewLeftSide = CVIEW_T3_ApnoeSurfaceInfo;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 t3_basics_refresh_customview(depth, customViewLeftSide, &t6screen, &t6c1, &t6c2, DIVEMODE_Apnea);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 t3_basics_refresh_apnoeRight(depth, t6_getCustomView(), &t6screen, &t6c1, &t6c2, DIVEMODE_Apnea);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 uint8_t t6_test_customview_warnings(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 uint8_t count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 return count;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 char text[512];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 uint16_t textpointer = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 // CVIEW_T3_Temperature
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 float temperatureThisCall;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 float temperature;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 // CVIEW_T3_StopWatch
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347 SDivetime Stopwatch = {0,0,0,0};
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 float fAverageDepth, fAverageDepthAbsolute;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 uint16_t tempWinX0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 uint16_t tempWinY0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 switch(t6_selection_customview)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 case CVIEW_T3_ApnoeTimes:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 case CVIEW_T3_StopWatch:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 Stopwatch.Total = timer_Stopwatch_GetTime();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 Stopwatch.Minutes = Stopwatch.Total / 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 snprintf(text,TEXTSIZE,"\032\f%c",TXT_AvgDepth);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 GFX_write_string(&FontT42,&t6c1,text,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 snprintf(text,TEXTSIZE,"\030\003\016%01.1f",fAverageDepthAbsolute);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 GFX_write_string(&FontT105,&t6c1,text,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 tempWinX0 = t6c1.WindowX0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370 tempWinY0 = t6c1.WindowY0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 t6c1.WindowX0 = 480;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 // snprintf(text,TEXTSIZE,"\032\f%c%c - %c",TXT_2BYTE, TXT2BYTE_Clock, TXT_AvgDepth);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373 snprintf(text,TEXTSIZE,"\032\f%c", TXT_Stopwatch);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374 GFX_write_string(&FontT42,&t6c1,text,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 snprintf(text,TEXTSIZE,"\030\016%01.1f",fAverageDepth);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 GFX_write_string(&FontT105,&t6c1,text,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377 t6c1.WindowY0 = 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 snprintf(text,TEXTSIZE,"\030%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 GFX_write_string(&FontT105,&t6c1,text,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 t6c1.WindowX0 = tempWinX0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 t6c1.WindowY0 = tempWinY0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384 case CVIEW_T3_Temperature:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 GFX_write_string(&FontT42,&t6c1,text,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 // mean value
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388 temperatureThisCall = unit_temperature_float(stateUsed->lifeData.temperature_celsius);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389 temperature = (temperatureThisCall + temperatureLastCall[0] + temperatureLastCall[1] + temperatureLastCall[2]) / 4.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390 idTemperatureLastCall++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391 if(idTemperatureLastCall >= 3)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392 idTemperatureLastCall = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393 temperatureLastCall[idTemperatureLastCall] = temperatureThisCall;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 textpointer = snprintf(text,TEXTSIZE,"\030\003\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395 if(settingsGetPointer()->nonMetricalSystem == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396 text[textpointer++] = 'C';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 text[textpointer++] = 'F';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 text[textpointer++] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400 GFX_write_string(&FontT105,&t6c1,text,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403 case CVIEW_Compass:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405 GFX_write_string(&FontT42,&t6c1,text,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406 snprintf(text,100,"\030\003%03i`",(uint16_t)stateUsed->lifeData.compass_heading);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407 GFX_write_string(&FontT105,&t6c1,text,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408 t6_compass((uint16_t)stateUsed->lifeData.compass_heading, stateUsed->diveSettings.compassHeading);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411 case CVIEW_T3_MaxDepth:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412 default:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414 GFX_write_string(&FontT42,&t6c1,text,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416 t3_basics_colorscheme_mod(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417 GFX_write_string(&FontT105,&t6c1,text,1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423 void t6_show_customview_warnings(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 char text[256], textMain[256];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426 uint8_t textpointer, textpointerMain, lineFree, more;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428 snprintf(text,TEXTSIZE,"\025\f%c",TXT_Warning);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429 GFX_write_string(&FontT42,&t6c1,text,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
430
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
431 lineFree = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
432 more = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434 textpointerMain = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435 textMain[textpointerMain++] = '\025';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436 textMain[textpointerMain++] = '\003';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 textpointer = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440 text[textpointer++] = '\021';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 text[textpointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442 text[textpointer++] = TXT2BYTE_WarnDecoMissed;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443 if(stateUsed->warnings.decoMissed)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445 text[textpointer - 3] = '\025';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446 if(lineFree)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448 textMain[textpointerMain++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 textMain[textpointerMain++] = text[textpointer - 1];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450 textMain[textpointerMain] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451 lineFree--;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
454 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455 more++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
459 text[textpointer++] = '\t';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460 text[textpointer++] = '\021';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461 text[textpointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 text[textpointer++] = TXT2BYTE_WarnPPO2Low;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463 if(stateUsed->warnings.ppO2Low)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465 text[textpointer - 3] = '\025';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466 if(lineFree)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468 textMain[textpointerMain++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 textMain[textpointerMain++] = text[textpointer - 1];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470 textMain[textpointerMain] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471 lineFree--;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475 more++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479 text[textpointer++] = '\n';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480 text[textpointer++] = '\r';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481 text[textpointer++] = '\021';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 text[textpointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483 text[textpointer++] = TXT2BYTE_WarnPPO2High;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484 if(stateUsed->warnings.ppO2High)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
485 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486 text[textpointer - 3] = '\025';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487 if(lineFree)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
489 textMain[textpointerMain++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
490 textMain[textpointerMain++] = text[textpointer - 1];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
491 textMain[textpointerMain] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
492 lineFree--;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
494 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
495 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
496 more++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
497 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
498 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
499
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
500 text[textpointer++] = '\t';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
501 text[textpointer++] = '\021';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
502 text[textpointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
503 text[textpointer++] = TXT2BYTE_WarnFallback;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
504 if(stateUsed->warnings.fallback)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
505 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
506 text[textpointer - 3] = '\025';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
507 if(lineFree)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
508 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
509 textMain[textpointerMain++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
510 textMain[textpointerMain++] = text[textpointer - 1];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
511 textMain[textpointerMain] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
512 lineFree--;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
513 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
514 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
515 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
516 more++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
517 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
518 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
519
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
520 text[textpointer++] = '\n';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
521 text[textpointer++] = '\r';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
522 text[textpointer++] = '\021';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
523 text[textpointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524 text[textpointer++] = TXT2BYTE_WarnSensorLinkLost;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
525 if(stateUsed->warnings.sensorLinkLost)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
526 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
527 text[textpointer - 3] = '\025';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
528 if(lineFree)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
529 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
530 textMain[textpointerMain++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
531 textMain[textpointerMain++] = text[textpointer - 1];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
532 textMain[textpointerMain] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
533 lineFree--;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
534 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
535 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
536 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
537 more++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
538 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
539 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
540
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
541 text[textpointer] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
542 GFX_write_string(&FontT48,&t6c1,textMain,1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
543 if(more)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
544 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
545 GFX_write_string(&FontT48,&t6c2,text,1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
546 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
547 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
548
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
549
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
550 void t6_change_customview(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
551 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
552 const uint8_t *pViews;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
553 pViews = t6_customviews;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
554
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
555 while((*pViews != CVIEW_T3_END) && (*pViews != t6_selection_customview))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
556 {pViews++;}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
557
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
558 if(*pViews < CVIEW_T3_END)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
559 pViews++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
560
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
561 if(*pViews == CVIEW_T3_END)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
562 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
563 t6_selection_customview = t6_customviews[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
564 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
565 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
566 t6_selection_customview = *pViews;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
567 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
568
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
569
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
570 void t3_basics_colorscheme_mod(char *text)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
571 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
572 if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard())
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
573 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
574 text[0] = '\027';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
575 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
576 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
577
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
578 point_t t6_compass_circle(uint8_t id, uint16_t degree)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
579 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
580 float fCos, fSin;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
581 const float piMult = ((2 * 3.14159) / 360);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
582 // const int radius[4] = {95,105,115,60};
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
583 const int radius[4] = {85,95,105,90};
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
584 const point_t offset = {.x = 600, .y = 116};
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
585
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
586 static point_t r[4][360] = { 0 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
587
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
588 if(r[0][0].y == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
589 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
590 for(int i=0;i<360;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
591 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
592 fCos = cos(i * piMult);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
593 fSin = sin(i * piMult);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
594 for(int j=0;j<4;j++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
595 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
596 r[j][i].x = offset.x + (int)(fSin * radius[j]);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
597 r[j][i].y = offset.y + (int)(fCos * radius[j]);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
598 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
599 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
600 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
601 if(id > 3) id = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
602 if(degree > 359) degree = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
603 return r[id][degree];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
604 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
605
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
606
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
607 void t6_compass(uint16_t ActualHeading, uint16_t UserSetHeading)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
608 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
609 uint16_t LineHeading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
610 point_t center;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
611 static int32_t LastHeading = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
612 int32_t newHeading = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
613 int32_t diff = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
614 int32_t diff2 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
615
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
616 int32_t diffAbs = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
617 int32_t diffAbs2 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
618
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
619 newHeading = ActualHeading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
620
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
621 diff = newHeading - LastHeading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
622
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
623 if(newHeading < LastHeading)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
624 diff2 = newHeading + 360 - LastHeading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
625 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
626 diff2 = newHeading - 360 - LastHeading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
627
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
628 diffAbs = diff;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
629 if(diffAbs < 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
630 diffAbs *= -1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
631
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
632 diffAbs2 = diff2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
633 if(diffAbs2 < 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
634 diffAbs2 *= -1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
635
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
636
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
637 if(diffAbs <= diffAbs2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
638 newHeading = LastHeading + (diff / 2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
639 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
640 newHeading = LastHeading + (diff2 / 2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
641
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
642 if(newHeading < 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
643 newHeading += 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
644 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
645 if(newHeading >= 360)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
646 newHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
647
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
648 LastHeading = newHeading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
649 ActualHeading = newHeading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
650
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
651 if (ActualHeading < 90)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
652 ActualHeading += 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
653
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
654 while(ActualHeading > 359) ActualHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
655
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
656 LineHeading = 360 - ActualHeading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
657 GFX_draw_thick_line(9,&t6screen, t6_compass_circle(0,LineHeading), t6_compass_circle(2,LineHeading), CLUT_Font030); // North
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
658 LineHeading += 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
659 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
660 GFX_draw_thick_line(9,&t6screen, t6_compass_circle(1,LineHeading), t6_compass_circle(2,LineHeading), CLUT_Font031); // Maintick
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
661 LineHeading += 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
662 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
663 GFX_draw_thick_line(9,&t6screen, t6_compass_circle(1,LineHeading), t6_compass_circle(2,LineHeading), CLUT_Font031);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
664 LineHeading += 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
665 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
666 GFX_draw_thick_line(9,&t6screen, t6_compass_circle(1,LineHeading), t6_compass_circle(2,LineHeading), CLUT_Font031);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
667
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
668 LineHeading = 360 - ActualHeading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
669 LineHeading += 45;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
670 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
671 GFX_draw_thick_line(5,&t6screen, t6_compass_circle(1,LineHeading), t6_compass_circle(2,LineHeading), CLUT_Font031); // Subtick
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
672 LineHeading += 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
673 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
674 GFX_draw_thick_line(5,&t6screen, t6_compass_circle(1,LineHeading), t6_compass_circle(2,LineHeading), CLUT_Font031);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
675 LineHeading += 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
676 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
677 GFX_draw_thick_line(5,&t6screen, t6_compass_circle(1,LineHeading), t6_compass_circle(2,LineHeading), CLUT_Font031);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
678 LineHeading += 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
679 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
680 GFX_draw_thick_line(5,&t6screen, t6_compass_circle(1,LineHeading), t6_compass_circle(2,LineHeading), CLUT_Font031);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
681
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
682 LineHeading = 360 - ActualHeading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
683 LineHeading += 22;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
684 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
685 GFX_draw_thick_line(3,&t6screen, t6_compass_circle(1,LineHeading), t6_compass_circle(2,LineHeading), CLUT_Font031); // Subtick
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
686 LineHeading += 45;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
687 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
688 GFX_draw_thick_line(3,&t6screen, t6_compass_circle(1,LineHeading), t6_compass_circle(2,LineHeading), CLUT_Font031);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
689 LineHeading += 45;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
690 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
691 GFX_draw_thick_line(3,&t6screen, t6_compass_circle(1,LineHeading), t6_compass_circle(2,LineHeading), CLUT_Font031);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
692 LineHeading += 45;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
693 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
694 GFX_draw_thick_line(3,&t6screen, t6_compass_circle(1,LineHeading), t6_compass_circle(2,LineHeading), CLUT_Font031);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
695 LineHeading += 45;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
696 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
697 GFX_draw_thick_line(3,&t6screen, t6_compass_circle(1,LineHeading), t6_compass_circle(2,LineHeading), CLUT_Font031); // Subtick
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
698 LineHeading += 45;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
699 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
700 GFX_draw_thick_line(3,&t6screen, t6_compass_circle(1,LineHeading), t6_compass_circle(2,LineHeading), CLUT_Font031);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
701 LineHeading += 45;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
702 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
703 GFX_draw_thick_line(3,&t6screen, t6_compass_circle(1,LineHeading), t6_compass_circle(2,LineHeading), CLUT_Font031);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
704 LineHeading += 45;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
705 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
706 GFX_draw_thick_line(3,&t6screen, t6_compass_circle(1,LineHeading), t6_compass_circle(2,LineHeading), CLUT_Font031);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
707
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
708 if(UserSetHeading)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
709 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
710 LineHeading = UserSetHeading + 360 - ActualHeading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
711 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
712 GFX_draw_thick_line(9,&t6screen, t6_compass_circle(3,LineHeading), t6_compass_circle(2,LineHeading), CLUT_CompassUserHeadingTick);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
713
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
714 // R�ckpeilung, User Back Heading
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
715 LineHeading = UserSetHeading + 360 + 180 - ActualHeading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
716 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
717 if(LineHeading > 359) LineHeading -= 360;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
718 GFX_draw_thick_line(9,&t6screen, t6_compass_circle(3,LineHeading), t6_compass_circle(2,LineHeading), CLUT_CompassUserBackHeadingTick);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
719 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
720
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
721 center.x = 600;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
722 center.y = 116;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
723 GFX_draw_circle(&t6screen, center, 106, CLUT_Font030);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
724 GFX_draw_circle(&t6screen, center, 107, CLUT_Font030);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
725 GFX_draw_circle(&t6screen, center, 108, CLUT_Font030);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
726 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
727 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
728