comparison Small_CPU/Src/pressure.c @ 403:6f30f2011667

We got one report of false/freezd depth reading when jumping into 2m depth instantaneously. The "PRESSURE_JUMP_VALID_MBAR" threshold was removed, the new behaviour was tested in the pressure tank intensively and it's simply better/more reliable without this threshold.
author heinrichsweikamp
date Wed, 08 Jan 2020 15:35:15 +0100
parents cb3870f79e9d
children 4be72d55b09a
comparison
equal deleted inserted replaced
402:44cb4e858643 403:6f30f2011667
49 /* remove comment to use a predefined profile for pressure changes instead of real world data */ 49 /* remove comment to use a predefined profile for pressure changes instead of real world data */
50 /* #define SIMULATE_PRESSURE */ 50 /* #define SIMULATE_PRESSURE */
51 51
52 #define PRESSURE_SURFACE_MAX_MBAR (1030.0f) /* It is unlikely that pressure at surface is greater than this value => clip to it */ 52 #define PRESSURE_SURFACE_MAX_MBAR (1030.0f) /* It is unlikely that pressure at surface is greater than this value => clip to it */
53 #define PRESSURE_HISTORY_SIZE (8u) 53 #define PRESSURE_HISTORY_SIZE (8u)
54 #define PRESSURE_JUMP_VALID_MBAR (500.0f) /* values are measure several times a second => jumps > 5m very unlikely */
55 54
56 #define PRESSURE_SURFACE_QUE (30u) /* history buffer [minutes] for past pressure measurements */ 55 #define PRESSURE_SURFACE_QUE (30u) /* history buffer [minutes] for past pressure measurements */
57 #define PRESSURE_SURFACE_EVA_WINDOW (15u) /* Number of entries evaluated during instability test. Used to avoid detection while dive enters water */ 56 #define PRESSURE_SURFACE_EVA_WINDOW (15u) /* Number of entries evaluated during instability test. Used to avoid detection while dive enters water */
58 #define PRESSURE_SURFACE_STABLE_LIMIT (10u) /* Define pressure as stable if delta (mBar) is below this value */ 57 #define PRESSURE_SURFACE_STABLE_LIMIT (10u) /* Define pressure as stable if delta (mBar) is below this value */
59 #define PRESSURE_SURFACE_DETECT_STABLE_CNT (5u) /* Event count to detect stable condition */ 58 #define PRESSURE_SURFACE_DETECT_STABLE_CNT (5u) /* Event count to detect stable condition */
630 } 629 }
631 } 630 }
632 } 631 }
633 else 632 else
634 { 633 {
635 if(fabs(pressurevalue - pressure_average) < PRESSURE_JUMP_VALID_MBAR)
636 {
637 pressure_history_mbar[pressurewriteindex++] = pressurevalue; 634 pressure_history_mbar[pressurewriteindex++] = pressurevalue;
638 pressurewriteindex &= 0x7; /* wrap around if necessary */ 635 pressurewriteindex &= 0x7; /* wrap around if necessary */
639 retval = 1; 636 retval = 1;
640 }
641 } 637 }
642 638
643 return retval; 639 return retval;
644 } 640 }
645 641