mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 23:18:10 +01:00
Prepare debug and logger component to work with idf 5.0 (#5036)
This commit is contained in:
parent
25b9bde0a5
commit
87c0f48095
2 changed files with 10 additions and 8 deletions
|
@ -5,6 +5,7 @@
|
||||||
#include "esphome/core/hal.h"
|
#include "esphome/core/hal.h"
|
||||||
#include "esphome/core/helpers.h"
|
#include "esphome/core/helpers.h"
|
||||||
#include "esphome/core/version.h"
|
#include "esphome/core/version.h"
|
||||||
|
#include <cinttypes>
|
||||||
|
|
||||||
#ifdef USE_ESP32
|
#ifdef USE_ESP32
|
||||||
|
|
||||||
|
@ -13,6 +14,7 @@
|
||||||
|
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
#include <esp32/rom/rtc.h>
|
#include <esp32/rom/rtc.h>
|
||||||
|
#include <esp_chip_info.h>
|
||||||
#else
|
#else
|
||||||
#include <rom/rtc.h>
|
#include <rom/rtc.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -61,7 +63,7 @@ void DebugComponent::dump_config() {
|
||||||
device_info += ESPHOME_VERSION;
|
device_info += ESPHOME_VERSION;
|
||||||
|
|
||||||
this->free_heap_ = get_free_heap();
|
this->free_heap_ = get_free_heap();
|
||||||
ESP_LOGD(TAG, "Free Heap Size: %u bytes", this->free_heap_);
|
ESP_LOGD(TAG, "Free Heap Size: %" PRIu32 " bytes", this->free_heap_);
|
||||||
|
|
||||||
#ifdef USE_ARDUINO
|
#ifdef USE_ARDUINO
|
||||||
const char *flash_mode;
|
const char *flash_mode;
|
||||||
|
@ -289,7 +291,7 @@ void DebugComponent::loop() {
|
||||||
uint32_t new_free_heap = get_free_heap();
|
uint32_t new_free_heap = get_free_heap();
|
||||||
if (new_free_heap < this->free_heap_ / 2) {
|
if (new_free_heap < this->free_heap_ / 2) {
|
||||||
this->free_heap_ = new_free_heap;
|
this->free_heap_ = new_free_heap;
|
||||||
ESP_LOGD(TAG, "Free Heap Size: %u bytes", this->free_heap_);
|
ESP_LOGD(TAG, "Free Heap Size: %" PRIu32 " bytes", this->free_heap_);
|
||||||
this->status_momentary_warning("heap", 1000);
|
this->status_momentary_warning("heap", 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ void HOT Scheduler::set_timeout(Component *component, const std::string &name, u
|
||||||
if (timeout == SCHEDULER_DONT_RUN)
|
if (timeout == SCHEDULER_DONT_RUN)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ESP_LOGVV(TAG, "set_timeout(name='%s', timeout=%u)", name.c_str(), timeout);
|
ESP_LOGVV(TAG, "set_timeout(name='%s', timeout=%" PRIu32 ")", name.c_str(), timeout);
|
||||||
|
|
||||||
auto item = make_unique<SchedulerItem>();
|
auto item = make_unique<SchedulerItem>();
|
||||||
item->component = component;
|
item->component = component;
|
||||||
|
@ -60,7 +60,7 @@ void HOT Scheduler::set_interval(Component *component, const std::string &name,
|
||||||
if (interval != 0)
|
if (interval != 0)
|
||||||
offset = (random_uint32() % interval) / 2;
|
offset = (random_uint32() % interval) / 2;
|
||||||
|
|
||||||
ESP_LOGVV(TAG, "set_interval(name='%s', interval=%u, offset=%u)", name.c_str(), interval, offset);
|
ESP_LOGVV(TAG, "set_interval(name='%s', interval=%" PRIu32 ", offset=%" PRIu32 ")", name.c_str(), interval, offset);
|
||||||
|
|
||||||
auto item = make_unique<SchedulerItem>();
|
auto item = make_unique<SchedulerItem>();
|
||||||
item->component = component;
|
item->component = component;
|
||||||
|
@ -108,8 +108,8 @@ void HOT Scheduler::set_retry(Component *component, const std::string &name, uin
|
||||||
if (initial_wait_time == SCHEDULER_DONT_RUN)
|
if (initial_wait_time == SCHEDULER_DONT_RUN)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ESP_LOGVV(TAG, "set_retry(name='%s', initial_wait_time=%u, max_attempts=%u, backoff_factor=%0.1f)", name.c_str(),
|
ESP_LOGVV(TAG, "set_retry(name='%s', initial_wait_time=%" PRIu32 ", max_attempts=%u, backoff_factor=%0.1f)",
|
||||||
initial_wait_time, max_attempts, backoff_increase_factor);
|
name.c_str(), initial_wait_time, max_attempts, backoff_increase_factor);
|
||||||
|
|
||||||
if (backoff_increase_factor < 0.0001) {
|
if (backoff_increase_factor < 0.0001) {
|
||||||
ESP_LOGE(TAG,
|
ESP_LOGE(TAG,
|
||||||
|
@ -222,8 +222,8 @@ void HOT Scheduler::call() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ESPHOME_LOG_HAS_VERY_VERBOSE
|
#ifdef ESPHOME_LOG_HAS_VERY_VERBOSE
|
||||||
ESP_LOGVV(TAG, "Running %s '%s' with interval=%u last_execution=%u (now=%u)", item->get_type_str(),
|
ESP_LOGVV(TAG, "Running %s '%s' with interval=%" PRIu32 " last_execution=%" PRIu32 " (now=%" PRIu32 ")",
|
||||||
item->name.c_str(), item->interval, item->last_execution, now);
|
item->get_type_str(), item->name.c_str(), item->interval, item->last_execution, now);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Warning: During callback(), a lot of stuff can happen, including:
|
// Warning: During callback(), a lot of stuff can happen, including:
|
||||||
|
|
Loading…
Reference in a new issue