This commit is contained in:
Tomasz Duda
2026-02-08 14:41:16 +01:00
parent 124e5d9898
commit 4bcb544beb
4 changed files with 5 additions and 3 deletions
+1
View File
@@ -623,6 +623,7 @@ class Logger : public Component {
// - Recursion from logging within logging is the main concern
// - Cross-task "recursion" is prevented by the buffer mutex anyway
// - Missing a recursive call from another task is acceptable (falls back to direct output)
//
// Zephyr use __thread as TLS
// Check if non-main task is already in recursion
@@ -6,7 +6,7 @@
namespace esphome::logger {
__thread bool non_main_task_recursion_guard_;
__thread bool non_main_task_recursion_guard_; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
static inline uint32_t get_wlen(const mpsc_pbuf_generic *item) {
auto *msg = reinterpret_cast<const TaskLogBufferZephyr::LogMessage *>(item);
@@ -68,7 +68,7 @@ bool TaskLogBufferZephyr::send_message_thread_safe(uint8_t level, const char *ta
// this shall not happened vsnprintf was called already once
// fill with '\n' to not call mpsc_pbuf_free from producer
// it will be trimmed anyway
for (uint16_t i = 0; i < text_length; ++i) {
for (size_t i = 0; i < text_length; ++i) {
text_area[i] = '\n';
}
text_area[text_length] = 0;
@@ -13,7 +13,7 @@ static constexpr size_t MAX_POINTER_REPRESENTATION = 2 + sizeof(void *) * 2 + 1;
#ifdef USE_ESPHOME_TASK_LOG_BUFFER
extern __thread bool non_main_task_recursion_guard_;
extern __thread bool non_main_task_recursion_guard_; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
class TaskLogBufferZephyr {
public:
+1
View File
@@ -320,6 +320,7 @@
#endif
#ifdef USE_NRF52
#define USE_ESPHOME_TASK_LOG_BUFFER
#define USE_NRF52_DFU
#define USE_NRF52_REG0_VOUT 5
#define USE_NRF52_UICR_ERASE