add tcs34725 lux correction factor

This commit is contained in:
interfisch 2020-11-14 17:38:54 +01:00
parent 5cea05e0be
commit ec3cee7db2
2 changed files with 5 additions and 1 deletions

View File

@ -38,6 +38,7 @@ build_flags =
-D dataTCS34725_lux_minchange=500 -D dataTCS34725_lux_minchange=500
-D dataTCS34725_lux_senddelaymax=1000*60*1 -D dataTCS34725_lux_senddelaymax=1000*60*1
-D dataTCS34725_colortemp_minchange=100 -D dataTCS34725_colortemp_minchange=100
-D TCS34725_LUXFACTOR=0.3 #measured with luxmeter. with half tennis ball was 1.7ev less. 1/2^1.7=0,3078
-D SENSOR_HS1101 -D SENSOR_HS1101
-D HS1101PIN=D5 -D HS1101PIN=D5

View File

@ -188,6 +188,9 @@ struct sensordata
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 #define TCS34725_MINLUXFORCT 30 //send only colortemperature values if lux is at least this high
#ifndef TCS34725_LUXFACTOR
#define TCS34725_LUXFACTOR 1
#endif
#endif #endif
#ifdef SENSOR_ANEMOMETER #ifdef SENSOR_ANEMOMETER
@ -892,7 +895,7 @@ 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; value_tcs_lux = tcs.lux*TCS34725_LUXFACTOR;
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;