mirror of
https://github.com/esphome/esphome.git
synced 2024-11-21 22:48:10 +01:00
tcs34725: fix color/clear channel percentage calculations on long exposures (#7493)
This commit is contained in:
parent
fcce70d416
commit
fa9df32979
1 changed files with 1 additions and 1 deletions
|
@ -211,7 +211,7 @@ void TCS34725Component::update() {
|
||||||
if (raw_c == 0) {
|
if (raw_c == 0) {
|
||||||
channel_c = channel_r = channel_g = channel_b = 0.0f;
|
channel_c = channel_r = channel_g = channel_b = 0.0f;
|
||||||
} else {
|
} 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;
|
float sum = raw_c;
|
||||||
channel_r = raw_r / sum * 100.0f;
|
channel_r = raw_r / sum * 100.0f;
|
||||||
channel_g = raw_g / sum * 100.0f;
|
channel_g = raw_g / sum * 100.0f;
|
||||||
|
|
Loading…
Reference in a new issue