SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
repeat_report.cpp
Go to the documentation of this file.
1#include "repeat_report.h"
2
3namespace sensesp {
4
5template <typename T>
7 last_update_interval_ = 0;
8 this->emit(input);
9}
10
11template <typename T>
14 ReactESP::app->onRepeat(10, [this]() {
15 if (max_silence_interval_ > 0 &&
16 last_update_interval_ > max_silence_interval_) {
17 this->last_update_interval_ = 0;
18 this->notify();
19 }
20 });
21}
22
23template <typename T>
25 root["max_silence_interval"] = max_silence_interval_;
26}
27
28static const char SCHEMA[] PROGMEM = R"###({
29 "type": "object",
30 "properties": {
31 "max_silence_interval": { "title": "Max ms interval until value repeated", "type": "number" }
32 }
33 })###";
34
35template <typename T>
39
40template <typename T>
42 String expected[] = {"max_silence_interval"};
43 for (auto str : expected) {
44 if (!config.containsKey(str)) {
45 return false;
46 }
47 }
48 this->max_silence_interval_ = config["max_silence_interval"];
49 return true;
50}
51
52// Force compiler to make versions for the common data types...
53template class RepeatReport<float>;
54template class RepeatReport<int>;
55template class RepeatReport<bool>;
56template class RepeatReport<String>;
57
58} // namespace sensesp
Construct a new transform based on a single function.
virtual bool set_configuration(const JsonObject &config) override
virtual void get_configuration(JsonObject &doc) override
virtual void set_input(T input, uint8_t inputChannel=0) override
virtual String get_config_schema() override
virtual void start() override
virtual void start()
Definition startable.h:28
void emit(T new_value)
const uint8_t PAGE_css_bootstrap[] PROGMEM