SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
median.h
Go to the documentation of this file.
1#ifndef SENSESP_TRANSFORMS_MEDIAN_H_
2#define SENSESP_TRANSFORMS_MEDIAN_H_
3
4#include <vector>
5
7#include "transform.h"
8
9namespace sensesp {
10
21class Median : public FloatTransform {
22 public:
23 Median(unsigned int sample_size = 10, const String& config_path = "");
24 virtual void set(const float& input) override;
25 virtual bool to_json(JsonObject& root) override;
26 virtual bool from_json(const JsonObject& config) override;
27
28 private:
29 std::vector<float> buf_{};
30 unsigned int sample_size_;
31};
32
33const String ConfigSchema(const Median& obj);
34
35inline bool ConfigRequiresRestart(const Median& obj) {
36 return true;
37}
38
39} // namespace sensesp
40#endif
Outputs the median value of sample_size inputs.
Definition median.h:21
virtual void set(const float &input) override
Definition median.cpp:12
virtual bool from_json(const JsonObject &config) override
Definition median.cpp:29
virtual bool to_json(JsonObject &root) override
Definition median.cpp:24
Median(unsigned int sample_size=10, const String &config_path="")
Definition median.cpp:5
const String ConfigSchema(const SmartSwitchController &obj)
bool ConfigRequiresRestart(const HTTPServer &obj)