From fa9df329795f746bc0fdec04e521d3db41c0612f Mon Sep 17 00:00:00 2001 From: "@RubenKelevra" Date: Wed, 25 Sep 2024 04:27:14 +0200 Subject: [PATCH] tcs34725: fix color/clear channel percentage calculations on long exposures (#7493) --- esphome/components/tcs34725/tcs34725.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/tcs34725/tcs34725.cpp b/esphome/components/tcs34725/tcs34725.cpp index 88c59eb761..9bb7c9a3b2 100644 --- a/esphome/components/tcs34725/tcs34725.cpp +++ b/esphome/components/tcs34725/tcs34725.cpp @@ -211,7 +211,7 @@ void TCS34725Component::update() { if (raw_c == 0) { channel_c = channel_r = channel_g = channel_b = 0.0f; } else { - float max_count = this->integration_time_ * 1024.0f / 2.4; + float max_count = this->integration_time_ <= 153.6f ? this->integration_time_ * 1024.0f / 2.4f : 65535.0f; float sum = raw_c; channel_r = raw_r / sum * 100.0f; channel_g = raw_g / sum * 100.0f;