SensESP
3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
system_info.cpp
Go to the documentation of this file.
1
#include "
sensesp.h
"
2
3
#include "
system_info.h
"
4
5
#include <WiFi.h>
6
7
#include "Arduino.h"
8
9
namespace
sensesp
{
10
11
void
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
uint32_t current_tick_count_ =
event_loop
()->getTickCount();
18
output_
=
19
(current_tick_count_ -
last_tick_count_
) / (
elapsed_millis_
/ 1000.);
20
21
last_tick_count_
= current_tick_count_;
22
elapsed_millis_
= 0;
23
24
this->
notify
();
25
}
26
27
void
FreeMem::update
() { this->
emit
(ESP.getFreeHeap()); }
28
29
void
Uptime::update
() { this->
emit
(
static_cast<
double
>
(millis()) / 1000.); }
30
31
void
IPAddrDev::update
() { this->
emit
(WiFi.localIP().toString()); }
32
33
void
WiFiSignal::update
() { this->
emit
(WiFi.RSSI()); }
34
35
}
// namespace sensesp
sensesp::FreeMem::update
void update()
Definition
system_info.cpp:27
sensesp::IPAddrDev::update
void update()
Definition
system_info.cpp:31
sensesp::Observable::notify
void notify()
Definition
observable.h:23
sensesp::SystemHz::last_tick_count_
uint32_t last_tick_count_
Definition
system_info.h:56
sensesp::SystemHz::elapsed_millis_
elapsedMillis elapsed_millis_
Definition
system_info.h:57
sensesp::SystemHz::update
void update()
Definition
system_info.cpp:11
sensesp::Uptime::update
void update()
Definition
system_info.cpp:29
sensesp::ValueProducer< uint32_t >::emit
void emit(const uint32_t &new_value)
Definition
valueproducer.h:91
sensesp::ValueProducer< float >::output_
float output_
Definition
valueproducer.h:101
sensesp::WiFiSignal::update
void update()
Definition
system_info.cpp:33
sensesp
Definition
sensesp.cpp:7
sensesp::event_loop
std::shared_ptr< reactesp::EventLoop > event_loop()
Definition
sensesp.cpp:9
sensesp.h
system_info.h
src
sensesp
sensors
system_info.cpp
Generated by
1.12.0