Use NAN values for TSL2591 saturation (#3931)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Matthew Donoughe 2022-12-22 01:50:37 -05:00 committed by GitHub
parent 0b0984f9a0
commit b76c7a0131
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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); uint16_t max_count = (this->integration_time_ == TSL2591_INTEGRATION_TIME_100MS ? 36863 : 65535);
if ((full_spectrum == max_count) || (infrared == max_count)) { if ((full_spectrum == max_count) || (infrared == max_count)) {
// Signal an overflow // Signal an overflow
ESP_LOGW(TAG, "Apparent saturation on TSL2591 (%s). You could reduce the gain.", this->name_); ESP_LOGW(TAG, "Apparent saturation on TSL2591 (%s). You could reduce the gain or integration time.", this->name_);
return -1.0F; return NAN;
} }
if ((full_spectrum == 0) && (infrared == 0)) { if ((full_spectrum == 0) && (infrared == 0)) {