SOC_MOD_CLK_APB does not exist in the soc_module_clk_t enum on
ESP32-C6, C5, H2, and P4 variants. Revert to esp_clk_apb_freq()
which works on all variants and is the same function the ESP-IDF
PCNT driver uses internally for glitch filter calculation.
The UDP component creates up to 2 sockets (broadcast + listen) but
did not register them with the socket consumption API. This could
cause CONFIG_LWIP_MAX_SOCKETS to be set too low on ESP32 IDF.
Closes https://github.com/esphome/esphome/issues/14031
Browsers open multiple concurrent connections for page resources, SSE
event streams, and POST requests for entity control. POST connections
may linger before closing, causing httpd_accept_conn errors (ENFILE)
when the socket pool is too small.
The reduction from 768 to 512 was overly aggressive - the stack
overflow was caused by the 1400+ byte multipart parser, not the
serialization buffer. 640 bytes covers climate DETAIL_ALL payloads
(~520 bytes) on the stack without heap fallback.
Payloads exceeding 1024 bytes are not known to exist in real
configurations. One doubling iteration covers all known entity types.
Cap at 4096 as a safety limit.
Avoids instantiating DummyWriter templates (~736 bytes flash) by
doubling the heap buffer until the payload fits. The temporary
over-allocation (at most 2x) is acceptable since payloads exceeding
the 512-byte stack buffer are rare.
Avoids instantiating DummyWriter templates (~736 bytes flash) by
doubling the heap buffer until the payload fits. The temporary
over-allocation (at most 2x) is acceptable since payloads exceeding
the 512-byte stack buffer are rare.
ArduinoJson's serializeJson() with a bounded buffer returns the actual
bytes written (truncated count), NOT the would-be size like snprintf().
When the payload exceeded the 512-byte stack buffer, the return value
was used as the exact size for heap reallocation, but this was only the
truncated count. The heap buffer was allocated too small, the second
serialization was also truncated, and no NUL terminator was written.
This caused corrupted JSON in SSE streams for entities with payloads
exceeding 512 bytes (e.g., climate DETAIL_ALL with many features).
Fix: use measureJson() in the heap fallback path to get the exact
untruncated size before allocating. Also add the missing set_size_()
call after the second serialization to ensure proper NUL termination.
Move min/max temperature and step traits into DETAIL_ALL block
so they are only sent once on initial connection instead of on
every state update. Rename keys from min_temperature/max_temperature
to min_temp/max_temp to match what the frontend expects.
Discovered while reviewing #14061.
feed_wdt() calls status_led::global_status_led->call() which is a
vtable dispatch into flash. arch_feed_wdt() calls esp_task_wdt_reset()
which is in .flash.text. Neither function can execute with the flash
cache disabled, so IRAM_ATTR provides no benefit.
Neither yield() nor delay() can be called from ISR context or during
flash operations. yield() calls vPortYield/::yield which are not
ISR-safe, and delay() calls vTaskDelay/::delay which block the calling
task. IRAM_ATTR was applied as a blanket attribute when the HAL
abstraction was created in 2021 (#2303) but was never actually needed
for these two functions.
Retains HOT attribute for compiler optimization hints.