minimum light for tcs colortemp

This commit is contained in:
interfisch 2020-11-01 12:28:45 +01:00
parent ff8582fa1e
commit 53c04c0077
1 changed files with 6 additions and 3 deletions

View File

@ -182,8 +182,7 @@ struct sensordata
struct sensordata dataTCS34725_colortemp; struct sensordata dataTCS34725_colortemp;
uint16_t value_colortemp, value_tcs_lux, value_tcs_r,value_tcs_g,value_tcs_b,value_tcs_c; uint16_t value_colortemp, value_tcs_lux, value_tcs_r,value_tcs_g,value_tcs_b,value_tcs_c;
unsigned long lastread_tcs34725=0; unsigned long lastread_tcs34725=0;
#define TCS34725_MINLUXFORCT 30 //send only colortemperature values if lux is at least this high
#endif #endif
#ifdef SENSOR_ANEMOMETER #ifdef SENSOR_ANEMOMETER
@ -912,7 +911,11 @@ void loop_TCS34725_colortemp()
checkESPStatus(); checkESPStatus();
Homie.getLogger() << "colortemp tcs " << ": " << value_colortemp << endl; Homie.getLogger() << "colortemp tcs " << ": " << value_colortemp << endl;
if (tcs.lux>=TCS34725_MINLUXFORCT) {
sensorNode.setProperty("colortemp").send(String(value_colortemp)); sensorNode.setProperty("colortemp").send(String(value_colortemp));
}else{
Homie.getLogger() << "didn't send tcs because light too low: " << tcs.lux << "lux" << endl;
}
d.lastsentvalue=value_colortemp; d.lastsentvalue=value_colortemp;