annotate Discovery/Src/t3.c @ 135:5df4f1a315cb FlipDisplay

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