File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,10 @@ float getVerticalSpeed();
2222// Set the ground altitude to the current altitude to compute AGL
2323void setGroundAltitude (const STR_DEVICE_DATA_140_V1 & deviceData );
2424
25- // Get the temperature in degrees Celsius
26- float getBaroTemperature ();
27-
28- #endif // INC_SP140_ALTIMETER_H_
25+ // Get the temperature in degrees Celsius
26+ float getBaroTemperature ();
27+
28+ // Get the pressure in hPa
29+ float getBaroPressure ();
30+
31+ #endif // INC_SP140_ALTIMETER_H_
Original file line number Diff line number Diff line change @@ -7,12 +7,12 @@ Adafruit_BMP3XX bmp;
77bool bmpPresent = false ;
88float groundAltitude = 0 ;
99
10- // Buffer to store altitude readings with timestamps
1110struct AltitudeReading {
1211 float altitude;
1312 unsigned long timestamp;
1413};
1514
15+ // Buffer to store altitude readings with timestamps
1616CircularBuffer<AltitudeReading, VARIO_BUFFER_SIZE> altitudeBuffer;
1717
1818float getAltitude (const STR_DEVICE_DATA_140_V1& deviceData) {
@@ -67,6 +67,14 @@ float getBaroTemperature() {
6767 return __FLT_MIN__; // Return a very small number if BMP is not present
6868}
6969
70+ // Get the pressure in hPa
71+ float getBaroPressure () {
72+ if (bmpPresent) {
73+ return bmp.readPressure () / 100 .0f ; // Convert Pa to hPa
74+ }
75+ return __FLT_MIN__; // Return a very small number if BMP is not present
76+ }
77+
7078// Start the bmp3XX sensor
7179bool setupAltimeter (bool altWire) {
7280 TwoWire* wire = &Wire;
You can’t perform that action at this time.
0 commit comments