add nox_index to payload

This commit is contained in:
Phat Nguyen
2024-03-03 22:24:58 +07:00
parent 3f1da6387b
commit 6cf5e31843
4 changed files with 31 additions and 2 deletions

View File

@ -121,6 +121,7 @@ void Sgp41::_handle(void) {
vTaskDelay(pdMS_TO_TICKS(1000));
if (getRawSignal(srawVoc, srawNox)) {
tvocRaw = srawVoc;
noxRaw = srawNox;
nox = noxAlgorithm()->process(srawNox);
tvoc = vocAlgorithm()->process(srawVoc);
AgLog("Polling SGP41 success: tvoc: %d, nox: %d", tvoc, nox);
@ -249,3 +250,10 @@ bool Sgp41::_noxConditioning(void) {
* @return int
*/
int Sgp41::getTvocRaw(void) { return tvocRaw; }
/**
* @brief Get NOX raw value
*
* @return int
*/
int Sgp41::getNoxRaw(void) { return noxRaw; }

View File

@ -24,6 +24,7 @@ public:
int getTvocIndex(void);
int getNoxIndex(void);
int getTvocRaw(void);
int getNoxRaw(void);
private:
bool onConditioning = true;
@ -39,6 +40,7 @@ private:
int tvoc = 0;
int tvocRaw;
int nox = 0;
int noxRaw;
#if defined(ESP8266)
uint32_t conditioningPeriod;
uint8_t conditioningCount;