Commit ac96d534 authored by Melroy van den Berg's avatar Melroy van den Berg

altitude and g/m3

parent 5d5b3b12
Pipeline #1061 passed with stages
in 13 seconds
......@@ -22,6 +22,7 @@
#include "bme280.h"
#include "pmsa003.h"
#include "mh_z19b.h"
#include "weather_env.h"
#include "led.h"
#include <stdio.h>
......@@ -154,12 +155,15 @@ bool DoTempMeasurement(int i2c_fd) {
while(counter < 60) {
bme.SetSensorMode(BME280_FORCED_MODE);
// 1/60Hz = 60000 ms
// 25Hz = 40ms (use 45 on the safe side)
// 25Hz = 40ms (use 45ms on the safe side)
usleep(45000);
bme280_data data = bme.getAllSensorData();
printf("%.2f °C\n", data.temperature);
printf("%.2f %%\n", data.humidity);
printf("%.2f hPa\n\n", data.pressure);
printf("%.2f hPa\n", data.pressure);
printf("%.2f meters\n", WeatherEnvironment::GetApproximateAltitude(data.pressure));
printf("%.2f humidity (g/m3)\n\n", WeatherEnvironment::GetAbsoluteHumidity(data.temperature, data.humidity));
counter++;
}
return true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment