Commit Graph
23910 Commits
Author SHA1 Message Date
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
JiriPrchalpre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>Jonathan Swoboda
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
J. Nick Koston cdcc5e5932 Rename ProtoSize static methods with calc_ prefix for clang-tidy 2026-03-03 20:22:27 -10:00
J. Nick Koston 3a5f03d0a3 naming 2026-03-03 20:22:02 -10:00
J. Nick Koston daf2e6ecc8 naming 2026-03-03 20:21:25 -10:00
J. Nick Koston 08c9990b53 simple register 2026-03-03 20:14:34 -10:00
J. Nick Koston e867712795 tweaks 2026-03-03 19:57:53 -10:00
J. Nick Koston 8407033111 dead 2026-03-03 19:56:31 -10:00
J. Nick Koston 675db740a9 Replace lambda and duplicate encode_msg thunk with shared proto_encode_msg<T>
Single named free function in proto.h used by both encode_message<T>
and APIConnection send paths. Eliminates duplicate thunk definitions.
2026-03-03 19:02:18 -10:00
J. Nick Koston 2b80effa20 Move HAS_PROTO_MESSAGE_DUMP code from template wrappers into non-template cores
Reduces per-instantiation cost of send_message<T> and
encode_message_to_buffer<T> by moving the DumpBuffer/log code
into send_message_() and encode_to_buffer(). The dump methods
(message_name, dump_to) are still virtual on ProtoMessage, so
they work correctly through the void* → ProtoMessage* cast.
2026-03-03 18:52:00 -10:00
J. Nick Koston 59b39d4388 tidy 2026-03-03 18:35:39 -10:00
J. Nick Koston 1e7eba1e90 tidy 2026-03-03 18:35:00 -10:00
J. Nick Koston 0a816192b2 restore comments to reduce diff churn 2026-03-03 18:32:18 -10:00
J. Nick Koston a7b61b1061 twea 2026-03-03 18:22:23 -10:00
J. Nick Koston 5d3d983994 fix bug 2026-03-03 17:49:25 -10:00
J. Nick Koston 9ba592cc42 cleanup 2026-03-03 17:40:07 -10:00
J. Nick Koston cfbe5904cc non-template cores 2026-03-03 17:31:43 -10:00
J. Nick Koston 6a66ab7406 tweak 2026-03-03 17:23:38 -10:00