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) {
105
105
// store a new value and update the total
106
106
void Child::_setValueNumber (double value) {
107
107
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
+ }
108
113
if (_value_processing != NONE) _total = _total + value;
109
114
// keep track of the samples
110
115
_samples++;
@@ -211,15 +216,12 @@ void Child::print(Print& device) {
211
216
void Child::reset () {
212
217
if (_format != STRING) {
213
218
if (_value_processing != NONE) {
214
- // reset the counters
215
- _total = 0 ;
216
- _value = 0 ;
217
219
#if NODEMANAGER_EEPROM == ON
218
220
// if the value is supposed to be persisted in EEPROM, save it
219
221
if (_persist_value) saveValue ();
220
222
#endif
221
223
}
222
- } else _value_string = " " ;
224
+ }
223
225
_samples = 0 ;
224
226
}
225
227
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class Display: public Sensor {
36
36
// prevent reporting to the gateway at each display update
37
37
setReportTimerMode (DO_NOT_REPORT);
38
38
// refresh the display every minute by default
39
- setMeasureTimerValue (TIME_INTERVAL);
39
+ setMeasureTimerMode (TIME_INTERVAL);
40
40
setMeasureTimerValue (60UL );
41
41
};
42
42
You can’t perform that action at this time.
0 commit comments