add Rf link quality checks
[openXsensor.git] / openXsensor / oXs_sdp3x.h
blobf0431d2753cefe3c132b73cc4187979e68f8cc3b
1 #ifndef OXS_sdp3x_h
2 #define OXS_sdp3x_h
4 #include <Arduino.h>
5 #include "oXs_config_basic.h"
6 #include "oXs_config_advanced.h"
7 #include "oXs_config_macros.h"
8 #include "I2C.h"
9 #include "oXs_4525.h"
12 struct AIRSPEEDDATA {
13 float temperatureSdp3x; // in Celsius , used when compensation is calculated
14 float difPressure; // in Pa
15 struct ONE_MEASUREMENT airSpeed ; // in 1/10 km/h or 1/10 knots (no decimal)
16 float smoothAirSpeed ; //cm/sec ; use in glider ratio
17 //unsigned long lastCommand2Micros ; // used to avoid some task (reading voltage sensor, currentsensor, ..) when barometric data should be soon available for reading
18 // = micro divided by 2 to avoid overflow on comparison
22 extern float actualPressure ;
24 class OXS_SDP3X {
25 public:
26 #ifdef DEBUG
27 OXS_SDP3X(uint8_t addr, HardwareSerial &print);
28 #else
29 OXS_SDP3X(uint8_t addr) ;
30 #endif
31 AIRSPEEDDATA airSpeedData ;
32 void setup();
33 void readSensor();
36 private:
37 uint8_t _addr;
38 uint8_t I2CErrorCodeSdp3x ;
39 float dpScaleSdp3x; // differential pressure scale factor
40 uint8_t data[2]; // get 2 bytes returned by SDP3X
41 float temperatureKelvinSdp3x; // in Kelvin
42 // float difPressure; // in Pa
44 float smoothDifPressure ; // in Pa
45 float expoSmooth_auto ;
46 unsigned long nextAirSpeedMillis ; //next time that airspeed must be available
47 unsigned long nextPressureReadMillis ; // next time that pressure can be read (datasheet says O.5msec)
49 #ifdef DEBUG
50 HardwareSerial* printer;
51 #endif
52 }; // end class OXS_SDP3X
54 extern int32_t test1Value ;// used in order to test the transmission of any value
55 extern bool test1ValueAvailable ;
56 extern int32_t test2Value ;// used in order to test the transmission of any value
57 extern bool test2ValueAvailable ;
58 extern int32_t test3Value ;// used in order to test the transmission of any value
59 extern bool test3ValueAvailable ;
62 #endif // OXS_SDP3X