File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,11 @@ void Child::setValue(const char* value) {
105105// store a new value and update the total
106106void Child::_setValueNumber (double value) {
107107 if (isnan (value)) return ;
108+ // this is the first measure after a send(), reset _value and _total
109+ if (_samples == 0 ) {
110+ _value = 0 ;
111+ _total = 0 ;
112+ }
108113 if (_value_processing != NONE) _total = _total + value;
109114 // keep track of the samples
110115 _samples++;
@@ -211,15 +216,12 @@ void Child::print(Print& device) {
211216void Child::reset () {
212217 if (_format != STRING) {
213218 if (_value_processing != NONE) {
214- // reset the counters
215- _total = 0 ;
216- _value = 0 ;
217219#if NODEMANAGER_EEPROM == ON
218220 // if the value is supposed to be persisted in EEPROM, save it
219221 if (_persist_value) saveValue ();
220222#endif
221223 }
222- } else _value_string = " " ;
224+ }
223225 _samples = 0 ;
224226}
225227
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class Display: public Sensor {
3636 // prevent reporting to the gateway at each display update
3737 setReportTimerMode (DO_NOT_REPORT);
3838 // refresh the display every minute by default
39- setMeasureTimerValue (TIME_INTERVAL);
39+ setMeasureTimerMode (TIME_INTERVAL);
4040 setMeasureTimerValue (60UL );
4141 };
4242
You can’t perform that action at this time.
0 commit comments