do not use tcs values if saturated

This commit is contained in:
interfisch 2020-12-26 12:40:53 +01:00
parent 8f0582a458
commit f051321c81
1 changed files with 8 additions and 2 deletions

View File

@ -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.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 if (abs((int)d.lastsentvalue-value_tcs_lux)>=d.minchange){ //int abs
_changed=true; _changed=true;
@ -937,7 +940,10 @@ void loop_TCS34725_colortemp()
} }
// colorTemp = tcs.calculateColorTemperature(r, g, b); // 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.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 if (abs((int)d.lastsentvalue-value_colortemp)>=d.minchange){ //int abs