From b76c7a0131cad8df8499bdfe4933a267cb04cbfc Mon Sep 17 00:00:00 2001 From: Matthew Donoughe Date: Thu, 22 Dec 2022 01:50:37 -0500 Subject: [PATCH] Use NAN values for TSL2591 saturation (#3931) Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> --- esphome/components/tsl2591/tsl2591.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/tsl2591/tsl2591.cpp b/esphome/components/tsl2591/tsl2591.cpp index f8c59a53c6..e3df467aeb 100644 --- a/esphome/components/tsl2591/tsl2591.cpp +++ b/esphome/components/tsl2591/tsl2591.cpp @@ -347,8 +347,8 @@ float TSL2591Component::get_calculated_lux(uint16_t full_spectrum, uint16_t infr uint16_t max_count = (this->integration_time_ == TSL2591_INTEGRATION_TIME_100MS ? 36863 : 65535); if ((full_spectrum == max_count) || (infrared == max_count)) { // Signal an overflow - ESP_LOGW(TAG, "Apparent saturation on TSL2591 (%s). You could reduce the gain.", this->name_); - return -1.0F; + ESP_LOGW(TAG, "Apparent saturation on TSL2591 (%s). You could reduce the gain or integration time.", this->name_); + return NAN; } if ((full_spectrum == 0) && (infrared == 0)) {