summaryrefslogtreecommitdiff
path: root/src/app/datalogger
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-05-15 19:45:57 +0200
committerDaniel Friesel <derf@finalrewind.org>2022-05-15 19:45:57 +0200
commit71e891f2284e5afb47ab6d24383058dd97230355 (patch)
tree047c5649e25abc0eb1956e7081af35fdfdd9656a /src/app/datalogger
parent14e405f5152c99e3e2db9948a8cee780e1af04a3 (diff)
add driver stub for Sensirion SEN5x PM sensor
Diffstat (limited to 'src/app/datalogger')
-rw-r--r--src/app/datalogger/main.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/app/datalogger/main.cc b/src/app/datalogger/main.cc
index 5800b1b..fd016e7 100644
--- a/src/app/datalogger/main.cc
+++ b/src/app/datalogger/main.cc
@@ -54,6 +54,9 @@
#ifdef CONFIG_driver_scd4x
#include "driver/scd4x.h"
#endif
+#ifdef CONFIG_driver_sen5x
+#include "driver/sen5x.h"
+#endif
#ifdef CONFIG_driver_veml6075
#include "driver/veml6075.h"
#endif
@@ -202,6 +205,38 @@ void loop(void)
}
#endif
+#ifdef CONFIG_driver_sen5x
+ if (sen5x.read()) {
+ kout << dec;
+ if (sen5x.pm1 != sen5x.PM_INVALID) {
+ kout << "PM1.0: " << (sen5x.pm1 / 10) << "." << (sen5x.pm1 % 10) << " µg/m³" << endl;
+ }
+ if (sen5x.pm2_5 != sen5x.PM_INVALID) {
+ kout << "PM2.5: " << (sen5x.pm2_5 / 10) << "." << (sen5x.pm2_5 % 10) << " µg/m³" << endl;
+ }
+ if (sen5x.pm4 != sen5x.PM_INVALID) {
+ kout << "PM4.0: " << (sen5x.pm4 / 10) << "." << (sen5x.pm4 % 10) << " µg/m³" << endl;
+ }
+ if (sen5x.pm10 != sen5x.PM_INVALID) {
+ kout << "PM10 : " << (sen5x.pm10 / 10) << "." << (sen5x.pm10 % 10) << " µg/m³" << endl;
+ }
+ if (sen5x.humidity != sen5x.HUMIDITY_INVALID) {
+ kout << "Humidity: " << (sen5x.humidity / 100) << "." << ((sen5x.humidity % 100) / 10) << " %" << endl;
+ }
+ if (sen5x.temperature != sen5x.TEMPERATURE_INVALID) {
+ kout << "Temperature: " << (sen5x.temperature / 200) << "." << ((sen5x.temperature % 200) / 20) << " °c" << endl;
+ }
+ if (sen5x.voc != sen5x.VOC_INVALID) {
+ kout << "VOC index: " << (sen5x.voc / 10) << "." << (sen5x.voc % 10) << endl;
+ }
+ if (sen5x.nox != sen5x.NOX_INVALID) {
+ kout << "NOx index: " << (sen5x.nox / 10) << "." << (sen5x.nox % 10) << endl;
+ }
+ } else {
+ kout << "SEN5x error" << endl;
+ }
+#endif
+
#ifdef CONFIG_driver_veml6075
float uva, uvb;
if (veml6075.readUV(&uva, &uvb)) {
@@ -318,6 +353,10 @@ int main(void)
scd4x.start();
#endif
+#ifdef CONFIG_driver_sen5x
+ sen5x.start();
+#endif
+
#ifdef CONFIG_driver_veml6075
veml6075.init();
#endif