Mercurial > public > ostc4
annotate Small_CPU/Inc/batteryGasGauge.h @ 250:822416168585 bm-2
Buelmann: new implementation for ceiling
Since my first functional fix in the ceiling computation in
commit ceecabfddb57, I noticed that the computation used a
linear search, that became rather computational expensive after
that commit. The simple question is: why not a binary search?
So, this commit implements the binary search. But there is a long
story attached to this. Comparing ceiling results from hwOS and this
OSTC4 code were very different. Basically, the original OSTC4
algorithm computed the ceiling using the same GFlow to GFhigh
slope, in such a way, that the ceiling was in sync with the
presented deco stops, where the hwOS code presents a GFhigh
based ceiling.
This said, it is more logical when the OSTC4 and hwOS code give
similar results. This new recursive algorithm gives very similar
results for the ceiling compared to hwOS.
To be complete here, the Buelmann ceiling is the depth to which
you can ascend, so that the leading tissue reaches GFhigh. This
also explains why the deepest deco stop is normally deeper than
the ceiling (unless one dives with GF like 80/80).
The code implemented here is rather straightforward recursion.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Thu, 11 Apr 2019 17:48:48 +0200 |
parents | 5f11787b4f42 |
children | 2defc8cd93ce |
rev | line source |
---|---|
38 | 1 /** |
2 ****************************************************************************** | |
3 * @file batteryGasGauge.h | |
4 * @author heinrichs weikamp gmbh | |
5 * @version V0.0.1 | |
6 * @date 09-Dec-2014 | |
7 * @brief LTC2942 | |
8 * | |
9 @verbatim | |
10 ============================================================================== | |
11 ##### How to use ##### | |
12 ============================================================================== | |
13 @endverbatim | |
14 ****************************************************************************** | |
15 * @attention | |
16 * | |
17 * <h2><center>© COPYRIGHT(c) 2014 heinrichs weikamp</center></h2> | |
18 * | |
19 ****************************************************************************** | |
20 */ | |
21 | |
22 /* Define to prevent recursive inclusion -------------------------------------*/ | |
23 #ifndef BATTERY_GAS_GAUGE_H | |
24 #define BATTERY_GAS_GAUGE_H | |
25 | |
26 #ifdef __cplusplus | |
27 extern "C" { | |
28 #endif | |
29 | |
30 /* Includes ------------------------------------------------------------------*/ | |
31 | |
32 void init_battery_gas_gauge(void); | |
33 | |
34 float get_voltage(void); | |
35 float get_charge(void); | |
36 | |
37 void battery_gas_gauge_get_data(void); | |
38 void battery_gas_gauge_set_charge_full(void); | |
39 void battery_gas_gauge_set(float percentage); | |
40 | |
41 #ifdef __cplusplus | |
42 } | |
43 #endif | |
44 | |
45 #endif /* BATTERY_GAS_GAUGE_H */ | |
46 | |
47 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/ |