Better sensors (#154)

* globally expose repeat functionality as advanced function

* implement repeated sends for Arduino based boards

* use String class instead of C-style arrays to benefit from dynamic allocation and avoid buffer overflows. Try to improve stability of BME280.

* replace sprintf with String class to avoid buffer overruns by dynamic allocation

* fix caps on variable

* re-add TSL2561 code that was accidentally removed
This commit is contained in:
Chris Broekema authored and Florian committed 2018-01-22 21:35:28 +01:00
1 parent 3613d011c6
commit ea1711b7f0
6 files changed
+35 -59

No files matched your search

+3 -9
View File
@@ -98,17 +98,11 @@ void MeasureLightIntensityTSL2561()
{
if (persisted_lux != event.light || tsl2561_always ) {
persisted_lux = event.light;
char lux[7];
char ftcd[7];
char wattsm2[7];
sprintf(lux, "%s", String(event.light).c_str());
sprintf(ftcd, "%s", String(event.light/10.764).c_str());
sprintf(wattsm2, "%s", String(event.light/683.0).c_str());
trc("Sending Light Intensity in Lux to MQTT " + String(event.light) + " lux");
client.publish(LUX, lux);
client.publish(FTCD, ftcd);
client.publish(WATTSM2, wattsm2);
client.publish(LUX, String(event.light).c_str());
client.publish(FTCD, String((event.light)/10.764).c_str());
client.publish(WATTSM2, String((event.light)/683.0).c_str());
} else {
trc("Same lux value, do not send");
}