mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-13 07:56:32 +02:00
add nox_index
to payload
This commit is contained in:
@ -669,6 +669,7 @@ static int dispSmState = APP_SM_NORMAL; /** Save LED SM */
|
|||||||
static int tvocIndex = -1;
|
static int tvocIndex = -1;
|
||||||
static int tvocRawIndex = -1;
|
static int tvocRawIndex = -1;
|
||||||
static int noxIndex = -1;
|
static int noxIndex = -1;
|
||||||
|
static int noxRawIndex = -1;
|
||||||
static int co2Ppm = -1;
|
static int co2Ppm = -1;
|
||||||
static int pm25 = -1;
|
static int pm25 = -1;
|
||||||
static int pm01 = -1;
|
static int pm01 = -1;
|
||||||
@ -736,7 +737,7 @@ void setup() {
|
|||||||
u8g2.begin();
|
u8g2.begin();
|
||||||
|
|
||||||
/** Show boot display */
|
/** Show boot display */
|
||||||
Serial.println("Firmware Version: "+ag.getVersion());
|
Serial.println("Firmware Version: " + ag.getVersion());
|
||||||
displayShowText("One V9", "FW Ver: " + ag.getVersion(), "");
|
displayShowText("One V9", "FW Ver: " + ag.getVersion(), "");
|
||||||
delay(DISPLAY_DELAY_SHOW_CONTENT_MS);
|
delay(DISPLAY_DELAY_SHOW_CONTENT_MS);
|
||||||
|
|
||||||
@ -1016,7 +1017,7 @@ void webServerMetricsGet(void) {
|
|||||||
add_metric_point("", String(tvocIndex));
|
add_metric_point("", String(tvocIndex));
|
||||||
}
|
}
|
||||||
if (tvocRawIndex >= 0) {
|
if (tvocRawIndex >= 0) {
|
||||||
add_metric("tvoc_raw_index",
|
add_metric("tvoc_raw",
|
||||||
"The raw input value to the Total Volatile Organic Compounds "
|
"The raw input value to the Total Volatile Organic Compounds "
|
||||||
"(TVOC) index as measured by the AirGradient SGP sensor",
|
"(TVOC) index as measured by the AirGradient SGP sensor",
|
||||||
"gauge");
|
"gauge");
|
||||||
@ -1029,6 +1030,13 @@ void webServerMetricsGet(void) {
|
|||||||
"gauge");
|
"gauge");
|
||||||
add_metric_point("", String(noxIndex));
|
add_metric_point("", String(noxIndex));
|
||||||
}
|
}
|
||||||
|
if (noxRawIndex >= 0) {
|
||||||
|
add_metric("nox_raw",
|
||||||
|
"The raw input value to the Nitrous Oxide (NOx) index as "
|
||||||
|
"measured by the AirGradient SGP sensor",
|
||||||
|
"gauge");
|
||||||
|
add_metric_point("", String(noxRawIndex));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasSensorSHT) {
|
if (hasSensorSHT) {
|
||||||
@ -1118,6 +1126,9 @@ static String getServerSyncData(bool localServer) {
|
|||||||
if (noxIndex >= 0) {
|
if (noxIndex >= 0) {
|
||||||
root["nox_index"] = noxIndex;
|
root["nox_index"] = noxIndex;
|
||||||
}
|
}
|
||||||
|
if(noxRawIndex >= 0) {
|
||||||
|
root["nox_raw"] = noxRawIndex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (hasSensorSHT) {
|
if (hasSensorSHT) {
|
||||||
if (temp > -1001) {
|
if (temp > -1001) {
|
||||||
@ -2179,11 +2190,13 @@ static void tvocUpdate(void) {
|
|||||||
tvocIndex = ag.sgp41.getTvocIndex();
|
tvocIndex = ag.sgp41.getTvocIndex();
|
||||||
tvocRawIndex = ag.sgp41.getTvocRaw();
|
tvocRawIndex = ag.sgp41.getTvocRaw();
|
||||||
noxIndex = ag.sgp41.getNoxIndex();
|
noxIndex = ag.sgp41.getNoxIndex();
|
||||||
|
noxRawIndex = ag.sgp41.getNoxRaw();
|
||||||
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.printf(" TVOC index: %d\r\n", tvocIndex);
|
Serial.printf(" TVOC index: %d\r\n", tvocIndex);
|
||||||
Serial.printf("TVOC raw index: %d\r\n", tvocRawIndex);
|
Serial.printf("TVOC raw index: %d\r\n", tvocRawIndex);
|
||||||
Serial.printf(" NOx index: %d\r\n", noxIndex);
|
Serial.printf(" NOx index: %d\r\n", noxIndex);
|
||||||
|
Serial.printf(" NOx raw index: %d\r\n", noxRawIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -666,6 +666,7 @@ WebServer webServer;
|
|||||||
int tvocIndex = -1;
|
int tvocIndex = -1;
|
||||||
int tvocRawIndex = -1;
|
int tvocRawIndex = -1;
|
||||||
int noxIndex = -1;
|
int noxIndex = -1;
|
||||||
|
int noxRawIndex = -1;
|
||||||
int co2Ppm = 0;
|
int co2Ppm = 0;
|
||||||
|
|
||||||
int pm25_1 = -1;
|
int pm25_1 = -1;
|
||||||
@ -1019,11 +1020,13 @@ static void tvocUpdate(void) {
|
|||||||
tvocIndex = ag.sgp41.getTvocIndex();
|
tvocIndex = ag.sgp41.getTvocIndex();
|
||||||
tvocRawIndex = ag.sgp41.getTvocRaw();
|
tvocRawIndex = ag.sgp41.getTvocRaw();
|
||||||
noxIndex = ag.sgp41.getNoxIndex();
|
noxIndex = ag.sgp41.getNoxIndex();
|
||||||
|
noxRawIndex = ag.sgp41.getNoxRaw();
|
||||||
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.printf(" TVOC index: %d\r\n", tvocIndex);
|
Serial.printf(" TVOC index: %d\r\n", tvocIndex);
|
||||||
Serial.printf("TVOC raw index: %d\r\n", tvocRawIndex);
|
Serial.printf("TVOC raw index: %d\r\n", tvocRawIndex);
|
||||||
Serial.printf(" NOx index: %d\r\n", noxIndex);
|
Serial.printf(" NOx index: %d\r\n", noxIndex);
|
||||||
|
Serial.printf(" NOx raw index: %d\r\n", noxRawIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1412,6 +1415,9 @@ static String getServerSyncData(bool localServer) {
|
|||||||
if (noxIndex >= 0) {
|
if (noxIndex >= 0) {
|
||||||
root["nox_index"] = noxIndex;
|
root["nox_index"] = noxIndex;
|
||||||
}
|
}
|
||||||
|
if(noxRawIndex >= 0) {
|
||||||
|
root["nox_raw"] = noxRawIndex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +121,7 @@ void Sgp41::_handle(void) {
|
|||||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||||
if (getRawSignal(srawVoc, srawNox)) {
|
if (getRawSignal(srawVoc, srawNox)) {
|
||||||
tvocRaw = srawVoc;
|
tvocRaw = srawVoc;
|
||||||
|
noxRaw = srawNox;
|
||||||
nox = noxAlgorithm()->process(srawNox);
|
nox = noxAlgorithm()->process(srawNox);
|
||||||
tvoc = vocAlgorithm()->process(srawVoc);
|
tvoc = vocAlgorithm()->process(srawVoc);
|
||||||
AgLog("Polling SGP41 success: tvoc: %d, nox: %d", tvoc, nox);
|
AgLog("Polling SGP41 success: tvoc: %d, nox: %d", tvoc, nox);
|
||||||
@ -249,3 +250,10 @@ bool Sgp41::_noxConditioning(void) {
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
int Sgp41::getTvocRaw(void) { return tvocRaw; }
|
int Sgp41::getTvocRaw(void) { return tvocRaw; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get NOX raw value
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
int Sgp41::getNoxRaw(void) { return noxRaw; }
|
||||||
|
@ -24,6 +24,7 @@ public:
|
|||||||
int getTvocIndex(void);
|
int getTvocIndex(void);
|
||||||
int getNoxIndex(void);
|
int getNoxIndex(void);
|
||||||
int getTvocRaw(void);
|
int getTvocRaw(void);
|
||||||
|
int getNoxRaw(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool onConditioning = true;
|
bool onConditioning = true;
|
||||||
@ -39,6 +40,7 @@ private:
|
|||||||
int tvoc = 0;
|
int tvoc = 0;
|
||||||
int tvocRaw;
|
int tvocRaw;
|
||||||
int nox = 0;
|
int nox = 0;
|
||||||
|
int noxRaw;
|
||||||
#if defined(ESP8266)
|
#if defined(ESP8266)
|
||||||
uint32_t conditioningPeriod;
|
uint32_t conditioningPeriod;
|
||||||
uint8_t conditioningCount;
|
uint8_t conditioningCount;
|
||||||
|
Reference in New Issue
Block a user