Mercurial > public > ostc4
comparison Small_CPU/Src/pressure.c @ 858:08ea8e9d6cfe Evo_2_23
Bugfix initialisation of surface pressure:
A reset of the RTE less than one minute before a dive starts may cause problems in the depth calculation because the default pressure is not set yet. To avoid this the first measured pressure value will now be used as stable surface pressure to close the gap till the stable surface pressure is evaluated.
author | Ideenmodellierer |
---|---|
date | Tue, 07 May 2024 21:12:37 +0200 |
parents | 2ace67231c49 |
children | 3311b720a072 |
comparison
equal
deleted
inserted
replaced
857:ba1aebc6d5af | 858:08ea8e9d6cfe |
---|---|
128 runningAvg = 0; | 128 runningAvg = 0; |
129 | 129 |
130 for(int i=0; i<PRESSURE_SURFACE_QUE; i++) | 130 for(int i=0; i<PRESSURE_SURFACE_QUE; i++) |
131 surface_ring_mbar[i] = ambient_pressure_mbar; | 131 surface_ring_mbar[i] = ambient_pressure_mbar; |
132 surface_pressure_mbar = ambient_pressure_mbar; | 132 surface_pressure_mbar = ambient_pressure_mbar; |
133 surface_pressure_stable_value = surface_pressure_mbar; | |
133 surface_pressure_writeIndex = 0; /* index of the oldest value in the ring buffer */ | 134 surface_pressure_writeIndex = 0; /* index of the oldest value in the ring buffer */ |
134 } | 135 } |
135 } | 136 } |
136 | 137 |
137 uint8_t is_surface_pressure_stable(void) | 138 uint8_t is_surface_pressure_stable(void) |
234 | 235 |
235 surface_pressure_mbar = surface_ring_mbar[surface_pressure_writeIndex]; /* 30 minutes old measurement */ | 236 surface_pressure_mbar = surface_ring_mbar[surface_pressure_writeIndex]; /* 30 minutes old measurement */ |
236 | 237 |
237 secondCounterSurfaceRing = 0; | 238 secondCounterSurfaceRing = 0; |
238 avgCount = 1; /* use the current value as starting point but restart the weight decrement of the measurements */ | 239 avgCount = 1; /* use the current value as starting point but restart the weight decrement of the measurements */ |
239 } | 240 |
240 evaluate_surface_pressure(); | 241 evaluate_surface_pressure(); |
242 } | |
241 } | 243 } |
242 } | 244 } |
243 | 245 |
244 #ifdef DEMOMODE | 246 #ifdef DEMOMODE |
245 float demo_modify_temperature_helper(float bottom_mbar_diff_to_surface) | 247 float demo_modify_temperature_helper(float bottom_mbar_diff_to_surface) |