mirror of
https://github.com/esphome/esphome.git
synced 2026-09-19 11:08:38 +00:00
Merge branch 'dev' into kamilcuk/use-placement-new
This commit is contained in:
@@ -28,7 +28,11 @@ def esp32_validate_gpio_pin(value: int) -> int:
|
||||
raise cv.Invalid(f"Invalid pin number: {value} (must be 0-39)")
|
||||
if value in _ESP_SDIO_PINS:
|
||||
raise cv.Invalid(
|
||||
f"This pin cannot be used on ESP32s and is already used by the flash interface (function: {_ESP_SDIO_PINS[value]})"
|
||||
f"This pin cannot be used on ESP32s and is already used by the flash interface"
|
||||
f" (function: {_ESP_SDIO_PINS[value]})."
|
||||
f" If you are using an ESP32 module that uses a different flash pin"
|
||||
f" configuration (e.g. ESP32-PICO-V3-02), you can set"
|
||||
f" 'ignore_pin_validation_error: true' to bypass this check."
|
||||
)
|
||||
if 9 <= value <= 10:
|
||||
_LOGGER.warning(
|
||||
|
||||
@@ -614,6 +614,7 @@ FILTER_SOURCE_FILES = filter_source_files_from_platform(
|
||||
PlatformFramework.RTL87XX_ARDUINO,
|
||||
PlatformFramework.LN882X_ARDUINO,
|
||||
},
|
||||
"task_log_buffer_zephyr.cpp": {PlatformFramework.NRF52_ZEPHYR},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/core/hal.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
@@ -8,8 +9,8 @@ namespace esphome::logger {
|
||||
// Maximum header size: 35 bytes fixed + 32 bytes tag + 16 bytes thread name = 83 bytes (45 byte safety margin)
|
||||
static constexpr uint16_t MAX_HEADER_SIZE = 128;
|
||||
|
||||
// ANSI color code last digit (30-38 range, store only last digit to save RAM)
|
||||
static constexpr char LOG_LEVEL_COLOR_DIGIT[] = {
|
||||
// ANSI color code last digit (30-38 range, store only last digit to save RAM on ESP8266)
|
||||
static const char LOG_LEVEL_COLOR_DIGIT[] PROGMEM = {
|
||||
'\0', // NONE
|
||||
'1', // ERROR (31 = red)
|
||||
'3', // WARNING (33 = yellow)
|
||||
@@ -20,7 +21,7 @@ static constexpr char LOG_LEVEL_COLOR_DIGIT[] = {
|
||||
'8', // VERY_VERBOSE (38 = white)
|
||||
};
|
||||
|
||||
static constexpr char LOG_LEVEL_LETTER_CHARS[] = {
|
||||
static const char LOG_LEVEL_LETTER_CHARS[] PROGMEM = {
|
||||
'\0', // NONE
|
||||
'E', // ERROR
|
||||
'W', // WARNING
|
||||
@@ -64,7 +65,7 @@ struct LogBuffer {
|
||||
*p++ = 'V'; // VERY_VERBOSE = "VV"
|
||||
*p++ = 'V';
|
||||
} else {
|
||||
*p++ = LOG_LEVEL_LETTER_CHARS[level];
|
||||
*p++ = static_cast<char>(progmem_read_byte(reinterpret_cast<const uint8_t *>(&LOG_LEVEL_LETTER_CHARS[level])));
|
||||
}
|
||||
}
|
||||
*p++ = ']';
|
||||
@@ -184,7 +185,7 @@ struct LogBuffer {
|
||||
*p++ = (level == 1) ? '1' : '0'; // Only ERROR is bold
|
||||
*p++ = ';';
|
||||
*p++ = '3';
|
||||
*p++ = LOG_LEVEL_COLOR_DIGIT[level];
|
||||
*p++ = static_cast<char>(progmem_read_byte(reinterpret_cast<const uint8_t *>(&LOG_LEVEL_COLOR_DIGIT[level])));
|
||||
*p++ = 'm';
|
||||
}
|
||||
// Copy string without null terminator, updates pointer in place
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "sht4x.h"
|
||||
#include "esphome/core/hal.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
|
||||
@@ -262,19 +262,6 @@ StringRef AsyncWebServerRequest::url_to(std::span<char, URL_BUF_SIZE> buffer) co
|
||||
return StringRef(buffer.data(), decoded_len);
|
||||
}
|
||||
|
||||
void AsyncWebServerRequest::send(AsyncWebServerResponse *response) {
|
||||
httpd_resp_send(*this, response->get_content_data(), response->get_content_size());
|
||||
}
|
||||
|
||||
void AsyncWebServerRequest::send(int code, const char *content_type, const char *content) {
|
||||
this->init_response_(nullptr, code, content_type);
|
||||
if (content) {
|
||||
httpd_resp_send(*this, content, HTTPD_RESP_USE_STRLEN);
|
||||
} else {
|
||||
httpd_resp_send(*this, nullptr, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void AsyncWebServerRequest::redirect(const std::string &url) {
|
||||
httpd_resp_set_status(*this, "302 Found");
|
||||
httpd_resp_set_hdr(*this, "Location", url.c_str());
|
||||
|
||||
@@ -134,8 +134,17 @@ class AsyncWebServerRequest {
|
||||
|
||||
void redirect(const std::string &url);
|
||||
|
||||
void send(AsyncWebServerResponse *response);
|
||||
void send(int code, const char *content_type = nullptr, const char *content = nullptr);
|
||||
inline void ESPHOME_ALWAYS_INLINE send(AsyncWebServerResponse *response) {
|
||||
httpd_resp_send(*this, response->get_content_data(), response->get_content_size());
|
||||
}
|
||||
inline void ESPHOME_ALWAYS_INLINE send(int code, const char *content_type = nullptr, const char *content = nullptr) {
|
||||
this->init_response_(nullptr, code, content_type);
|
||||
if (content) {
|
||||
httpd_resp_send(*this, content, HTTPD_RESP_USE_STRLEN);
|
||||
} else {
|
||||
httpd_resp_send(*this, nullptr, 0);
|
||||
}
|
||||
}
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
AsyncWebServerResponse *beginResponse(int code, const char *content_type) {
|
||||
auto *res = new AsyncWebServerResponseEmpty(this); // NOLINT(cppcoreguidelines-owning-memory)
|
||||
|
||||
@@ -322,7 +322,9 @@ template<typename... Ts> class Automation;
|
||||
template<typename... Ts> class Trigger {
|
||||
public:
|
||||
/// Inform the parent automation that the event has triggered.
|
||||
void trigger(const Ts &...x) {
|
||||
// Force-inline: collapses the Trigger→Automation→ActionList forwarding
|
||||
// chain into a single frame, reducing automation call stack depth.
|
||||
inline void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE {
|
||||
if (this->automation_parent_ == nullptr)
|
||||
return;
|
||||
this->automation_parent_->trigger(x...);
|
||||
@@ -429,7 +431,9 @@ template<typename... Ts> class ActionList {
|
||||
this->add_action(action);
|
||||
}
|
||||
}
|
||||
void play(const Ts &...x) {
|
||||
// Force-inline: part of the Trigger→Automation→ActionList forwarding
|
||||
// chain collapsed to reduce automation call stack depth.
|
||||
inline void play(const Ts &...x) ESPHOME_ALWAYS_INLINE {
|
||||
if (this->actions_begin_ != nullptr)
|
||||
this->actions_begin_->play_complex(x...);
|
||||
}
|
||||
@@ -473,7 +477,9 @@ template<typename... Ts> class Automation {
|
||||
|
||||
void stop() { this->actions_.stop(); }
|
||||
|
||||
void trigger(const Ts &...x) { this->actions_.play(x...); }
|
||||
// Force-inline: part of the Trigger→Automation→ActionList forwarding
|
||||
// chain collapsed to reduce automation call stack depth.
|
||||
inline void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE { this->actions_.play(x...); }
|
||||
|
||||
bool is_running() { return this->actions_.is_running(); }
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ esphome:
|
||||
|
||||
host:
|
||||
api:
|
||||
batch_delay: 0ms # Disable batching to receive all state updates
|
||||
logger:
|
||||
level: VERBOSE
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ esphome:
|
||||
|
||||
host:
|
||||
api:
|
||||
batch_delay: 0ms # Disable batching to receive all state updates
|
||||
logger:
|
||||
level: VERBOSE
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ esphome:
|
||||
|
||||
host:
|
||||
api:
|
||||
batch_delay: 0ms # Disable batching to receive all state updates
|
||||
logger:
|
||||
level: VERBOSE
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ esphome:
|
||||
|
||||
host:
|
||||
api:
|
||||
batch_delay: 0ms # Disable batching to receive all state updates
|
||||
logger:
|
||||
level: VERBOSE
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ esphome:
|
||||
|
||||
host:
|
||||
api:
|
||||
batch_delay: 0ms # Disable batching to receive all state updates
|
||||
logger:
|
||||
level: VERBOSE
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ esphome:
|
||||
|
||||
host:
|
||||
api:
|
||||
batch_delay: 0ms # Disable batching to receive all state updates
|
||||
logger:
|
||||
level: VERBOSE
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ esphome:
|
||||
|
||||
host:
|
||||
api:
|
||||
batch_delay: 0ms # Disable batching to receive all state updates
|
||||
logger:
|
||||
level: VERBOSE
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ esphome:
|
||||
|
||||
host:
|
||||
api:
|
||||
batch_delay: 0ms # Disable batching to receive all state updates
|
||||
logger:
|
||||
level: VERBOSE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user