diff --git a/src/main.cpp b/src/main.cpp index c2ad2a4..dda796b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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"); }