From 13ef89ec399d1d6a471c5734a3adf228df019272 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 3 Mar 2023 10:34:47 -0500 Subject: [PATCH 1/2] add co2, eco2 --- Adafruit_Sensor.cpp | 6 ++++++ Adafruit_Sensor.h | 7 ++++++- README.md | 8 +++++++- 3 files changed, 19 insertions(+), 2 deletions(-) mode change 100755 => 100644 Adafruit_Sensor.h diff --git a/Adafruit_Sensor.cpp b/Adafruit_Sensor.cpp index a5a6d4e..a66e2d0 100644 --- a/Adafruit_Sensor.cpp +++ b/Adafruit_Sensor.cpp @@ -70,6 +70,12 @@ void Adafruit_Sensor::printSensorDetails(void) { case SENSOR_TYPE_NOX_INDEX: Serial.print(F("Nitrogen Oxides (Index)")); break; + case SENSOR_TYPE_CO2: + Serial.print(F("Carbon Dioxide (ppm)")); + break; + case SENSOR_TYPE_eCO2: + Serial.print(F("Equivalent/estimated CO2 (ppm)")); + break; } Serial.println(); diff --git a/Adafruit_Sensor.h b/Adafruit_Sensor.h old mode 100755 new mode 100644 index b0169d8..34b4196 --- a/Adafruit_Sensor.h +++ b/Adafruit_Sensor.h @@ -69,7 +69,9 @@ typedef enum { SENSOR_TYPE_COLOR = (17), SENSOR_TYPE_TVOC = (18), SENSOR_TYPE_VOC_INDEX = (19), - SENSOR_TYPE_NOX_INDEX = (20) + SENSOR_TYPE_NOX_INDEX = (20), + SENSOR_TYPE_CO2 = (21), + SENSOR_TYPE_eCO2 = (22), } sensors_type_t; /** struct sensors_vec_s is used to return a vector in a common format. */ @@ -142,6 +144,9 @@ typedef struct { normal (unitless) */ float nox_index; /**< NOx (Nitrogen Oxides) index where 100 is normal (unitless) */ + float CO2; /**< Measured CO2 in parts per million (ppm) */ + float eCO2; /**< equivalent/estimated CO2 in parts per million (ppm + estimated from some other measurement) */ sensors_color_t color; /**< color in RGB component values */ }; ///< Union for the wide ranges of data we can carry } sensors_event_t; diff --git a/README.md b/README.md index 1e87bed..a6c0216 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,9 @@ typedef enum SENSOR_TYPE_COLOR = (17), SENSOR_TYPE_TVOC = (18), SENSOR_TYPE_VOC_INDEX = (19), - SENSOR_TYPE_NOX_INDEX = (20) + SENSOR_TYPE_NOX_INDEX = (20), + SENSOR_TYPE_CO2 = (21), + SENSOR_TYPE_eCO2 = (22), } sensors_type_t; ``` @@ -143,6 +145,8 @@ typedef struct float tvoc; float voc_index; float nox_index; + float CO2, + float eCO2, sensors_color_t color; }; } sensors_event_t; @@ -188,6 +192,8 @@ A key part of the abstraction layer is the standardisation of values on SI units - **tvoc**: values are in **parts per billion** (ppb) - **voc_index**: values are an **index** from 1-500 with 100 being normal - **nox_index**: values are an **index** from 1-500 with 100 being normal +- **CO2**: values are in **parts per million*** (ppm) +- **eCO2**: values are in **parts per million*** (ppm) ## The Unified Driver Abstraction Layer in Practice ## From 175c626fdfeca83d753e902f7092d2e2402d39c8 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 3 Mar 2023 10:40:56 -0500 Subject: [PATCH 2/2] bump library version --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index 019fd7a..1fdb1a8 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit Unified Sensor -version=1.1.7 +version=1.1.8 author=Adafruit maintainer=Adafruit sentence=Required for all Adafruit Unified Sensor based libraries.