comparison Small_CPU/Src/pressure.c @ 415:e0907c7d8038 Improment_NVM

merged default into Improvment_NVM
author Ideenmodellierer
date Tue, 14 Jan 2020 21:52:15 +0100
parents 6f30f2011667
children 4be72d55b09a
comparison
equal deleted inserted replaced
414:6886aeeca454 415:e0907c7d8038
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