fix missing lastread time set for tcs sensor reading
This commit is contained in:
parent
ec3cee7db2
commit
8f0582a458
|
@ -887,9 +887,10 @@ void loop_TCS34725_lux()
|
||||||
|
|
||||||
bool _changed=false;
|
bool _changed=false;
|
||||||
if (millis() >= (d.lastreadtime+d.readdelay)) {
|
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.getRawData(&value_tcs_r, &value_tcs_g, &value_tcs_b, &value_tcs_c);
|
||||||
tcs.getData();
|
tcs.getData();
|
||||||
|
lastread_tcs34725=millis();
|
||||||
if (tcs.isSaturated){
|
if (tcs.isSaturated){
|
||||||
Serial.println("Warning: tcs34725 is saturated");
|
Serial.println("Warning: tcs34725 is saturated");
|
||||||
}
|
}
|
||||||
|
@ -926,9 +927,10 @@ void loop_TCS34725_colortemp()
|
||||||
|
|
||||||
bool _changed=false;
|
bool _changed=false;
|
||||||
if (millis() >= (d.lastreadtime+d.readdelay)) {
|
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.getRawData(&value_tcs_r, &value_tcs_g, &value_tcs_b, &value_tcs_c);
|
||||||
tcs.getData();
|
tcs.getData();
|
||||||
|
lastread_tcs34725=millis();
|
||||||
if (tcs.isSaturated){
|
if (tcs.isSaturated){
|
||||||
Serial.println("Warning: tcs34725 is saturated");
|
Serial.println("Warning: tcs34725 is saturated");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue