fix missing lastread time set for tcs sensor reading

This commit is contained in:
interfisch 2020-12-26 12:29:32 +01:00
parent ec3cee7db2
commit 8f0582a458
1 changed files with 4 additions and 2 deletions

View File

@ -887,9 +887,10 @@ void loop_TCS34725_lux()
bool _changed=false;
if (millis() >= (d.lastreadtime+d.readdelay)) {
if (millis() >= (lastread_tcs34725+d.readdelay)) {
if (millis() >= (lastread_tcs34725+d.readdelay)) { //avoid reading sensor twice in a short time
//tcs.getRawData(&value_tcs_r, &value_tcs_g, &value_tcs_b, &value_tcs_c);
tcs.getData();
lastread_tcs34725=millis();
if (tcs.isSaturated){
Serial.println("Warning: tcs34725 is saturated");
}
@ -926,9 +927,10 @@ void loop_TCS34725_colortemp()
bool _changed=false;
if (millis() >= (d.lastreadtime+d.readdelay)) {
if (millis() >= (lastread_tcs34725+d.readdelay)) {
if (millis() >= (lastread_tcs34725+d.readdelay)) { //avoid reading sensor twice in a short time
//tcs.getRawData(&value_tcs_r, &value_tcs_g, &value_tcs_b, &value_tcs_c);
tcs.getData();
lastread_tcs34725=millis();
if (tcs.isSaturated){
Serial.println("Warning: tcs34725 is saturated");
}