6 #include "oXs_config_basic.h"
7 #include "oXs_config_advanced.h"
8 #include "oXs_config_macros.h"
12 int32_t temperature
; // in 1/100 Celsius
13 int64_t rawPressure
; // in 1/10000 mBar so = Pa * 10000
15 int32_t rawAltitude
; // in cm * 100
16 struct ONE_MEASUREMENT absoluteAlt
; // value in cm
17 struct ONE_MEASUREMENT relativeAlt
; // value in cm
18 int32_t altOffset
; // in cm
19 int32_t relativeAltMax
; // in cm
20 bool relativeAltMaxAvailable
;
21 float delaySmooth
; // smoothed delay between 2 altitude calculations
22 int32_t prevAlt
[20] ; // table contains the 20 latest altitude
23 byte idxPrevAlt
; // index of last entry in table
24 int32_t vSpeed10Sec
; // Altitude gain/loose between 10 sec (is calculated and send every 500 msec)
25 bool vSpeed10SecAvailable
;
26 float climbRateFloat
; // in cm/sec but as float
27 struct ONE_MEASUREMENT climbRate
; // value in cm /sec = vertical speed
28 struct ONE_MEASUREMENT sensitivity
;
29 int sensitivityPpm
; // sensivity to apply when PPM is used. Value has to be divided by 1000 in order to calculate the smoothing parameter
30 unsigned long lastCommandMicros
; // used to avoid some task (reading voltage sensor, currentsensor, ..) when barometric data should be soon available for reading
37 OXS_MS5611(uint8_t addr
, HardwareSerial
&print
);
39 OXS_MS5611(uint8_t addr
) ;
42 //int64_t rawPressure; // in 1/10000 mBar
50 unsigned int _calibrationData
[7]; // The factory calibration data of the ms5611
51 uint8_t errorI2C
; //error code returned by I2C::Write and I2C::Read; 0 = no error
52 bool errorCalibration
; // (true = error)
53 void SendCommand(byte command
);
54 long getData(byte command
, byte del
);
55 void calculateVario() ;
56 unsigned int low
, high
;
64 int16_t alt_temp_compensation
;
66 int32_t altitude
; // in cm * 100
67 int32_t altitudeLowPass
;
68 int32_t altitudeHighPass
;
71 unsigned long extended2Micros
; // used to temporarilly save micros() >> 1
72 unsigned long pressureMicros
; // save time when program send command asking the MS5611 to get the pressure
73 unsigned long pressureMicrosPrev1
; // save the previous pressureMicros
74 unsigned long pressureMicrosPrev2
; // save the previous of the previous pressureMicros
75 unsigned long altMillis
;
76 unsigned long nextAltMillis
; // save when Altitude has to be calculated; altitude is available only after 3200 in order to get a stable value (less temperature drift)
77 // unsigned long nextAverageAltMillis ; // save when AverageAltitude has to be calculated
79 float climbRate2AltFloat
;
81 float abs_deltaClimbRate
;
84 HardwareSerial
* printer
;
86 }; // end class OXS_MS5611