Commit Graph

22463 Commits

Author SHA1 Message Date
J. Nick Koston
4149b9e040 Merge remote-tracking branch 'upstream/dev' into integration 2026-02-13 08:41:18 -06:00
J. Nick Koston
b04e427f01 [usb_host] Extract cold path from loop(), replace std::string with buffer API (#13957)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-13 06:39:00 -06:00
J. Nick Koston
b669a8a20f Merge branch 'make-log-entity-icon-noop-without-icons' into integration 2026-02-12 18:34:16 -06:00
J. Nick Koston
80927f0f80 [core] Make LOG_ENTITY_ICON a no-op when icons are compiled out
When USE_ENTITY_ICON is not defined, LOG_ENTITY_ICON and log_entity_icon
are now completely compiled out rather than calling a function that
checks an always-empty icon reference.
2026-02-12 18:29:55 -06:00
J. Nick Koston
bfd9448fcd Merge remote-tracking branch 'upstream/dev' into integration 2026-02-12 18:21:25 -06:00
J. Nick Koston
e0c03b2dfa [api] Fix ESP8266 noise API handshake deadlock and prompt socket cleanup (#13972) 2026-02-12 18:20:58 -06:00
J. Nick Koston
7dff631dcb [core] Flatten single-callsite vector realloc functions (#13970) 2026-02-12 18:20:39 -06:00
J. Nick Koston
36aba385af [web_server] Flatten deq_push_back_with_dedup_ to inline vector realloc (#13968) 2026-02-12 18:20:21 -06:00
J. Nick Koston
964e42e190 Merge remote-tracking branch 'origin/fix-esp8266-noise-handshake-deadlock' into integration 2026-02-12 17:58:16 -06:00
J. Nick Koston
375fc1db84 [api] Fix ESP8266 noise API handshake deadlock and prompt socket cleanup
Two fixes for ESP8266 with noise encryption:

1. Cache socket ready() before the handshake loop. On ESP8266 LWIP raw
   TCP, ready() returns the live state (false once rx buffer is consumed),
   unlike ESP32 where it is cached until the next main loop. Re-checking
   each iteration blocked handshake writes that must follow reads,
   deadlocking the handshake.

2. Process client removal immediately after loop() instead of deferring
   to the next server loop iteration. This closes the socket promptly
   to free LWIP PCB resources and prevent retransmit crashes on ESP8266.
2026-02-12 17:54:32 -06:00
J. Nick Koston
ebeb6ae9e1 Merge branch 'flatten-realloc-insert-callers' into integration 2026-02-12 16:48:20 -06:00
J. Nick Koston
2caaf681e2 Fix CI lint: rename push_item_ to push_item, remove const from bssid_t value param 2026-02-12 16:47:22 -06:00
J. Nick Koston
4a12eed328 Merge branch 'flatten-realloc-insert-callers' into integration 2026-02-12 16:45:48 -06:00
J. Nick Koston
54ab5ee6d5 tidy 2026-02-12 16:45:22 -06:00
J. Nick Koston
88660c4709 Merge remote-tracking branch 'origin/integration' into integration 2026-02-12 16:44:03 -06:00
J. Nick Koston
98fa8651fa Merge branch 'flatten-realloc-insert-callers' into integration 2026-02-12 16:43:50 -06:00
J. Nick Koston
5ed6a2b285 [core] Flatten single-callsite vector realloc functions
On ESP8266 (GCC 10.3), std::vector::push_back/emplace_back emit
separate _M_realloc_insert functions even when called from only
one site. Adding __attribute__((flatten)) inlines the realloc
path, saving the out-of-line function overhead.

Changes:
- wifi: Move set_sta_priority from header to .cpp (eliminates
  duplicate instantiation at 2 call sites) and add flatten
- web_server_base: Flatten add_handler (single push_back site)
- api: Flatten accept_new_connections_ (single emplace_back site)
- api: Extract push_item_ as single flattened push_back site for
  DeferredBatch (was 2 call sites in add_item/add_item_front)

Saves ~200 bytes of flash on ESP8266, ~40 bytes on ESP32.
2026-02-12 16:40:54 -06:00
J. Nick Koston
f5f662fa19 Merge branch 'flatten-realloc-insert-callers' into integration 2026-02-12 16:39:51 -06:00
J. Nick Koston
77a0eb4ebe Merge branch 'flatten-realloc-insert-callers' into integration 2026-02-12 16:29:58 -06:00
J. Nick Koston
bf9e3213f2 [core] Flatten single-callsite vector realloc functions
On ESP8266 (GCC 10.3), std::vector::push_back/emplace_back emit
separate _M_realloc_insert functions even when called from only
one site. Adding __attribute__((flatten)) inlines the realloc
path, saving the out-of-line function overhead.

Changes:
- wifi: Move set_sta_priority from header to .cpp (eliminates
  duplicate instantiation at 2 call sites) and add flatten
- web_server_base: Flatten add_handler (single push_back site)
- api: Flatten accept_new_connections_ (single emplace_back site)

Saves 160 bytes of flash on ESP8266.
2026-02-12 16:28:57 -06:00
J. Nick Koston
c4d83150f4 Merge remote-tracking branch 'origin/web_server-flatten-deq-push-back' into integration 2026-02-12 16:08:21 -06:00
J. Nick Koston
8cf3cbf7ea [web_server] Flatten deq_push_back_with_dedup_ to inline vector realloc
On ESP8266 (GCC 10.3), std::vector::push_back() emits a separate
_M_realloc_insert<DeferredEvent> function (198 bytes) that is only
called from one site. Adding __attribute__((flatten)) forces the
compiler to inline it, eliminating the out-of-line function's
prologue/epilogue and call overhead.

This matches what GCC 14.2 (ESP-IDF toolchain) already does
naturally for the equivalent code in web_server_idf.cpp.

Saves 80 bytes of flash on ESP8266.
2026-02-12 16:07:19 -06:00
J. Nick Koston
f7854fca8a Revert "[api] Extract keepalive ping to noinline function"
This reverts commit 94ea5bac3a.
2026-02-12 15:43:18 -06:00
J. Nick Koston
e8506218cb Merge branch 'api-extract-keepalive-ping' into integration 2026-02-12 15:33:55 -06:00
J. Nick Koston
94ea5bac3a [api] Extract keepalive ping to noinline function
Extract the keepalive ping sending logic from APIConnection::loop()
into a separate noinline send_keepalive_ping_() method. This code
only fires once per keepalive interval (~60s) making it cold relative
to the ~111 Hz loop rate. Moving it out reduces loop() from 337 to
258 bytes, keeping the hot path smaller and more cache-friendly.
2026-02-12 15:32:29 -06:00
J. Nick Koston
80d16dda42 Merge remote-tracking branch 'upstream/dev' into integration 2026-02-12 15:20:20 -06:00
Jonathan Swoboda
136d17366f [docker] Suppress git detached HEAD advice (#13962)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 16:12:17 -05:00
Jonathan Swoboda
db7870ef5f [alarm_control_panel] Fix flaky integration test race condition (#13964)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 16:04:39 -05:00
dependabot[bot]
bbc88d92ea Bump docker/build-push-action from 6.19.1 to 6.19.2 in /.github/actions/build-image (#13965)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-12 14:31:43 -06:00
J. Nick Koston
97c080e465 Merge branch 'wifi-memcpy-sort' into integration 2026-02-12 12:42:55 -06:00
J. Nick Koston
88df48a52d Add TODO for std::trivially_relocatable when available 2026-02-12 12:42:09 -06:00
J. Nick Koston
8676b99219 Merge branch 'wifi-memcpy-sort' into integration 2026-02-12 12:33:55 -06:00
J. Nick Koston
282ba90f62 Address review feedback: add explicit includes and clarify comments
- Add #include <type_traits> to both .cpp and .h for static_asserts
- Clarify CompactString comment: explicitly note it is not trivially
  copyable, and that memcpy safety relies on validated layout property
- Use memcpy_fn indirection to suppress both GCC -Wclass-memaccess
  and clang-tidy bugprone-undefined-memory-manipulation without
  platform-specific pragma guards
2026-02-12 12:32:06 -06:00
J. Nick Koston
58f8029264 [wifi] Use memcpy-based insertion sort for scan results
Replace copy-assignment with raw memcpy in the WiFi scan result
insertion sort. Copy assignment on WiFiScanResult calls
CompactString's destructor then placement-new for every shift,
which means delete[]/new[] per shift for heap-allocated SSIDs.

With 70+ networks visible (e.g., during captive portal transition
showing full scan results), this caused event loop blocking from
hundreds of heap allocations in a tight loop on an 80MHz ESP8266.

This optimization is safe because we're permuting elements within
the same array - each slot is overwritten exactly once, so no
ownership duplication occurs. CompactString stores either inline
data or a heap pointer, never a self-referential pointer (unlike
libstdc++ std::string SSO). This was made possible by PR#13472
which replaced std::string with CompactString.

Static asserts guard the memcpy safety assumptions at compile time.

Confirmed on real device: event loop blocking during captive portal
transition is eliminated and WiFi connection is slightly faster.
2026-02-12 12:29:19 -06:00
Jesse Hills
1604b5d6e4 Merge branch 'beta' into dev 2026-02-13 07:11:49 +13:00
Jesse Hills
e000858d77 Merge pull request #13951 from esphome/bump-2026.2.0b1
2026.2.0b1
2026.2.0b1
2026-02-13 07:11:07 +13:00
J. Nick Koston
7fd535179e [helpers] Add heap warnings to format_hex_pretty, deprecate ethernet/web_server std::string APIs (#13959) 2026-02-12 17:47:44 +00:00
Lukáš Maňas
e3a457e402 [pulse_meter] Fix early edge detection (#12360)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2026-02-12 17:20:54 +00:00
J. Nick Koston
0dcff82bb4 [wifi] Deprecate wifi_ssid() in favor of wifi_ssid_to() (#13958) 2026-02-12 17:14:36 +00:00
J. Nick Koston
cde8b66719 [web_server] Switch from getParam to arg API to eliminate heap allocations (#13942) 2026-02-12 11:04:41 -06:00
J. Nick Koston
0e1433329d [api] Extract cold code from APIServer::loop() hot path (#13902) 2026-02-12 11:04:23 -06:00
J. Nick Koston
3d2227ff8d Merge remote-tracking branch 'origin/deprecate-std-string-apis' into integration 2026-02-12 11:00:56 -06:00
J. Nick Koston
94ea150082 [helpers] Add heap allocation warnings and deprecate unused std::string APIs
Add @warning comments to all format_hex_pretty() overloads in helpers.h
pointing to the buffer-based format_hex_pretty_to() alternatives.

Deprecate with ESPDEPRECATED (removal 2026.9.0):
- EthernetComponent::get_eth_mac_address_pretty()
  -> use get_eth_mac_address_pretty_into_buffer()
- AsyncWebServerRequest::url()
  -> use url_to()

Neither deprecated method has internal callers.
2026-02-12 10:59:10 -06:00
J. Nick Koston
e8f2d21d66 Merge remote-tracking branch 'origin/deprecate-wifi-ssid' into integration 2026-02-12 10:49:15 -06:00
J. Nick Koston
932067c332 [wifi] Deprecate wifi_ssid() in favor of wifi_ssid_to()
wifi_ssid() returns std::string which allocates on the heap.
All internal callers have already been migrated to the
buffer-based wifi_ssid_to() alternative. Mark as deprecated
with a 6-month removal window (2026.9.0).
2026-02-12 10:47:23 -06:00
J. Nick Koston
6dd555487b Fix off-by-one in get_descriptor_string loop bound
bLength includes the 2-byte descriptor header, so the character count
is (bLength - 2) / 2, not bLength / 2. The old loop read one wData
entry past the actual string data. Also guard bLength < 2.
2026-02-12 10:35:24 -06:00
J. Nick Koston
0556d27ced Merge branch 'usb-host-extract-cold-path' into integration 2026-02-12 10:28:37 -06:00
J. Nick Koston
60fef5e656 [analyze_memory] Fix mDNS packet buffer miscategorized as wifi_config (#13949)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 10:26:54 -06:00
J. Nick Koston
725e774fe7 [web_server] Guard icon JSON field with USE_ENTITY_ICON (#13948) 2026-02-12 10:26:36 -06:00
J. Nick Koston
9aa98ed6c6 [uart] Remove redundant mutex, fix flush race, conditional event queue (#13955) 2026-02-12 10:26:10 -06:00