15static const char *
const TAG =
"scheduler";
24static constexpr size_t MAX_POOL_SIZE = 5;
29static constexpr uint32_t MAX_LOGICALLY_DELETED_ITEMS = 5;
31static constexpr uint32_t MAX_INTERVAL_DELAY = 5000;
33#if defined(ESPHOME_LOG_HAS_VERBOSE) || defined(ESPHOME_DEBUG_SCHEDULER)
37struct SchedulerNameLog {
42 const char *
format(Scheduler::NameType name_type,
const char *static_name,
uint32_t hash_or_id) {
43 using NameType = Scheduler::NameType;
44 if (name_type == NameType::STATIC_STRING) {
48 ESPHOME_strncpy_P(buffer, ESPHOME_PSTR(
"(null)"),
sizeof(buffer));
50 }
else if (name_type == NameType::HASHED_STRING) {
51 ESPHOME_snprintf_P(buffer,
sizeof(buffer), ESPHOME_PSTR(
"hash:0x%08" PRIX32), hash_or_id);
53 }
else if (name_type == NameType::NUMERIC_ID) {
54 ESPHOME_snprintf_P(buffer,
sizeof(buffer), ESPHOME_PSTR(
"id:%" PRIu32), hash_or_id);
57 ESPHOME_snprintf_P(buffer,
sizeof(buffer), ESPHOME_PSTR(
"iid:%" PRIu32), hash_or_id);
67#ifdef ESPHOME_DEBUG_SCHEDULER
69static void validate_static_string(
const char *name) {
75 uintptr_t addr =
reinterpret_cast<uintptr_t
>(name);
79 uintptr_t stack_addr =
reinterpret_cast<uintptr_t
>(&stack_var);
83 if (addr > (stack_addr - 0x2000) && addr < (stack_addr + 0x2000)) {
85 "WARNING: Scheduler name '%s' at %p appears to be on the stack - this is unsafe!\n"
86 " Stack reference at %p",
87 name, name, &stack_var);
92 static const char *static_str =
"test";
93 uintptr_t static_addr =
reinterpret_cast<uintptr_t
>(static_str);
96 if (addr > static_addr + 0x100000 || (static_addr > 0x100000 && addr < static_addr - 0x100000)) {
97 ESP_LOGW(TAG,
"WARNING: Scheduler name '%s' at %p might be on heap (static ref at %p)", name, name, static_str);
110 uint32_t max_offset = std::min(
delay / 2, MAX_INTERVAL_DELAY);
118bool Scheduler::is_retry_cancelled_locked_(Component *
component, NameType name_type,
const char *static_name,
120 for (
auto *container : {&this->items_, &this->to_add_}) {
121 for (
auto *item : *container) {
122 if (item !=
nullptr && this->is_item_removed_locked_(item) &&
123 this->matches_item_locked_(item,
component, name_type, static_name, hash_or_id, SchedulerItem::TIMEOUT,
134void HOT Scheduler::set_timer_common_(Component *
component, SchedulerItem::Type
type, NameType name_type,
136 std::function<
void()> &&func,
bool is_retry,
bool skip_cancel) {
140 LockGuard guard{this->lock_};
141 this->cancel_item_locked_(
component, name_type, static_name, hash_or_id,
type,
false,
148 LockGuard guard{this->lock_};
153 if (is_retry &&
delay != 0 && (name_type != NameType::STATIC_STRING || static_name !=
nullptr) &&
154 type == SchedulerItem::TIMEOUT &&
155 this->is_retry_cancelled_locked_(
component, name_type, static_name, hash_or_id)) {
156#ifdef ESPHOME_DEBUG_SCHEDULER
157 SchedulerNameLog skip_name_log;
158 ESP_LOGD(TAG,
"Skipping retry '%s' - found cancelled item",
159 skip_name_log.format(name_type, static_name, hash_or_id));
165 SchedulerItem *item = this->get_item_from_pool_locked_();
167 item->set_name(name_type, static_name, hash_or_id);
174 item->callback.~function();
175 new (&item->callback) std::function<
void()>(std::move(func));
177 this->set_item_removed_(item,
false);
178 item->is_retry = is_retry;
182 auto *target = &this->to_add_;
184#ifndef ESPHOME_THREAD_SINGLE
187 if (
delay == 0 &&
type == SchedulerItem::TIMEOUT) {
189 target = &this->defer_queue_;
197 if (
type == SchedulerItem::INTERVAL) {
198 item->interval =
delay;
201 item->set_next_execution(now_64 + offset);
202#ifdef ESPHOME_LOG_HAS_VERBOSE
203 SchedulerNameLog name_log;
204 ESP_LOGV(TAG,
"Scheduler interval for %s is %" PRIu32
"ms, offset %" PRIu32
"ms",
205 name_log.format(name_type, static_name, hash_or_id),
delay, offset);
209 item->set_next_execution(now_64 +
delay);
212#ifdef ESPHOME_DEBUG_SCHEDULER
213 this->debug_log_timer_(item, name_type, static_name, hash_or_id,
type,
delay, now_64);
219 if (!skip_cancel && (name_type != NameType::STATIC_STRING || static_name !=
nullptr)) {
220 this->cancel_item_locked_(
component, name_type, static_name, hash_or_id,
type,
false,
223 target->push_back(item);
224 if (target == &this->to_add_) {
225 this->to_add_count_increment_();
227#ifndef ESPHOME_THREAD_SINGLE
229 this->defer_count_increment_();
234void HOT Scheduler::set_timeout(Component *
component,
const char *name,
uint32_t timeout,
235 std::function<
void()> &&func) {
236 this->set_timer_common_(
component, SchedulerItem::TIMEOUT, NameType::STATIC_STRING, name, 0, timeout,
240void HOT Scheduler::set_timeout(Component *
component,
const std::string &name,
uint32_t timeout,
241 std::function<
void()> &&func) {
242 this->set_timer_common_(
component, SchedulerItem::TIMEOUT, NameType::HASHED_STRING,
nullptr,
fnv1a_hash(name),
243 timeout, std::move(func));
246 this->set_timer_common_(
component, SchedulerItem::TIMEOUT, NameType::NUMERIC_ID,
nullptr,
id, timeout,
249bool HOT Scheduler::cancel_timeout(Component *
component,
const std::string &name) {
250 return this->cancel_item_(
component, NameType::HASHED_STRING,
nullptr,
fnv1a_hash(name), SchedulerItem::TIMEOUT);
252bool HOT Scheduler::cancel_timeout(Component *
component,
const char *name) {
253 return this->cancel_item_(
component, NameType::STATIC_STRING, name, 0, SchedulerItem::TIMEOUT);
256 return this->cancel_item_(
component, NameType::NUMERIC_ID,
nullptr,
id, SchedulerItem::TIMEOUT);
258void HOT Scheduler::set_interval(Component *
component,
const std::string &name,
uint32_t interval,
259 std::function<
void()> &&func) {
260 this->set_timer_common_(
component, SchedulerItem::INTERVAL, NameType::HASHED_STRING,
nullptr,
fnv1a_hash(name),
261 interval, std::move(func));
264void HOT Scheduler::set_interval(Component *
component,
const char *name,
uint32_t interval,
265 std::function<
void()> &&func) {
266 this->set_timer_common_(
component, SchedulerItem::INTERVAL, NameType::STATIC_STRING, name, 0, interval,
270 this->set_timer_common_(
component, SchedulerItem::INTERVAL, NameType::NUMERIC_ID,
nullptr,
id, interval,
273bool HOT Scheduler::cancel_interval(Component *
component,
const std::string &name) {
274 return this->cancel_item_(
component, NameType::HASHED_STRING,
nullptr,
fnv1a_hash(name), SchedulerItem::INTERVAL);
276bool HOT Scheduler::cancel_interval(Component *
component,
const char *name) {
277 return this->cancel_item_(
component, NameType::STATIC_STRING, name, 0, SchedulerItem::INTERVAL);
280 return this->cancel_item_(
component, NameType::NUMERIC_ID,
nullptr,
id, SchedulerItem::INTERVAL);
285#pragma GCC diagnostic push
286#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
292 Scheduler *scheduler;
295 const char *static_name;
299 float backoff_increase_factor;
300 Scheduler::NameType name_type;
301 uint8_t retry_countdown;
311 const char *static_name = (
args->name_type == Scheduler::NameType::STATIC_STRING) ?
args->name_.static_name :
nullptr;
312 uint32_t hash_or_id = (
args->name_type != Scheduler::NameType::STATIC_STRING) ?
args->name_.hash_or_id : 0;
313 args->scheduler->set_timer_common_(
314 args->component, Scheduler::SchedulerItem::TIMEOUT,
args->name_type, static_name, hash_or_id,
315 args->current_interval, [
args]() { retry_handler(args); },
318 args->current_interval *=
args->backoff_increase_factor;
321void HOT Scheduler::set_retry_common_(Component *
component, NameType name_type,
const char *static_name,
323 std::function<
RetryResult(uint8_t)> func,
float backoff_increase_factor) {
324 this->cancel_retry_(
component, name_type, static_name, hash_or_id);
329#ifdef ESPHOME_LOG_HAS_VERY_VERBOSE
331 SchedulerNameLog name_log;
332 ESP_LOGVV(TAG,
"set_retry(name='%s', initial_wait_time=%" PRIu32
", max_attempts=%u, backoff_factor=%0.1f)",
333 name_log.format(name_type, static_name, hash_or_id), initial_wait_time, max_attempts,
334 backoff_increase_factor);
338 if (backoff_increase_factor < 0.0001) {
339 ESP_LOGE(TAG,
"set_retry: backoff_factor %0.1f too small, using 1.0: %s", backoff_increase_factor,
340 (name_type == NameType::STATIC_STRING && static_name) ? static_name :
"");
341 backoff_increase_factor = 1;
344 auto args = std::make_shared<RetryArgs>();
345 args->func = std::move(func);
347 args->scheduler =
this;
348 args->name_type = name_type;
349 if (name_type == NameType::STATIC_STRING) {
350 args->name_.static_name = static_name;
352 args->name_.hash_or_id = hash_or_id;
354 args->current_interval = initial_wait_time;
356 args->retry_countdown = max_attempts;
359 this->set_timer_common_(
364void HOT Scheduler::set_retry(Component *
component,
const char *name,
uint32_t initial_wait_time, uint8_t max_attempts,
365 std::function<
RetryResult(uint8_t)> func,
float backoff_increase_factor) {
366 this->set_retry_common_(
component, NameType::STATIC_STRING, name, 0, initial_wait_time, max_attempts, std::move(func),
367 backoff_increase_factor);
370bool HOT Scheduler::cancel_retry_(Component *
component, NameType name_type,
const char *static_name,
372 return this->cancel_item_(
component, name_type, static_name, hash_or_id, SchedulerItem::TIMEOUT,
375bool HOT Scheduler::cancel_retry(Component *
component,
const char *name) {
376 return this->cancel_retry_(
component, NameType::STATIC_STRING, name, 0);
379void HOT Scheduler::set_retry(Component *
component,
const std::string &name,
uint32_t initial_wait_time,
380 uint8_t max_attempts, std::function<
RetryResult(uint8_t)> func,
381 float backoff_increase_factor) {
382 this->set_retry_common_(
component, NameType::HASHED_STRING,
nullptr,
fnv1a_hash(name), initial_wait_time,
383 max_attempts, std::move(func), backoff_increase_factor);
386bool HOT Scheduler::cancel_retry(Component *
component,
const std::string &name) {
391 std::function<
RetryResult(uint8_t)> func,
float backoff_increase_factor) {
392 this->set_retry_common_(
component, NameType::NUMERIC_ID,
nullptr,
id, initial_wait_time, max_attempts,
393 std::move(func), backoff_increase_factor);
397 return this->cancel_retry_(
component, NameType::NUMERIC_ID,
nullptr,
id);
400#pragma GCC diagnostic pop
402optional<uint32_t> HOT Scheduler::next_schedule_in(
uint32_t now) {
408 if (!this->cleanup_())
411 SchedulerItem *item = this->items_[0];
412 const auto now_64 = this->millis_64_from_(now);
413 const uint64_t next_exec = item->get_next_execution();
414 if (next_exec < now_64)
416 return next_exec - now_64;
419void Scheduler::full_cleanup_removed_items_() {
425 LockGuard guard{this->lock_};
429 for (
size_t read = 0; read < this->items_.size(); ++read) {
430 if (!is_item_removed_locked_(this->items_[read])) {
432 this->items_[write] = this->items_[read];
436 this->recycle_item_main_loop_(this->items_[read]);
439 this->items_.erase(this->items_.begin() + write, this->items_.end());
441 std::make_heap(this->items_.begin(), this->items_.end(), SchedulerItem::cmp);
442 this->to_remove_clear_();
445#ifndef ESPHOME_THREAD_SINGLE
446void Scheduler::compact_defer_queue_locked_() {
458 size_t remaining = this->defer_queue_.size() - this->defer_queue_front_;
459 for (
size_t i = 0; i < remaining; i++) {
460 this->defer_queue_[i] = this->defer_queue_[this->defer_queue_front_ + i];
464 this->defer_queue_.erase(this->defer_queue_.begin() + remaining, this->defer_queue_.end());
466void HOT Scheduler::process_defer_queue_slow_path_(
uint32_t &now) {
491 this->defer_count_clear_();
492 size_t defer_queue_end = this->defer_queue_.size();
493 if (this->defer_queue_front_ >= defer_queue_end) {
494 this->lock_.unlock();
497 while (this->defer_queue_front_ < defer_queue_end) {
503 item = this->defer_queue_[this->defer_queue_front_];
504 this->defer_queue_[this->defer_queue_front_] =
nullptr;
505 this->defer_queue_front_++;
506 this->lock_.unlock();
510 if (!this->should_skip_item_(item)) {
511 now = this->execute_item_(item, now);
515 this->recycle_item_main_loop_(item);
518 this->cleanup_defer_queue_locked_();
519 this->lock_.unlock();
523void HOT Scheduler::call(
uint32_t now) {
524#ifndef ESPHOME_THREAD_SINGLE
525 this->process_defer_queue_(now);
529 const auto now_64 = this->millis_64_from_(now);
530 this->process_to_add();
533 bool has_added_items =
false;
535#ifdef ESPHOME_DEBUG_SCHEDULER
536 static uint64_t last_print = 0;
538 if (now_64 - last_print > 2000) {
540 std::vector<SchedulerItem *> old_items;
541 ESP_LOGD(TAG,
"Items: count=%zu, pool=%zu, now=%" PRIu64, this->items_.size(), this->scheduler_item_pool_.size(),
545 while (!this->items_.empty()) {
548 LockGuard guard{this->lock_};
549 item = this->pop_raw_locked_();
552 SchedulerNameLog name_log;
553 bool is_cancelled = is_item_removed_(item);
554 ESP_LOGD(TAG,
" %s '%s/%s' interval=%" PRIu32
" next_execution in %" PRIu64
"ms at %" PRIu64
"%s",
555 item->get_type_str(), LOG_STR_ARG(item->get_source()),
556 name_log.format(item->get_name_type(), item->get_name(), item->get_name_hash_or_id()), item->interval,
557 item->get_next_execution() - now_64, item->get_next_execution(), is_cancelled ?
" [CANCELLED]" :
"");
559 old_items.push_back(item);
564 LockGuard guard{this->lock_};
565 this->items_ = std::move(old_items);
567 std::make_heap(this->items_.begin(), this->items_.end(), SchedulerItem::cmp);
578 if (this->to_remove_count_() >= MAX_LOGICALLY_DELETED_ITEMS) {
579 this->full_cleanup_removed_items_();
587 while (!this->items_.empty()) {
589 SchedulerItem *item = this->items_[0];
590 if (item->get_next_execution() > now_64) {
595 if (item->component !=
nullptr && item->component->is_failed()) {
596 LockGuard guard{this->lock_};
597 this->recycle_item_main_loop_(this->pop_raw_locked_());
605#ifdef ESPHOME_THREAD_MULTI_NO_ATOMICS
608 LockGuard guard{this->lock_};
609 if (is_item_removed_locked_(item)) {
610 this->recycle_item_main_loop_(this->pop_raw_locked_());
611 this->to_remove_decrement_();
617 if (is_item_removed_(item)) {
618 LockGuard guard{this->lock_};
619 this->recycle_item_main_loop_(this->pop_raw_locked_());
620 this->to_remove_decrement_();
625#ifdef ESPHOME_DEBUG_SCHEDULER
627 SchedulerNameLog name_log;
628 ESP_LOGV(TAG,
"Running %s '%s/%s' with interval=%" PRIu32
" next_execution=%" PRIu64
" (now=%" PRIu64
")",
629 item->get_type_str(), LOG_STR_ARG(item->get_source()),
630 name_log.format(item->get_name_type(), item->get_name(), item->get_name_hash_or_id()), item->interval,
631 item->get_next_execution(), now_64);
638 now = this->execute_item_(item, now);
640 LockGuard guard{this->lock_};
644 SchedulerItem *executed_item = this->pop_raw_locked_();
646 if (this->is_item_removed_locked_(executed_item)) {
648 this->to_remove_decrement_();
649 this->recycle_item_main_loop_(executed_item);
653 if (executed_item->type == SchedulerItem::INTERVAL) {
654 executed_item->set_next_execution(now_64 + executed_item->interval);
665 this->items_.push_back(executed_item);
666 std::push_heap(this->items_.begin(), this->items_.end(), SchedulerItem::cmp);
669 this->recycle_item_main_loop_(executed_item);
672 has_added_items |= !this->to_add_.empty();
675 if (has_added_items) {
676 this->process_to_add();
679#ifdef ESPHOME_DEBUG_SCHEDULER
689 LockGuard guard{this->lock_};
690 this->debug_verify_no_leak_();
694void HOT Scheduler::process_to_add_slow_path_() {
695 LockGuard guard{this->lock_};
696 for (
auto *&it : this->to_add_) {
697 if (is_item_removed_locked_(it)) {
699 this->recycle_item_main_loop_(it);
704 this->items_.push_back(it);
705 std::push_heap(this->items_.begin(), this->items_.end(), SchedulerItem::cmp);
707 this->to_add_.clear();
708 this->to_add_count_clear_();
710bool HOT Scheduler::cleanup_slow_path_() {
719 LockGuard guard{this->lock_};
720 while (!this->items_.empty()) {
721 SchedulerItem *item = this->items_[0];
722 if (!this->is_item_removed_locked_(item))
724 this->to_remove_decrement_();
725 this->recycle_item_main_loop_(this->pop_raw_locked_());
727 return !this->items_.empty();
729Scheduler::SchedulerItem *HOT Scheduler::pop_raw_locked_() {
730 std::pop_heap(this->items_.begin(), this->items_.end(), SchedulerItem::cmp);
732 SchedulerItem *item = this->items_.back();
733 this->items_.pop_back();
740 WarnIfComponentBlockingGuard guard{item->component, now};
742 return guard.finish();
746bool HOT Scheduler::cancel_item_(Component *
component, NameType name_type,
const char *static_name,
uint32_t hash_or_id,
747 SchedulerItem::Type
type,
bool match_retry) {
748 LockGuard guard{this->lock_};
751 return this->cancel_item_locked_(
component, name_type, static_name, hash_or_id,
type, match_retry);
760size_t Scheduler::mark_matching_items_removed_slow_locked_(std::vector<SchedulerItem *> &container,
761 Component *
component, NameType name_type,
762 const char *static_name,
uint32_t hash_or_id,
763 SchedulerItem::Type
type,
bool match_retry,
766 for (
auto *item : container) {
767 if (this->matches_item_locked_(item,
component, name_type, static_name, hash_or_id,
type, match_retry)) {
768 this->set_item_removed_(item,
true);
777bool HOT Scheduler::cancel_item_locked_(Component *
component, NameType name_type,
const char *static_name,
778 uint32_t hash_or_id, SchedulerItem::Type
type,
bool match_retry,
781 if (name_type == NameType::STATIC_STRING && static_name ==
nullptr) {
785 size_t total_cancelled = 0;
787#ifndef ESPHOME_THREAD_SINGLE
789 if (
type == SchedulerItem::TIMEOUT) {
790 total_cancelled += this->mark_matching_items_removed_locked_(this->defer_queue_,
component, name_type, static_name,
791 hash_or_id,
type, match_retry, find_first);
792 if (find_first && total_cancelled > 0)
803 size_t heap_cancelled = this->mark_matching_items_removed_locked_(this->items_,
component, name_type, static_name,
804 hash_or_id,
type, match_retry, find_first);
805 total_cancelled += heap_cancelled;
806 this->to_remove_add_(heap_cancelled);
807 if (find_first && total_cancelled > 0)
812 total_cancelled += this->mark_matching_items_removed_locked_(this->to_add_,
component, name_type, static_name,
813 hash_or_id,
type, match_retry, find_first);
815 return total_cancelled > 0;
818bool HOT Scheduler::SchedulerItem::cmp(SchedulerItem *a, SchedulerItem *b) {
821 return (a->next_execution_high_ ==
b->next_execution_high_) ? (a->next_execution_low_ >
b->next_execution_low_)
822 : (a->next_execution_high_ >
b->next_execution_high_);
829void Scheduler::recycle_item_main_loop_(SchedulerItem *item) {
833 if (this->scheduler_item_pool_.size() < MAX_POOL_SIZE) {
835 item->callback =
nullptr;
836 this->scheduler_item_pool_.push_back(item);
837#ifdef ESPHOME_DEBUG_SCHEDULER
838 ESP_LOGD(TAG,
"Recycled item to pool (pool size now: %zu)", this->scheduler_item_pool_.size());
841#ifdef ESPHOME_DEBUG_SCHEDULER
842 ESP_LOGD(TAG,
"Pool full (size: %zu), deleting item", this->scheduler_item_pool_.size());
845#ifdef ESPHOME_DEBUG_SCHEDULER
846 this->debug_live_items_--;
851#ifdef ESPHOME_DEBUG_SCHEDULER
852void Scheduler::debug_log_timer_(
const SchedulerItem *item, NameType name_type,
const char *static_name,
855 if (name_type == NameType::STATIC_STRING && static_name !=
nullptr) {
856 validate_static_string(static_name);
860 SchedulerNameLog name_log;
861 const char *type_str = (
type == SchedulerItem::TIMEOUT) ?
"timeout" :
"interval";
862 if (
type == SchedulerItem::TIMEOUT) {
863 ESP_LOGD(TAG,
"set_%s(name='%s/%s', %s=%" PRIu32
")", type_str, LOG_STR_ARG(item->get_source()),
864 name_log.format(name_type, static_name, hash_or_id), type_str,
delay);
866 ESP_LOGD(TAG,
"set_%s(name='%s/%s', %s=%" PRIu32
", offset=%" PRIu32
")", type_str, LOG_STR_ARG(item->get_source()),
867 name_log.format(name_type, static_name, hash_or_id), type_str,
delay,
868 static_cast<uint32_t>(item->get_next_execution() - now));
875Scheduler::SchedulerItem *Scheduler::get_item_from_pool_locked_() {
876 if (!this->scheduler_item_pool_.empty()) {
877 SchedulerItem *item = this->scheduler_item_pool_.back();
878 this->scheduler_item_pool_.pop_back();
879#ifdef ESPHOME_DEBUG_SCHEDULER
880 ESP_LOGD(TAG,
"Reused item from pool (pool size now: %zu)", this->scheduler_item_pool_.size());
884#ifdef ESPHOME_DEBUG_SCHEDULER
885 ESP_LOGD(TAG,
"Allocated new item (pool empty)");
887 auto *item =
new SchedulerItem();
888#ifdef ESPHOME_DEBUG_SCHEDULER
889 this->debug_live_items_++;
894#ifdef ESPHOME_DEBUG_SCHEDULER
895bool Scheduler::debug_verify_no_leak_()
const {
898 size_t accounted = this->items_.size() + this->to_add_.size() + this->scheduler_item_pool_.size();
899#ifndef ESPHOME_THREAD_SINGLE
900 accounted += this->defer_queue_.size();
902 if (accounted != this->debug_live_items_) {
904 "SCHEDULER LEAK DETECTED: live=%" PRIu32
" but accounted=%" PRIu32
" (items=%" PRIu32
" to_add=%" PRIu32
906#ifndef ESPHOME_THREAD_SINGLE
910 static_cast<uint32_t>(this->debug_live_items_),
static_cast<uint32_t>(accounted),
911 static_cast<uint32_t>(this->items_.size()),
static_cast<uint32_t>(this->to_add_.size()),
912 static_cast<uint32_t>(this->scheduler_item_pool_.size())
913#ifndef ESPHOME_THREAD_SINGLE
915 static_cast<uint32_t>(this->defer_queue_.size())
void set_current_component(Component *component)
ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std uint32_t uint8_t std::function< RetryResult(uint8_t)> float backoff_increase_factor
const Component * component
Providing packet encoding functions for exchanging data with a remote host.
const char int const __FlashStringHelper * format
void retry_handler(const std::shared_ptr< RetryArgs > &args)
const char int const __FlashStringHelper va_list args
uint32_t random_uint32()
Return a random 32-bit unsigned integer.
void HOT delay(uint32_t ms)
Application App
Global storage of Application pointer - only one Application can exist.
constexpr uint32_t fnv1a_hash(const char *str)
Calculate a FNV-1a hash of str.
constexpr uint32_t SCHEDULER_DONT_RUN