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

+2 -4
View File
@@ -28,7 +28,7 @@
*/
#ifdef ZsensorADC
#if defined(ESP8266) || defined(ESP32)
#if defined(ESP8266)
ADC_MODE(ADC_TOUT);
#endif
@@ -47,11 +47,9 @@ void MeasureADC(){
trc(F("Failed to read from ADC !"));
}else{
if(val >= persistedadc + ThresholdReadingADC || val <= persistedadc - ThresholdReadingADC){
char value[4];
sprintf(value, "%d", val);
trc(F("Sending analog value to MQTT"));
trc(String(val));
client.publish(ADC,value);
client.publish(ADC,String(val).c_str());
persistedadc = val;
}
}