SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
system_info.cpp
Go to the documentation of this file.
1#include "system_info.h"
2
3#include "Arduino.h"
4#include <WiFi.h>
5#include "sensesp.h"
6
7namespace sensesp {
8
9void SystemHz::tick() { tick_count_++; }
10
11void SystemHz::update() {
12 // getting sporadic divide by 0 exceptions, no harm in skipping a loop.
13 if (elapsed_millis_ == 0) {
14 return;
15 }
16
17 output = (tick_count_ * 1000) / elapsed_millis_;
18
19 tick_count_ = 0;
20 elapsed_millis_ = 0;
21
22 this->notify();
23}
24
26 elapsed_millis_ = 0;
27
28 ReactESP::app->onTick([this]() { this->tick(); });
29 ReactESP::app->onRepeat(1000, [this]() { this->update(); });
30}
31
32void FreeMem::update() { this->emit(ESP.getFreeHeap()); }
33
35 ReactESP::app->onRepeat(1000, [this]() { this->update(); });
36}
37
38void Uptime::update() { this->emit(millis() / 1000.); }
39
41 ReactESP::app->onRepeat(1000, [this]() { this->update(); });
42}
43
44void IPAddrDev::update() { this->emit(WiFi.localIP().toString()); }
45
47 ReactESP::app->onRepeat(10000, [this]() { this->update(); });
48}
49
51 ReactESP::app->onRepeat(3000, [this]() { this->update(); });
52}
53
54void WiFiSignal::update() { this->emit(WiFi.RSSI()); }
55
56} // namespace sensesp
void start() override final
void start() override final
Construct a new transform based on a single function.
void start() override final
void start() override final
void emit(T new_value)
void start() override final