The SerializationBuffer introduced in #13625 places a 640-byte buffer
on the stack. When handling HTTP requests on the ESP-IDF httpd task
(which has a default stack of 4096 bytes), the deep call chain from
handleRequest through JSON serialization and lwip_send can overflow.
Increase the httpd task stack by 256 bytes to restore headroom.
Fixes#14991
time.h was missing #include "esphome/core/defines.h", so USE_TIME_TIMEZONE
was never defined when compiling time.cpp. Both functions always took the
#else path, returning 0 offset and treating local time as UTC.
When Callback::create receives a function reference (e.g. void(&)(int)),
&callable gives the address of the function's machine code, not a
pointer variable. The memcpy then reads bytes from executable code
memory instead of copying a function pointer value.
Fix by decaying the callable into a local variable before memcpy,
which converts function references to function pointers stored on
the stack.
No current callers trigger this bug (all pass lambdas), but this
prevents incorrect behavior if bare function names are ever passed.
Boards like rpipico2 (Raspberry Pi Pico 2) don't have WiFi hardware
but ESPHome allowed configuring wifi on them, leading to linker errors
from missing CYW43 driver symbols. Add validation to catch this at
config time with a clear error message.
- Add wifi detection to the board generator by checking for
PICO_CYW43_SUPPORTED=1 in upstream extra_flags
- Add validation in wifi component to reject non-WiFi RP2040 boards
Closes https://github.com/esphome/esphome/issues/14989
Add libretiny and zephyr to PLATFORM_SPECIFIC_COMPONENTS so they
are correctly filtered out when an incompatible platform is selected
for memory impact analysis. Previously, libretiny was missing from
the set, causing it to be included in esp32-idf builds and producing
a misleading comment showing both platforms.
message_name() returned bare string literals that stayed in RAM on
ESP8266. Change return type to const LogString * and wrap with LOG_STR()
so they are stored in flash. Update log_send_message_ to use
LOG_STR_ARG() accordingly.
Also fix clang-tidy: rename append_p_esp8266_ to append_p_esp8266,
add NOLINTNEXTLINE for conditionally-unused dump_field overloads.
message_name() returned bare string literals that stayed in RAM on
ESP8266. Change return type to const LogString * and wrap with LOG_STR()
so they are stored in flash. Update log_send_message_ to use
LOG_STR_ARG() accordingly.
Also fix clang-tidy: rename append_p_esp8266_ to append_p_esp8266,
add NOLINTNEXTLINE for conditionally-unused dump_field overloads.
All string literals in api_pb2_dump.cpp (field names, message names,
enum value names) were stored in rodata which occupies RAM on ESP8266.
This meant every API protobuf change appeared as a RAM increase in CI
when using very_verbose logging.
Add append_p() to DumpBuffer for PROGMEM-safe string reading and update
the code generator to wrap all dump string literals with ESPHOME_PSTR().
On non-ESP8266 platforms, these are no-ops with zero overhead.
Guard detection_range_to_log_string() with #if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_DEBUG
so it is compiled out when the log level is below DEBUG, matching its callers
(ESP_LOGD and ESP_LOGCONFIG) which are also compiled out at that level.
Fixes https://github.com/esphome/esphome/issues/14975
Move logger codegen priority above platform init so that
global_logger is set before setup_preferences() or any other
platform code that may contain ESP_LOG* calls.
Previously the logger initialized at DIAGNOSTICS priority (90),
which ran after PLATFORM (1000). With VERY_VERBOSE, the
ESP_LOGVV in ESP8266Preferences::setup() fired before
global_logger was set, causing a nullptr dereference crash.
Also hardcode `using namespace esphome;` in writer.py so it
precedes all variable declarations regardless of codegen
priority ordering.
Fixes#14970