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

+4 -8
View File
@@ -49,20 +49,16 @@ void MeasureTempAndHum(){
trc(F("Failed to read from DHT sensor!"));
}else{
if(h != persistedh || dht_always){
char hum[6];
dtostrf(h,4,2,hum);
trc(F("Sending Hum to MQTT"));
trc(String(hum));
client.publish(HUM1,hum);
trc(String(h));
client.publish(HUM1,String(h).c_str());
}else{
trc(F("Same hum don't send it"));
}
if(t != persistedt || dht_always){
char temp[6];
dtostrf(t,4,2,temp);
trc(F("Sending Temp to MQTT"));
trc(String(temp));
client.publish(TEMP1,temp);
trc(String(t));
client.publish(TEMP1, String(t).c_str());
}else{
trc(F("Same temp don't send it"));
}