10 static const char *
const TAG =
"uptime.sensor";
13 const uint32_t ms =
millis();
14 const uint64_t ms_mask = (1ULL << 32) - 1ULL;
15 const uint32_t last_ms = this->
uptime_ & ms_mask;
17 this->
uptime_ += ms_mask + 1ULL;
18 ESP_LOGD(TAG,
"Detected roll-over \xf0\x9f\xa6\x84");
26 const uint64_t seconds_int = this->
uptime_ / 1000ULL;
27 const float seconds = float(seconds_int) + (this->
uptime_ % 1000ULL) / 1000.0f;
33 LOG_SENSOR(
"",
"Uptime Sensor",
this);
34 ESP_LOGCONFIG(TAG,
" Type: Seconds");
uint32_t IRAM_ATTR HOT millis()
std::string unique_id() override
void dump_config() override
float get_setup_priority() const override
std::string get_mac_address()
Get the device MAC address as a string, in lowercase hex notation.
void publish_state(float state)
Publish a new state to the front-end.
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Implementation of SPI Controller mode.