Mercurial > public > ostc4
annotate Small_CPU/Inc/i2c.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 | 9ecc2e60418d |
children | cb3870f79e9d |
rev | line source |
---|---|
38 | 1 /* Define to prevent recursive inclusion -------------------------------------*/ |
2 #ifndef I2C_H | |
3 #define I2C_H | |
4 | |
165 | 5 /* Pressure Sensor */ |
6 #define DEVICE_PRESSURE 0xEE // 2019 hardware (gen 3) will use 0xEC (MS5837), all other use 0xEE (MS5803) | |
38 | 7 |
165 | 8 /* Compass/Accelerometer */ |
9 #define DEVICE_ACCELARATOR_MMA8452Q 0x38 // Hardware gen 1 (Two chip solution with MMA8452Q and HMC5883L) | |
10 #define DEVICE_COMPASS_HMC5883L 0x3C // Hardware gen 1 | |
38 | 11 |
165 | 12 #define DEVICE_COMPASS_303D 0x3C // Hardware gen 2 (Single chip solution LSM303D) |
13 #define DEVICE_COMPASS_303AGR 0x3C // Hardware gen 3 (Single chip solution LSM303AGR) | |
38 | 14 |
15 /* Battery Gas Gauge */ | |
165 | 16 #define DEVICE_BATTERYGAUGE 0xC8 // LTC2941 battery gauge |
38 | 17 |
18 | |
19 /* Includes ------------------------------------------------------------------*/ | |
20 #include "stm32f4xx_hal.h" | |
21 | |
22 HAL_StatusTypeDef I2C_Master_Transmit( uint16_t DevAddress, uint8_t *pData, uint16_t Size); | |
23 HAL_StatusTypeDef I2C_Master_TransmitNoStop( uint16_t DevAddress, uint8_t *pData, uint16_t Size); | |
24 HAL_StatusTypeDef I2C_Master_Receive( uint16_t DevAddress, uint8_t *pData, uint16_t Size); | |
25 HAL_StatusTypeDef MX_I2C1_Init(void); | |
26 void I2C_DeInit(void); | |
27 HAL_StatusTypeDef I2C1_Status(void); | |
28 | |
29 GPIO_PinState MX_I2C1_TestAndClear(void); | |
30 | |
31 //void I2C_Error(void); | |
32 | |
33 | |
34 #endif /* I2C_H */ |