From 80ad784a4ef1f57b0b4dca480d6babcbea1c2212 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Sat, 5 Jun 2021 10:52:16 +0200 Subject: [PATCH] Avoid unnecessary waits to stabilize the VOC algorithm (#1834) --- esphome/components/sgp40/sgp40.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/esphome/components/sgp40/sgp40.cpp b/esphome/components/sgp40/sgp40.cpp index 3e9f2b96cf..cfd9766aa9 100644 --- a/esphome/components/sgp40/sgp40.cpp +++ b/esphome/components/sgp40/sgp40.cpp @@ -220,7 +220,8 @@ void SGP40Component::update() { uint32_t voc_index = this->measure_voc_index_(); - if (this->samples_read_++ < this->samples_to_stabalize_) { + if (this->samples_read_ < this->samples_to_stabalize_) { + this->samples_read_++; ESP_LOGD(TAG, "Sensor has not collected enough samples yet. (%d/%d) VOC index is: %u", this->samples_read_, this->samples_to_stabalize_, voc_index); return;