mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/driver-ms56xx.git
synced 2025-06-12 02:45:59 +00:00
Added simple barometric formula to MS5611 driver
This commit is contained in:
parent
fa30a28b45
commit
afe9b83b01
@ -169,6 +169,10 @@ namespace sta
|
|||||||
* @return float The altitude estimate in meters.
|
* @return float The altitude estimate in meters.
|
||||||
*/
|
*/
|
||||||
float getAltitudeEstimate();
|
float getAltitudeEstimate();
|
||||||
|
|
||||||
|
static float getSeaLevel(float pressRef, float altRef);
|
||||||
|
|
||||||
|
static float getAltitudeEstimate(float pressure, float sealevel);
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief Reset the sensor.
|
* @brief Reset the sensor.
|
||||||
|
@ -121,6 +121,16 @@ namespace sta
|
|||||||
return altitude;
|
return altitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float MS56xx::getSeaLevel(float pressRef, float altRef)
|
||||||
|
{
|
||||||
|
return pressRef / (std::pow((1 - altRef / 44330), 5.255));
|
||||||
|
}
|
||||||
|
|
||||||
|
float MS56xx::getAltitudeEstimate(float pressure, float sealevel)
|
||||||
|
{
|
||||||
|
return 44330 * (1 - std::pow(pressure / sealevel, 1 / 5.255));
|
||||||
|
}
|
||||||
|
|
||||||
void MS56xx::readPROM() {
|
void MS56xx::readPROM() {
|
||||||
uint8_t buffer[2];
|
uint8_t buffer[2];
|
||||||
|
|
||||||
|
10
src/mock.cpp
10
src/mock.cpp
@ -103,6 +103,16 @@ namespace sta
|
|||||||
return altitude;
|
return altitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float MS56xx::getSeaLevel(float pressRef, float altRef)
|
||||||
|
{
|
||||||
|
return pressRef / (std::pow((1 - altRef / 44330), 5.255));
|
||||||
|
}
|
||||||
|
|
||||||
|
float MS56xx::getAltitudeEstimate(float pressure, float sealevel)
|
||||||
|
{
|
||||||
|
return 44330 * (1 - std::pow(pressure / sealevel, 1 / 5.255));
|
||||||
|
}
|
||||||
|
|
||||||
void MS56xx::readPROM() {
|
void MS56xx::readPROM() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user