| 
    muwerk Scheduler Library
    
   A low-resource cooperative scheduler with MQTT-like queues for Arduinos, ATtiny up to ESP32 
   | 
 
muwerk sensorprocessor class More...
#include <sensors.h>
Public Member Functions | |
| sensorprocessor (unsigned int smoothInterval=5, int unsigned pollTimeSec=60, double eps=0.1) | |
| bool | filter (double *pvalue) | 
| bool | filter (long *plvalue) | 
| void | reset () | 
| void | update (unsigned int _smoothInterval=5, int unsigned _pollTimeSec=60, double _eps=0.1) | 
muwerk sensorprocessor class
sensorprocessor implements an exponential filter that smoothens and throttles raw sensor data.
It can be configured by:
This library requires the ustd library (for timeDiff) and requires a platform define.
Example:
      
  | 
  inline | 
Creates a new sensorprocessor
| smoothInterval | The size of the interval of sensor value history that are being averaged using exponential decay. | 
| pollTimeSec | If this is !=0, a valid sensor reading is generated at least every pollTimeSec, regardless of value changes. | 
| eps | The minimal change required for the smoothed sensor value in order to create a new valid reading. Useful for supressing small fluctuations. | 
      
  | 
  inline | 
The sensorprocessor filter function. (double float version)
| *pvalue | the current raw sensor reading. The filter function uses exponential smoothing to filter the value and, if a valid new value is available, changes *pvalue. | 
      
  | 
  inline | 
The sensorprocessor filter function. (long integer version)
| *plvalue | the current raw sensor reading. The filter function uses exponential smoothing to filter the value and, if a valid new value is available, changes *plvalue. | 
      
  | 
  inline | 
Delete the filter history
      
  | 
  inline | 
Update filter parameters and reset.
Note: this is equivalent of recreating a new instance.
| _smoothInterval | The size of the interval of sensor value history that are being averaged using exponential decay. | 
| _pollTimeSec | If this is !=0, a valid sensor reading is generated at least every pollTimeSec, regardless of value changes. | 
| _eps | The minimal change required for the smoothed sensor value in order to create a new valid reading. Useful for supressing small fluctuations. |