From 60d01c0d9438c09bb9ed71397f4761b088fe7989 Mon Sep 17 00:00:00 2001 From: samuelbles07 Date: Thu, 10 Oct 2024 22:51:37 +0700 Subject: [PATCH] First init the data structure --- src/AgValue.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/AgValue.h b/src/AgValue.h index 1957828..c3432b3 100644 --- a/src/AgValue.h +++ b/src/AgValue.h @@ -35,6 +35,41 @@ public: } ~Measurements() {} + // Generic struct for reading indication for respective value + struct Reading { + int counter; // How many reading attempts done + int success; // How many reading that success from each attempts + int max; // Maximum reading attempt + }; + + // Reading type for sensor value that outputs float + struct FloatValue { + float lastValue; // Last reading value + float sumValues; // Total value of each reading + float avg; // The last average calculation after maximum reading attempt reached + Reading read; + }; + + // Reading type for sensor value that outputs integer + struct IntegerValue { + int lastValue; // Last reading value + unsigned long sumValues; // Total value of each reading + int avg; // The last average calculation after maximum reading attempt reached + Reading read; + }; + + FloatValue temperature; + FloatValue humidity; + IntegerValue co2; + IntegerValue tvoc; + IntegerValue tvoc_raw; + IntegerValue nox; + IntegerValue nox_raw; + IntegerValue pm_25; + IntegerValue pm_01; + IntegerValue pm_10; + IntegerValue pm_03_pc; + float Temperature; int Humidity; int CO2;