annotate Discovery/Src/timer.c @ 686:b1e24513b83e Betatest

Bugfix Battery charge complete event: In previous version it could happen that the battery charge state was set to 100% even the battery was not completly charged. Rootcause was that the external charger IC signals sometimes completion because e.g. the connection between charger unit and OSTC is disconnected within a short time slot. This may happen while the user is trying to get the OSTC in a good charging position. To avoid this the state machine now checks the voltage everytime for valid charging complete range before a charging complete is signaled.
author Ideenmodellierer
date Fri, 05 Aug 2022 14:56:17 +0200
parents 2c49561c8062
children aa6006975e76
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/timer.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Contains timer related functionality like stopwatch and security stop
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author Peter Ryser & heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 5. Feb.2015 (maybe)
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 #include "data_central.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30
186
f11f0bf6ef2d cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
31 static _Bool bStopWatch = false;
f11f0bf6ef2d cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
32 static float stopWatchAverageDepth_Meter = 0.0f;
f11f0bf6ef2d cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
33 static long safetyStopCountDown_Second = 0;
311
ddbe8bed5096 bugfix: make stopwatch and divetime run in sync
Jan Mulder <jlmulder@xs4all.nl>
parents: 303
diff changeset
34 static long stopWatchOffset = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 void timer_init(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 stopWatchAverageDepth_Meter = 0.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 bStopWatch = true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 safetyStopCountDown_Second = 0;
311
ddbe8bed5096 bugfix: make stopwatch and divetime run in sync
Jan Mulder <jlmulder@xs4all.nl>
parents: 303
diff changeset
41 stopWatchOffset = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 void timer_UpdateSecond(_Bool checkOncePerSecond)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 static int last_second = -1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 static _Bool bSafetyStop = false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 static float last_depth_meter = 0;
519
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
49 static uint8_t safetyStopResetCnt = 0;
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
50 static uint16_t safetyStopRestartCnt = 0;
311
ddbe8bed5096 bugfix: make stopwatch and divetime run in sync
Jan Mulder <jlmulder@xs4all.nl>
parents: 303
diff changeset
51 long stopWatchTime_Second = 0;
186
f11f0bf6ef2d cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
52
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 if(checkOncePerSecond)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 int now = current_second();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 if( last_second == now)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 last_second = now;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 /** Stopwatch **/
311
ddbe8bed5096 bugfix: make stopwatch and divetime run in sync
Jan Mulder <jlmulder@xs4all.nl>
parents: 303
diff changeset
62 stopWatchTime_Second = stateUsed->lifeData.dive_time_seconds_without_surface_time - stopWatchOffset;
303
90e65971f15d bugfix, cleanup: simplify stopwatch logic and fix fallout
Jan Mulder <jlmulder@xs4all.nl>
parents: 186
diff changeset
63 if(bStopWatch && !is_ambient_pressure_close_to_surface(&stateUsedWrite->lifeData))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 {
303
90e65971f15d bugfix, cleanup: simplify stopwatch logic and fix fallout
Jan Mulder <jlmulder@xs4all.nl>
parents: 186
diff changeset
65 if(stopWatchTime_Second == 0)
90e65971f15d bugfix, cleanup: simplify stopwatch logic and fix fallout
Jan Mulder <jlmulder@xs4all.nl>
parents: 186
diff changeset
66 stopWatchAverageDepth_Meter = stateUsed->lifeData.depth_meter;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 stopWatchAverageDepth_Meter = (stopWatchAverageDepth_Meter * stopWatchTime_Second + stateUsed->lifeData.depth_meter)/ (stopWatchTime_Second + 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 /** SafetyStop **/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 float depthToStopSafetyStopCount;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 if(settingsGetPointer()->safetystopDuration && (stateUsed->lifeData.max_depth_meter > 10.0f) && (stateUsed->lifeData.dive_time_seconds > 60))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 //No deco when 10 meters are crossed from below => Activate SecurityStop
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 if( last_depth_meter > 10.0f && stateUsed->lifeData.depth_meter <= 10.0f)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 if(stateUsed->decolistBuehlmann.output_ndl_seconds > 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 bSafetyStop = true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 if(stateUsed->decolistVPM.output_ndl_seconds > 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 bSafetyStop = true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90
519
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
91 /* Has the diver left safety stop depth (descend)? => need to restart safety stop timer? */
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
92 if(safetyStopCountDown_Second != 0)
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
93 {
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
94 if(stateUsed->lifeData.depth_meter >= (settingsGetPointer()->safetystopDepth + 2.0))
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
95 {
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
96 safetyStopRestartCnt = safetyStopCountDown_Second;
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
97 safetyStopCountDown_Second = 0;
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
98 safetyStopResetCnt = 60; /* restart safety stop from scratch if depth is left for more than one minute */
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
99 }
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
100 }
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
101 else if(safetyStopResetCnt)
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
102 {
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
103 safetyStopResetCnt--;
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
104 if(safetyStopResetCnt == 0)
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
105 {
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
106 safetyStopRestartCnt = 0;
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
107 }
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
108 }
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
109
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 //Countdown starts at 5 meters
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 if(bSafetyStop && (stateUsed->lifeData.depth_meter - 0.0001f <= (settingsGetPointer()->safetystopDepth) ))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 if(safetyStopCountDown_Second == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 {
519
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
115 if(safetyStopRestartCnt) /* just a short interrupt of the safetystop => continue using old count */
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
116 {
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
117 safetyStopCountDown_Second = safetyStopRestartCnt;
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
118 safetyStopRestartCnt = 0;
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
119 }
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
120 else /* setup safety stop duration */
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
121 {
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
122 safetyStopCountDown_Second = (settingsGetPointer()->safetystopDuration) * 60;
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
123 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 else
519
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
126 {
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 safetyStopCountDown_Second--;
519
2c49561c8062 Reset Safety Stop display in case of a new descend:
Ideenmodellierer
parents: 311
diff changeset
128 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 // after safetystopDuration minutes or below 3 (2) meter safetyStop is disabled
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 if(settingsGetPointer()->safetystopDepth == 3)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 depthToStopSafetyStopCount = 1.999f; // instead of 2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 depthToStopSafetyStopCount = 2.999f;// instead of 3
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 if((safetyStopCountDown_Second == 1) || (stateUsed->lifeData.depth_meter <= depthToStopSafetyStopCount))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 bSafetyStop = false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 safetyStopCountDown_Second = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 bSafetyStop = false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 safetyStopCountDown_Second = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 last_depth_meter = stateUsed->lifeData.depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 }
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 void timer_Stopwatch_Restart(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 stopWatchAverageDepth_Meter = stateUsed->lifeData.depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 bStopWatch = true;
311
ddbe8bed5096 bugfix: make stopwatch and divetime run in sync
Jan Mulder <jlmulder@xs4all.nl>
parents: 303
diff changeset
156 stopWatchOffset = stateUsed->lifeData.dive_time_seconds_without_surface_time;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 void timer_Stopwatch_Stop(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 bStopWatch = false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 long timer_Stopwatch_GetTime(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 {
311
ddbe8bed5096 bugfix: make stopwatch and divetime run in sync
Jan Mulder <jlmulder@xs4all.nl>
parents: 303
diff changeset
166 return stateUsed->lifeData.dive_time_seconds_without_surface_time - stopWatchOffset;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 float timer_Stopwatch_GetAvarageDepth_Meter(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 return stopWatchAverageDepth_Meter;
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 long timer_Safetystop_GetCountDown(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 return safetyStopCountDown_Second;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 uint8_t timer_Safetystop_GetDepthUpperLimit(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 if(settingsGetPointer()->safetystopDepth == 3)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 return 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 return 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186