Commit Graph
23926 Commits
Author SHA1 Message Date
J. Nick Koston 5a16fdf69d Merge remote-tracking branch 'upstream/remove-presleep-socket-scan' into integration 2026-03-04 11:15:45 -10:00
J. Nick Koston 760dfd7714 [core] Update comment wording 2026-03-04 11:15:02 -10:00
J. Nick Koston ce6332e6c3 [core] Remove pre-sleep socket scan from fast select path
The pre-sleep scan of all monitored sockets was added to preserve
select() semantics by checking for pending data before sleeping.
However, this is unnecessary with the FreeRTOS task notification
approach:

- xTaskNotifyGive from the lwip callback persists until consumed
  by ulTaskNotifyTake, so notifications received while the task
  is running (not sleeping) are not lost.

- The only case the scan caught was intentionally undrained sockets
  (e.g., API's MAX_MESSAGES_PER_LOOP=5 throttle). Adding up to
  16ms (loop_interval) latency before re-checking undrained data
  is the desired behavior — waking immediately would defeat the
  purpose of the throttle which exists to let other components run.

This removes N volatile cross-core reads (one per monitored socket)
from every loop iteration.
2026-03-04 11:12:15 -10:00
J. Nick Koston a2d8b19fc1 Merge branch 'integration' of https://github.com/esphome/esphome into integration 2026-03-04 10:37:00 -10:00
J. Nick Koston d1af187b76 Merge branch 'integration' of https://github.com/esphome/esphome into integration 2026-03-04 10:36:46 -10:00
J. Nick Koston 4abab7cca3 Merge branch 'inline-network-is-connected' into integration 2026-03-04 10:36:35 -10:00
J. Nick Koston 212634a906 restore missing comment 2026-03-04 10:35:53 -10:00
J. Nick Koston 5e887ea6a2 Merge branch 'devirtualize-ota-backend' into integration 2026-03-04 10:10:53 -10:00
J. Nick Koston 117e23f14c Fix all-include CI check with stub OTA backend
When no platform define is set (static analysis), provide a stub
so decltype(ota::make_ota_backend()) resolves.
2026-03-04 10:10:43 -10:00
J. Nick Koston faba447549 Merge remote-tracking branch 'origin/integration' into integration 2026-03-04 10:09:11 -10:00
J. Nick Koston dde4548eab Merge branch 'devirtualize-ota-backend' into integration 2026-03-04 10:08:51 -10:00
J. Nick Koston 40eb2b5343 Merge branch 'devirtualize-ota-backend' into integration 2026-03-04 10:03:07 -10:00
J. Nick Koston acef15b982 [ota] Devirtualize OTA backend calls
Each platform defines exactly one OTA backend subclass (marked final),
so using concrete types in unique_ptr eliminates virtual dispatch overhead.

- Remove OTABackend base class - no longer needed since all consumers
  use concrete types directly
- Move make_ota_backend() declaration to each concrete backend header
  with concrete return type
- Add ota_backend_factory.h convenience header for consumers
- Use concrete unique_ptr types in ota_esphome, http_request, and
  web_server consumers
2026-03-04 10:01:28 -10:00
J. Nick Koston febb4c47e7 Merge branch 'devirtualize-ota-backend' into integration 2026-03-04 09:51:43 -10:00
J. Nick Koston 9cb5d287a4 [ota] Devirtualize OTA backend calls
Each platform defines exactly one OTA backend subclass (marked final),
so using concrete types in unique_ptr eliminates virtual dispatch overhead.

- Move make_ota_backend() declaration from base header to each concrete
  backend header with concrete return type
- Add ota_backend_factory.h convenience header for consumers
- Use concrete unique_ptr types in ota_esphome, http_request, and
  web_server consumers
2026-03-04 09:49:31 -10:00
Kevin Ahrendt 4928e678d1 [mixer][resampler][speaker] Use core static task manager (#14454) 2026-03-04 14:37:22 -05:00
J. Nick Koston 1c3d5de0ab Merge remote-tracking branch 'upstream/devirtualize-frame-helper' into integration 2026-03-04 09:16:11 -10:00
J. Nick Koston 30d7834fa8 [api] Devirtualize frame helper calls when protocol is fixed at compile time
When only one API protocol is configured (plaintext-only or noise-only),
use the concrete frame helper type in unique_ptr instead of the base
class. Since both APIPlaintextFrameHelper and APINoiseFrameHelper are
marked final, the compiler can devirtualize all virtual calls
(read_packet, write_protobuf_packet, loop, etc.), eliminating vtable
dispatch overhead in the hot APIConnection::loop() path.

When both protocols are enabled (encryption key set with plaintext
fallback), the polymorphic base pointer is used as before.
2026-03-04 09:13:53 -10:00
J. Nick Koston aa1088a6dd Merge branch 'inline-network-is-connected' into integration 2026-03-04 08:57:34 -10:00
J. Nick Koston 9782332108 force it 2026-03-04 08:57:25 -10:00
J. Nick Koston 41fecdf1f7 Merge remote-tracking branch 'upstream/dev' into integration 2026-03-04 08:39:51 -10:00
J. Nick Koston 5bc9604587 Merge branch 'wifi-cache-is-connected' into integration 2026-03-04 08:21:08 -10:00
J. Nick Koston c4b4023a7a Merge remote-tracking branch 'upstream/inline-network-is-connected' into integration 2026-03-04 08:20:49 -10:00
J. Nick KostonandCopilot fb33fb977d Update esphome/components/network/util.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-04 08:20:17 -10:00
J. Nick KostonandCopilot 4a2388ed82 Update esphome/components/network/util.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-04 08:20:11 -10:00
Jonathan SwobodaandClaude Opus 4.6 22fc3aab39 [ld2420] Fix buffer overflows in simple mode, energy mode, and calibration (#14458)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 08:19:46 -10:00
J. Nick Koston 56df739fac Merge remote-tracking branch 'origin/inline-network-is-connected' into integration 2026-03-04 08:13:18 -10:00
J. Nick Koston 733c472c9f [network] Inline network::is_connected() and ethernet is_connected() 2026-03-04 08:09:53 -10:00
J. Nick Koston d178499c28 [wifi] Cache is_connected() for cheap inline access
Move is_connected() to the header as an inline method that returns a
cached bool field. The previous implementation called
wifi_sta_connect_status_() on every invocation, which makes SDK calls
on ESP8266 (wifi_station_get_connect_status) and RP2040
(cyw43_wifi_link_status + WiFi.status), preventing inlining and adding
overhead for the many callers that check it every loop iteration
(network::is_connected, API server, MQTT, status sensor, etc.).

The cached state is updated once per loop() after wifi_loop_() processes
platform events. Internal call sites that need a live SDK query
(STA_CONNECTED loss detection, RP2040 can_proceed) use the new
is_connected_() private method directly.
2026-03-04 08:08:58 -10:00
Jonathan SwobodaandClaude Opus 4.6 c37ab1de84 [fingerprint_grow] Fix OOB write and uint16 overflow (#14462)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 12:58:52 -05:00
Jonathan SwobodaandClaude Opus 4.6 246a8bff0c [pn7160][pn7150][pn532] Fix tag purge skipping, NDEF bounds check, and NDEF length byte order (#14460)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 12:58:42 -05:00
Jonathan SwobodaandClaude Opus 4.6 9abba79c54 [remote_base][remote_receiver] Fix OOB access in pronto comparison and RMT buffer allocation (#14459)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 12:58:24 -05:00
Jonathan SwobodaandClaude Opus 4.6 5ba880f19b [sx127x] Fix preamble MSB register always written as zero (#14457)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 12:57:45 -05:00
J. Nick Koston 1f9bdb2197 Merge remote-tracking branch 'upstream/dev' into integration 2026-03-04 07:25:53 -10:00
J. Nick Koston 8081975c8f Merge branch 'devirtualize-proto-encode' into integration 2026-03-04 07:25:47 -10:00
J. Nick Koston a1df4f80e1 Skip proto message dump for log and camera responses
In debug builds (HAS_PROTO_MESSAGE_DUMP), skip dump logging for
SubscribeLogsResponse (recursive logging risk) and CameraImageResponse
(high-frequency image data noise). This matches the base branch behavior
where both bypassed dump logging via direct send_message_impl() calls.
2026-03-04 07:24:59 -10:00
J. Nick Koston b2e8544c58 [ld2412] Add integration tests with mock UART (#14448) 2026-03-04 07:18:31 -10:00
J. Nick Koston ac19d05db2 [core] Call loop() directly in main loop, bypass call() indirection (#14451) 2026-03-04 07:17:41 -10:00
J. Nick Koston 065773ed4c [runtime_stats] Use micros() for accurate per-component timing (#14452) 2026-03-04 07:17:28 -10:00
37146ff565 [integration] Add set method to publish and save sensor value (#13316)
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-03-04 09:00:09 -05:00
J. Nick Koston 3541786f1a Merge branch 'runtime-stats-micros-timing' into integration 2026-03-03 23:19:03 -10:00
J. Nick Koston 87f37b7c38 [runtime_stats] Use micros() for accurate per-component timing
The previous millis()-based timing had insufficient resolution. Most
components complete their loop() in microseconds, but millis() only
has 1ms granularity. Components taking <1ms would show either 0ms or
1ms depending on whether a millisecond boundary happened to tick over
during execution — essentially random noise rather than useful data.

Switch to self-timed micros() per guard (only when USE_RUNTIME_STATS
is compiled in — zero cost in production builds). Track internally in
microseconds, display in milliseconds with fractional precision.

Use uint64_t for total_time_us_ to avoid overflow (uint32_t would wrap
after ~10 hours at typical loop rates).
2026-03-03 23:18:35 -10:00
J. Nick Koston 0b1cabf819 Merge remote-tracking branch 'origin/bypass-call-in-loop' into integration 2026-03-03 22:40:51 -10:00
J. Nick Koston fe0436166c [core] Ensure SETUP→LOOP transition before main loop
Components after the last blocking component in setup only receive
one call() (CONSTRUCTION→SETUP) and never get the second call()
that would transition them to LOOP state. Explicitly transition all
active looping components to LOOP state at the end of setup() so
the main loop can call loop() directly without the call() state
machine wrapper.
2026-03-03 22:31:04 -10:00
J. Nick Koston 36a598fa40 [core] Call loop() directly in main loop, bypass call() indirection
In the main loop, components in looping_components_ active section are
guaranteed to be in LOOP state. The call() method's state machine
dispatch (checking CONSTRUCTION, SETUP, FAILED, LOOP_DONE) is only
needed during Application::setup(). In the main loop it adds two
unnecessary function call frames per component per iteration
(call() -> call_loop_() -> loop()).

This became dead weight when looping_components_ partitioning was
introduced in June 2025 (8a06c4380d). Before that, Application::loop()
iterated components_[] which contained all states, so the state check
was necessary.
2026-03-03 22:22:51 -10:00
J. Nick Koston 8e53af2a2c Merge remote-tracking branch 'origin/devirtualize-proto-encode' into integration 2026-03-03 21:58:08 -10:00
J. Nick Koston 765075b1d0 tweaks 2026-03-03 21:35:11 -10:00
J. Nick Koston 982b618265 Merge branch 'devirtualize-proto-encode' into integration 2026-03-03 21:09:45 -10:00
J. Nick Koston 3548911b07 cleanup 2026-03-03 20:45:36 -10:00
J. Nick Koston 46c3a897fe Add benchmark comparing virtual vs direct dispatch for proto encoding 2026-03-03 20:27:02 -10:00