pn7160.h and pn7150.h are each included by 3 translation units,
so static const causes duplicate copies in each TU's literal pool.
constexpr allows the compiler to use immediate values instead.
These headers are included by multiple translation units, so
static const causes duplicate copies in each TU's literal pool.
constexpr allows the compiler to use immediate values instead.
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.