Mercurial > public > ostc4
annotate Small_CPU/Inc/pressure.h @ 173:05c770dc2911 max-depth
Bugfix: make max depth move with current depth (part 1)
The display in dive mode of the max depth was updated before the actual
depth, which looks very strange. The reason for this was conceptually
simple. The depth value was averaged over a set of depth samples, but
the current depth was only taken from the current sample. So, per
definition, on an initial descend, the current depth is always bigger
(deeper) than any average from previous shallower samples.
This part 1 commit introduces a new function that is used immediate
after reception of the new sample from the RTE. This function does the
trivial average of a set of samples. Notice that also the surface and
ambient mbar pressures are taken into account (which are used heavily
over the entire code). This is a consistency thing. We should base any
further calculation from the data presented in the UI, instead of
presenting A, and use A' for further calculations.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Mon, 11 Mar 2019 19:48:57 +0100 |
parents | 5f11787b4f42 |
children | 8e9c502c0b06 |
rev | line source |
---|---|
38 | 1 /* Define to prevent recursive inclusion -------------------------------------*/ |
2 #ifndef PRESSURE_H | |
3 #define PRESSURE_H | |
4 | |
5 #include <stdint.h> | |
6 | |
7 uint8_t init_pressure(void); | |
8 uint8_t pressure_update(void); | |
9 | |
10 uint8_t is_init_pressure_done(void); | |
11 | |
12 void pressure_sensor_get_pressure_raw(void); | |
13 void pressure_sensor_get_temperature_raw(void); | |
14 void pressure_calculation(void); | |
15 | |
16 float get_temperature(void); | |
17 float get_pressure_mbar(void); | |
18 float get_surface_mbar(void); | |
19 | |
20 void init_surface_ring(void); | |
21 void update_surface_pressure(uint8_t call_rhythm_seconds); | |
22 | |
23 uint32_t demo_modify_temperature_and_pressure(int32_t divetime_in_seconds, uint8_t subseconds, float ceiling_mbar); | |
24 | |
25 #endif /* PRESSURE_H */ | |
26 |