diff --git a/src/main.cpp b/src/main.cpp index dda796b..21ce707 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -896,7 +896,10 @@ void loop_TCS34725_lux() } } //value_tcs_lux = tcs.calculateLux(value_tcs_r, value_tcs_g, value_tcs_b); - value_tcs_lux = tcs.lux*TCS34725_LUXFACTOR; + uint16_t _value_tcs_lux = tcs.lux*TCS34725_LUXFACTOR; + if (!tcs.isSaturated){ //sometimes false high reading accur around 65535 sometimes less. + value_tcs_lux = _value_tcs_lux; + } if (abs((int)d.lastsentvalue-value_tcs_lux)>=d.minchange){ //int abs _changed=true; @@ -937,7 +940,10 @@ void loop_TCS34725_colortemp() } // colorTemp = tcs.calculateColorTemperature(r, g, b); //value_colortemp = tcs.calculateColorTemperature_dn40(value_tcs_r, value_tcs_g, value_tcs_b, value_tcs_c); - value_colortemp = tcs.ct; //with agc + if (!tcs.isSaturated){ + value_colortemp = tcs.ct; //with agc + } + if (abs((int)d.lastsentvalue-value_colortemp)>=d.minchange){ //int abs