diff --git a/Adafruit_Sensor.cpp b/Adafruit_Sensor.cpp index e97aa46..a5a6d4e 100644 --- a/Adafruit_Sensor.cpp +++ b/Adafruit_Sensor.cpp @@ -64,6 +64,12 @@ void Adafruit_Sensor::printSensorDetails(void) { case SENSOR_TYPE_TVOC: Serial.print(F("Total Volatile Organic Compounds (ppb)")); break; + case SENSOR_TYPE_VOC_INDEX: + Serial.print(F("Volatile Organic Compounds (Index)")); + break; + case SENSOR_TYPE_NOX_INDEX: + Serial.print(F("Nitrogen Oxides (Index)")); + break; } Serial.println(); diff --git a/Adafruit_Sensor.h b/Adafruit_Sensor.h index 432cfa6..b0169d8 100755 --- a/Adafruit_Sensor.h +++ b/Adafruit_Sensor.h @@ -67,7 +67,9 @@ typedef enum { SENSOR_TYPE_VOLTAGE = (15), SENSOR_TYPE_CURRENT = (16), SENSOR_TYPE_COLOR = (17), - SENSOR_TYPE_TVOC = (18) + SENSOR_TYPE_TVOC = (18), + SENSOR_TYPE_VOC_INDEX = (19), + SENSOR_TYPE_NOX_INDEX = (20) } sensors_type_t; /** struct sensors_vec_s is used to return a vector in a common format. */ @@ -136,8 +138,12 @@ typedef struct { float current; /**< current in milliamps (mA) */ float voltage; /**< voltage in volts (V) */ float tvoc; /**< Total Volatile Organic Compounds, in ppb */ - sensors_color_t color; /**< color in RGB component values */ - }; ///< Union for the wide ranges of data we can carry + float voc_index; /**< VOC (Volatile Organic Compound) index where 100 is + normal (unitless) */ + float nox_index; /**< NOx (Nitrogen Oxides) index where 100 is normal + (unitless) */ + sensors_color_t color; /**< color in RGB component values */ + }; ///< Union for the wide ranges of data we can carry } sensors_event_t; /* Sensor details (40 bytes) */ diff --git a/README.md b/README.md index 18839d6..1e87bed 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,10 @@ typedef enum SENSOR_TYPE_AMBIENT_TEMPERATURE = (13), SENSOR_TYPE_VOLTAGE = (15), SENSOR_TYPE_CURRENT = (16), - SENSOR_TYPE_COLOR = (17) + SENSOR_TYPE_COLOR = (17), + SENSOR_TYPE_TVOC = (18), + SENSOR_TYPE_VOC_INDEX = (19), + SENSOR_TYPE_NOX_INDEX = (20) } sensors_type_t; ``` @@ -137,6 +140,9 @@ typedef struct float relative_humidity; float current; float voltage; + float tvoc; + float voc_index; + float nox_index; sensors_color_t color; }; } sensors_event_t; @@ -179,6 +185,10 @@ A key part of the abstraction layer is the standardisation of values on SI units - **current**: values are in **milliamps** (mA) - **voltage**: values are in **volts** (V) - **color**: values are in 0..1.0 RGB channel luminosity and 32-bit RGBA format +- **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 + ## The Unified Driver Abstraction Layer in Practice ## diff --git a/library.properties b/library.properties index d2d3af1..019fd7a 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit Unified Sensor -version=1.1.6 +version=1.1.7 author=Adafruit maintainer=Adafruit sentence=Required for all Adafruit Unified Sensor based libraries.