ADC improvement & fix (#1314)

* fix when ADC_DIVIDER is defined
NEW multiple readings option

* publish at least every 1min

* define minimum pub adc interval
This commit is contained in:
Radim authored and GitHub committed 2022-11-10 06:21:05 -06:00
1 parent e8cb115602
commit d392964b90
2 files changed
+28 -4

No files matched your search

+8
View File
@@ -40,6 +40,14 @@ extern void ADCtoMQTT();
# define ThresholdReadingADC 50 // following the comparison between the previous value and the current one +- the threshold the value will be published or not
#endif
#if !defined(NumberOfReadingsADC) || (NumberOfReadingsADC < 1)
# define NumberOfReadingsADC 1 // number of readings for better accuracy: avg adc = sum of adc / num readings
#endif
#ifndef MinTimeInSecBetweenPublishingADC
# define MinTimeInSecBetweenPublishingADC 0 // pub at least at defined interval - usefull to publish values in case they do not change so much ; 0 = disabled
#endif
/*-------------------PIN DEFINITIONS----------------------*/
#if defined(ESP8266) || !defined(ADC_GPIO)
# define ADC_GPIO A0 //on nodeMCU this is D3 pin