annotate Discovery/Src/t4_tetris.c @ 79:b33c7f2ae0d9

Added Fontpack reference project
author Ideenmodellierer
date Thu, 04 Oct 2018 20:49:47 +0200
parents 5f11787b4f42
children 255eedad4155
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/t4_tetris.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Main Template file for dive mode special screen t4_tetris
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 17-Feb-2016
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 "t4_tetris.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 /* Exported variables --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 GFX_DrawCfgScreen t4screen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 GFX_DrawCfgWindow t4l1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 GFX_DrawCfgWindow t4l2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 GFX_DrawCfgWindow t4l3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 extern float depthLastCall[9];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 extern uint8_t idDepthLastCall;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 extern float temperatureLastCall[3];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 extern uint8_t idTemperatureLastCall;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 /* Private types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 #define TEXTSIZE 16
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 const uint16_t t4SeperationLeftRight = 250;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 const uint16_t t4SeperationTopMid = 315;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 const uint16_t t4SeperationMidBottom = 139;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 void t4_refresh_divemode(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 void t4_refresh_customview(float depth);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 uint8_t t4_test_customview_warnings(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 void t4_show_customview_warnings(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 void t4_battery_low_customview_extra(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 void t4_init(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 t4screen.FBStartAdress = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 t4screen.ImageHeight = 480;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 t4screen.ImageWidth = 800;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 t4screen.LayerIndex = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 t4l1.Image = &t4screen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 t4l1.WindowNumberOfTextLines = 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 t4l1.WindowLineSpacing = 19; // Abstand von Y0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 t4l1.WindowTab = 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 t4l1.WindowX0 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 t4l1.WindowX1 = t4SeperationLeftRight - 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 t4l1.WindowY1 = 479;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 t4l1.WindowY0 = t4SeperationTopMid + 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 t4l2.Image = t4l1.Image;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 t4l2.WindowNumberOfTextLines = t4l1.WindowNumberOfTextLines;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 t4l2.WindowLineSpacing = t4l1.WindowLineSpacing;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 t4l2.WindowTab = t4l1.WindowTab;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 t4l2.WindowX0 = t4l1.WindowX0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 t4l2.WindowX1 = t4l1.WindowX1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 t4l2.WindowY1 = t4SeperationTopMid - 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 t4l2.WindowY0 = t4SeperationMidBottom + 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 t4l3.Image = t4l1.Image;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 t4l3.WindowNumberOfTextLines = t4l1.WindowNumberOfTextLines;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 t4l3.WindowLineSpacing = t4l1.WindowLineSpacing;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 t4l3.WindowTab = t4l1.WindowTab;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 t4l3.WindowX0 = t4l1.WindowX0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 t4l3.WindowX1 = t4l1.WindowX1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 t4l3.WindowY1 = t4SeperationMidBottom - 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 t4l3.WindowY0 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 void t4_refresh(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 SStateList status;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 get_globalStateList(&status);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 if(stateUsed->mode != MODE_DIVE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 settingsGetPointer()->design = 7;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 if(status.base != BaseHome)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 t4screen.FBStartAdress = getFrame(25);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 t4_refresh_divemode();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 GFX_SetFramesTopBottom(t4screen.FBStartAdress, NULL,480);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 releaseAllFramesExcept(25,t4screen.FBStartAdress);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 void t4_refresh_divemode(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 char text[512];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 // uint8_t textpointer = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 // uint8_t customview_warnings = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 point_t start, stop;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 start.x = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 stop.x = t4SeperationLeftRight;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 stop.y = start.y = t4SeperationTopMid;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 GFX_draw_line(&t4screen, start, stop, CLUT_Font020);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 stop.y = start.y = t4SeperationMidBottom;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 GFX_draw_line(&t4screen, start, stop, CLUT_Font020);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 start.y = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 stop.y = 479;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 stop.x = start.x = t4SeperationLeftRight;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 GFX_draw_line(&t4screen, start, stop, CLUT_Font020);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 // depth
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 float depth = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 float depthThisCall = unit_depth_float(stateUsed->lifeData.depth_meter);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 if(is_stateUsedSetToSim())
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 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
158
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 idDepthLastCall++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 if(idDepthLastCall >= 9)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 idDepthLastCall = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 depthLastCall[idDepthLastCall] = depthThisCall;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 depth = (depthThisCall + depthLastCall[0] + depthLastCall[1] + depthLastCall[2]) / 4.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 idDepthLastCall++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 if(idDepthLastCall >= 3)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 idDepthLastCall = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 depthLastCall[idDepthLastCall] = depthThisCall;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 if(depth <= 0.3f)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 depth = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Depth);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 GFX_write_string(&FontT24,&t4l1,text,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 if( depth < 100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 snprintf(text,TEXTSIZE,"\020%01.1f",depth);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 snprintf(text,TEXTSIZE,"\020%01.0f",depth);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 t3_basics_colorscheme_mod(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 GFX_write_string(&FontT144,&t4l1,text,1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 // divetime
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 SDivetime Divetime = {0,0,0, 0};
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 Divetime.Minutes = Divetime.Total / 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 SDivetime TimeoutTime = {0,0,0,0};
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 TimeoutTime.Total = settingsGetPointer()->timeoutDiveReachedZeroDepth - stateUsed->lifeData.counterSecondsShallowDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 if(TimeoutTime.Total > settingsGetPointer()->timeoutDiveReachedZeroDepth)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 TimeoutTime.Total = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 TimeoutTime.Minutes = TimeoutTime.Total / 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 TimeoutTime.Seconds = TimeoutTime.Total - (TimeoutTime.Minutes * 60);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 if(stateUsed->lifeData.counterSecondsShallowDepth)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 snprintf(text,TEXTSIZE,"\f\136 %u:%02u",TimeoutTime.Minutes, TimeoutTime.Seconds);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 GFX_write_string(&FontT42,&t4l2,text,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Divetime);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 GFX_write_string(&FontT42,&t4l2,text,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 if(Divetime.Minutes < 1000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 snprintf(text,TEXTSIZE,"\020\016%u:%02u",Divetime.Minutes, Divetime.Seconds);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 snprintf(text,TEXTSIZE,"\020\016%u'",Divetime.Minutes);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 t3_basics_colorscheme_mod(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 GFX_write_string(&FontT105,&t4l2,text,1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225