Commit Graph
24700 Commits
Author SHA1 Message Date
J. Nick Koston 032e9a8a90 Merge branch 'api-reduce-code-size' into integration 2026-03-13 19:42:48 -10:00
J. Nick Koston 24f380a67a [api] Reduce API code size with buffer and nodelay optimizations
Add APIBuffer::reserve_and_resize() to eliminate duplicate grow_()
capacity checks when reserve() is immediately followed by resize().
This saves one grow_() check per call site (~12 bytes each).

Simplify set_nodelay_for_message() Nagle batching state machine by
replacing the NODELAY_ON (-1) sentinel with a simple counter starting
at 0. Reduces branches from 5 to 3 with identical behavior verified
by exhaustive testing of all 2^N message sequences up to length 12.

Saves 32 bytes flash on ESP8266.
2026-03-13 19:41:03 -10:00
J. Nick Koston 676e668811 revert 2026-03-13 18:25:05 -10:00
J. Nick Koston 52680e99b8 Merge remote-tracking branch 'upstream/esp32-log-v2' into integration 2026-03-13 17:22:39 -10:00
J. Nick Koston d3055ea6ea [esp32] Drop :000 line number and shorten fallback tag 2026-03-13 17:06:45 -10:00
J. Nick Koston 99e0dcf563 [esp32] Use DRAM_ATTR for format strings in IRAM log override
ESP-IDF places log_format_text.c in IRAM/DRAM via linker fragment
(noflash) when CONFIG_LOG_IN_IRAM=y. Our override is in a different
compilation unit so string literals would default to flash. In
constrained environments where flash cache is disabled, reading
flash-resident format strings would fault.

Move all format string constants to DRAM_ATTR to match ESP-IDF's
own behavior.
2026-03-13 17:03:14 -10:00
J. Nick Koston 3a491722b2 [esp32] Use ESP-IDF Log V2 to reduce flash usage
Switch from ESP-IDF Log V1 to V2, which centralizes log formatting
inside esp_log() instead of expanding esp_log_timestamp(), color codes,
and LOG_FORMAT() at every ESP_LOGx macro call site.

This saves ~9KB of flash by eliminating ~500 per-site macro expansions
in ESP-IDF library code (gpio, ethernet, mdns, uart, wifi, etc.).

Override esp_log_format() to skip ESP-IDF's own formatting after the
ESPHome logger hook is installed, since ESPHome does its own formatting.
For early boot and constrained environments (ISR, cache disabled),
format messages in ESPHome style with colors using a stack buffer.
2026-03-13 15:38:43 -10:00
J. Nick Koston 415084d032 Merge remote-tracking branch 'upstream/dev' into integration 2026-03-13 13:42:55 -10:00
J. Nick KostonandCopilot Autofix powered by AI 5e3c44d48f [rp2040] Add CI check for boards.py freshness (#14754)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-13 13:28:55 -10:00
J. Nick Koston d6d3bbbad8 [scheduler] Use integer math for interval offset calculation (#14755) 2026-03-13 13:28:34 -10:00
J. Nick Koston 0082345c70 Merge remote-tracking branch 'origin/fix-lwiplock-inline-noop' into integration 2026-03-13 13:28:05 -10:00
J. Nick Koston 2a3c451fd3 tidy 2026-03-13 13:27:39 -10:00
Jonathan SwobodaandClaude Opus 4.6 86b7933081 [esp32_rmt_led_strip][remote_transmitter][remote_receiver] Fix ESP-IDF 6.0 RMT compatibility (#14783)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 19:24:41 -04:00
J. Nick Koston 7cceb72cc3 [api] Inline force-variant ProtoSize calc methods (#14781) 2026-03-13 13:23:41 -10:00
J. Nick Koston 56f7b3e61b [ci] Only run integration tests for changed components (#14776) 2026-03-13 13:20:35 -10:00
J. Nick Koston 22062d79a2 [analyze-memory] Add function call frequency analysis (#14779) 2026-03-13 13:20:17 -10:00
J. Nick Koston ebc315ea80 Merge remote-tracking branch 'origin/dev' into integration 2026-03-13 13:14:56 -10:00
J. Nick Koston 442329a139 Merge remote-tracking branch 'origin/entity-base-inline-accessors' into integration 2026-03-13 13:14:49 -10:00
J. Nick KostonandCopilot Autofix powered by AI 417fccaa87 Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-13 13:14:16 -10:00
Jonathan SwobodaandClaude Opus 4.6 ab3b677113 [adc] Fix ESP-IDF 6.0 compatibility for ADC_ATTEN_DB_12 (#14784)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:11:18 +00:00
J. Nick Koston 1507752fa3 Merge remote-tracking branch 'origin/integration' into integration 2026-03-13 13:08:17 -10:00
J. Nick Koston 2f57f0c90f Merge branch 'fix-lwiplock-inline-noop' into integration 2026-03-13 13:07:54 -10:00
J. Nick Koston 303c6513ee [core] Inline LwIPLock as no-op on platforms without lwIP core locking
LwIPLock was introduced for RP2040 WiFi in #14679 to prevent race
conditions between lwip callbacks and the main loop. However, on
platforms without lwIP core locking (ESP8266, LibreTiny, Zephyr,
RP2040 without WiFi), the constructor/destructor were empty stubs
in .cpp files that the compiler could not see through, generating
unnecessary function calls at every call site.

Move the no-op implementation inline into helpers.h so the compiler
can eliminate all LwIPLock overhead on these platforms. ESP32 and
RP2040+WiFi retain their out-of-line implementations with real
locking.
2026-03-13 13:07:27 -10:00
J. Nick Koston ebc4c556e3 Merge remote-tracking branch 'upstream/fix-lwiplock-inline-noop' into integration 2026-03-13 13:06:42 -10:00
J. Nick Koston fb9e2b08e5 Merge remote-tracking branch 'upstream/fix-lwiplock-inline-noop' into integration 2026-03-13 13:04:36 -10:00
J. Nick Koston e918814530 [core] Inline LwIPLock as no-op on platforms without lwIP core locking
LwIPLock was introduced for RP2040 WiFi in #14679 to prevent race
conditions between lwip callbacks and the main loop. However, on
platforms without lwIP core locking (ESP8266, LibreTiny, Zephyr,
RP2040 without WiFi), the constructor/destructor were empty stubs
in .cpp files that the compiler could not see through, generating
unnecessary function calls at every call site.

Move the no-op implementation inline into helpers.h so the compiler
can eliminate all LwIPLock overhead on these platforms. ESP32 and
RP2040+WiFi retain their out-of-line implementations with real
locking.
2026-03-13 13:02:05 -10:00
Jonathan SwobodaandClaude Opus 4.6 cdb445f69d [mipi_dsi] Fix ESP-IDF 6.0 compatibility for LCD color format (#14785)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:00:28 +00:00
J. Nick Koston 7bb88267fe Merge branch 'entity-base-inline-accessors' into integration 2026-03-13 12:43:56 -10:00
J. Nick Koston 7709713fad Merge branch 'dev' into entity-base-inline-accessors 2026-03-13 12:39:52 -10:00
J. Nick Koston 742230e9ab [core] Inline trivial EntityBase accessors
Move get_name() and get_object_id_hash() definitions from
entity_base.cpp to entity_base.h so the compiler can inline
these trivial member accessors, eliminating call overhead at
every call site.
2026-03-13 12:38:49 -10:00
J. Nick Koston 71c94d2a6c Merge branch 'analyze-memory-call-frequency' into integration 2026-03-13 12:35:02 -10:00
J. Nick Koston 434bbde5b3 tweak 2026-03-13 12:34:31 -10:00
J. Nick Koston 95ff7fc883 Merge remote-tracking branch 'upstream/inline-calc-force-proto' into integration 2026-03-13 12:29:26 -10:00
J. Nick Koston 05990474b0 [api] Inline force-variant ProtoSize calc methods for BLE proxy hot path
Force-inline calc_uint64_force, calc_sint32_force, calc_length_force,
and calc_message_force so the varint fast path (value < 128) is
expanded at each call site instead of going through a function call.

These are the size-calculation methods used by BLE proxy messages
(BluetoothLERawAdvertisement, BluetoothGATTService/Characteristic/
Descriptor) which are called 12x per advertisement batch in the
hot path.

Benchmarked on ESP32 with 12-advertisement batches (10k iterations):
- calculate_size: 10381 -> 9718 ns/op (6.4% faster)
- Full calc+encode: 49886 -> 47599 ns/op (4.6% faster)

Flash cost: +40 bytes (ESP32 IDF), +64 bytes (ESP8266).
2026-03-13 12:18:03 -10:00
J. Nick Koston 2aeb5314c9 Merge remote-tracking branch 'upstream/analyze-memory-call-frequency' into integration 2026-03-13 11:47:24 -10:00
J. Nick Koston d54f31e9c2 [analyze-memory] Add function call frequency analysis
Add a "Top Called Functions" section to the analyze-memory report
that shows the most frequently called functions by call site count.
This helps identify inlining candidates by showing which functions
are called most often alongside their code size.

The analysis parses objdump disassembly output to count direct and
indirect call instructions across architectures (Xtensa call0/callx0,
ARM bl/blx).

Also fixes _batch_demangle_symbols to merge into the existing cache
instead of replacing it.
2026-03-13 11:43:14 -10:00
Thomas SAMTERandJ. Nick Koston 1eed1adfa0 [pid] Replace std::deque with FixedRingBuffer (#14733)
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2026-03-13 11:38:45 -10:00
J. Nick Koston 516a705df0 Merge remote-tracking branch 'upstream/dev' into integration 2026-03-13 10:38:11 -10:00
J. Nick Koston a6c08576be [sensor] Use FixedRingBuffer in SlidingWindowFilter, add window_size limit (#14736) 2026-03-13 10:17:40 -10:00
dependabot[bot]andJ. Nick Koston f41aa8b18c Bump ruff from 0.15.5 to 0.15.6 (#14774)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2026-03-13 19:35:10 +00:00
J. Nick Koston 6bdaa4c972 Merge remote-tracking branch 'upstream/dev' into integration 2026-03-13 09:07:55 -10:00
Jonathan SwobodaandClaude Opus 4.6 6700347a48 [wifi] Fix ESP-IDF 6.0 compatibility (#14766)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 14:47:12 -04:00
Jonathan SwobodaandClaude Opus 4.6 b147830ef9 [core] Fix std::isnan conflict with picolibc on ESP-IDF 6.0 (#14768)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 14:24:39 -04:00
J. Nick Koston bd844fcd0a [template] Fix misleading 'Text value too long to save' warning (#14753) 2026-03-13 07:37:44 -10:00
J. Nick Koston 8936be628f [api] Increase log Nagle coalescing on all platforms except ESP8266 (#14752) 2026-03-13 07:37:30 -10:00
J. Nick Koston 5920fa97e4 [select] Fix -Wmaybe-uninitialized warnings on ESP8266 (#14759) 2026-03-13 09:20:50 -04:00
Kjell Braden 326769e43c [runtime_image] fix BMP parsing (#14762) 2026-03-13 09:18:42 -04:00
Thomas SAMTER 7524590bcf [const] Add CONF_CLIMATE_ID for climate component sub-entities (#14764) 2026-03-13 09:17:11 -04:00
J. Nick Koston c8dc00e76b Merge branch 'api-plaintext-varint-devirtualize' into integration 2026-03-12 22:45:41 -10:00
J. Nick Koston a29206f838 [api] Rename VARINT_MAX_ to VARINT_THRESHOLD_ for clarity
These are exclusive upper bounds (value < threshold), not inclusive
maximums. The new name avoids off-by-one confusion if reused.
2026-03-12 22:45:26 -10:00