mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-15 00:46:31 +02:00
Add parameter tvoc_raw
for SGP41
This commit is contained in:
@ -120,6 +120,7 @@ void Sgp41::_handle(void) {
|
||||
for (;;) {
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
if (getRawSignal(srawVoc, srawNox)) {
|
||||
tvocRaw = srawVoc;
|
||||
nox = noxAlgorithm()->process(srawNox);
|
||||
tvoc = vocAlgorithm()->process(srawVoc);
|
||||
AgLog("Polling SGP41 success: tvoc: %d, nox: %d", tvoc, nox);
|
||||
@ -241,3 +242,10 @@ bool Sgp41::_noxConditioning(void) {
|
||||
err = sgpSensor()->executeConditioning(defaultRh, defaultT, srawVoc);
|
||||
return (err == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get TVOC raw value
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int Sgp41::getTvocRaw(void) { return tvocRaw; }
|
||||
|
@ -23,6 +23,7 @@ public:
|
||||
void end(void);
|
||||
int getTvocIndex(void);
|
||||
int getNoxIndex(void);
|
||||
int getTvocRaw(void);
|
||||
|
||||
private:
|
||||
bool onConditioning = true;
|
||||
@ -36,6 +37,7 @@ private:
|
||||
uint16_t defaultRh = 0x8000;
|
||||
uint16_t defaultT = 0x6666;
|
||||
int tvoc = 0;
|
||||
int tvocRaw;
|
||||
int nox = 0;
|
||||
#if defined(ESP8266)
|
||||
uint32_t conditioningPeriod;
|
||||
|
Reference in New Issue
Block a user