1
0
mirror of https://github.com/esphome/esphome.git synced 2024-10-05 18:30:57 +01:00

tcs34725: fix color/clear channel percentage calculations on long exposures (#7493)

This commit is contained in:
@RubenKelevra 2024-09-25 04:27:14 +02:00 committed by GitHub
parent fcce70d416
commit fa9df32979
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;