Commit Graph
24665 Commits
Author SHA1 Message Date
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
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
J. Nick Koston e00f1bfd3a Merge remote-tracking branch 'upstream/select-fix-maybe-uninitialized-warning' into integration 2026-03-12 22:37:33 -10:00
J. Nick Koston a19b36e4be [select] Fix -Wmaybe-uninitialized warnings on ESP8266
Replace brace-initialization `{}` with explicit `nullopt` for
optional<size_t> returns and assignments. Older GCC on ESP8266
falsely warns about uninitialized values with `return {}`.
2026-03-12 22:26:46 -10:00
J. Nick Koston b8d47e8280 Merge branch 'api-plaintext-varint-devirtualize' into integration 2026-03-12 22:23:19 -10:00
J. Nick Koston c7af451a56 [api] Fix type_varint_len ternary for uint8_t message_type
message_type is uint8_t (max 255), which fits in at most 2 varint
bytes. Simplify the ternary to reflect this constraint. Also revert
unnecessary comment split.
2026-03-12 22:21:26 -10:00
J. Nick Koston 5c4527905c [api] Optimize plaintext varint encoding and devirtualize write_protobuf_packet
- Replace ProtoSize::varint() call for message_type with inline
  ternary using named constants, avoiding the noinline varint_slow
  call overhead in the write_protobuf_messages loop (-32 bytes on
  ESP8266 Xtensa).

- Add named varint threshold constants (VARINT_MAX_1_BYTE, etc.)
  to ProtoSize class, used by both varint() and varint_wide().

- Devirtualize write_protobuf_packet by moving it to the base class
  as a non-virtual inline method. The plaintext and noise
  implementations only differed in footer handling, which is now
  unified via a conditional resize based on frame_footer_size_.
  This eliminates one vtable slot and allows the compiler to fully
  inline the thin wrapper into callers (-192 bytes total flash on
  ESP8266).

- Include proto.h from api_frame_helper.h (no circular dependency)
  to support the inline definition, replacing the forward declaration
  of ProtoWriteBuffer.
2026-03-12 22:15:36 -10:00
J. Nick Koston 120ddded18 Merge branch 'scheduler-placement-new-move' into integration 2026-03-12 21:19:07 -10:00
J. Nick Koston 8010386614 [scheduler] Use placement-new for std::function move in set_timer_common_
GCC's std::function::operator=(function&&) implements move-assignment as
a swap dance: construct temporary, swap with *this, destroy temporary.
This generates two std::swap<_Any_data> calls plus a destructor even
when the target is known to be empty.

Since scheduler items returned from the pool or freshly allocated always
have an empty callback, we can use explicit destroy + placement
move-construct to bypass the swap overhead.

Measured savings in set_timer_common_:
- ESP8266 (Xtensa LX106): 473 → 421 bytes (-52 B, -11%)
- ESP32-S3 (Xtensa LX7): 412 → 376 bytes (-36 B, -9%)
2026-03-12 21:17:22 -10:00
J. Nick Koston 1337d852da Merge remote-tracking branch 'origin/inline-mutex-single-threaded' into integration 2026-03-12 21:01:52 -10:00
J. Nick Koston 0d503db403 [core] Inline Mutex/LockGuard on single-threaded platforms
When USE_ESP8266 or USE_RP2040 is defined, provide a fully inline
no-op Mutex class in the header. This allows the compiler to
eliminate all lock/unlock call overhead instead of generating
calls to empty function stubs.
2026-03-12 20:56:59 -10:00
Michael Kerscher 15ec46abfe [vbus] add DeltaSol CS4 (Citrin Solar 1.3) (#12477) 2026-03-12 22:31:16 -07:00
J. Nick Koston 4f76473f2a Merge branch 'scheduler-interval-offset-integer-math' into integration 2026-03-12 19:30:51 -10:00
J. Nick Koston 74e9bd8d7c [scheduler] Use integer math for interval offset calculation
Replace floating-point random offset calculation with integer
multiply-and-shift, eliminating soft-float calls on ESP8266 and
FPU instructions on ESP32/RP2040.
2026-03-12 19:29:11 -10:00
J. Nick Koston b074aebd6d Merge branch 'fix-template-text-save-warning' into integration 2026-03-12 19:21:04 -10:00
J. Nick Koston 30c010a47d Merge branch 'rp2040-boards-ci-check' into integration 2026-03-12 19:20:59 -10:00
J. Nick Koston a4d3a908e5 [rp2040] Add CI check for boards.py freshness
Add generate-rp2040-boards.py script that clones the arduino-pico
repository at the recommended framework version and regenerates
boards.py, matching the existing ESP32 board generation CI check
pattern.

This ensures boards.py stays in sync when the arduino-pico
framework version is updated.

Follow-up to #14528.
2026-03-12 19:19:43 -10:00
J. Nick Koston b81ef4697f [template] Fix misleading 'Text value too long to save' warning
TextSaver::save() returned false for both unchanged values and
values that are too long, causing a misleading warning on every
duplicate save. Return true early when the value hasn't changed.

Add integration test for template text save/restore persistence.
2026-03-12 18:05:44 -10:00
J. Nick Koston 8c0ef135aa Merge branch 'increase-log-nagle-count' into integration 2026-03-12 17:05:41 -10:00
J. Nick Koston 17c833f891 Fix stale comment referencing hardcoded log count 2026-03-12 16:58:53 -10:00
J. Nick Koston ccb9b66dd3 Merge branch 'increase-log-nagle-count' into integration 2026-03-12 16:55:36 -10:00
J. Nick Koston c3fee4a211 Include LibreTiny in LOG_NAGLE_COUNT=3
LibreTiny's TCP_SND_BUF is 4×MSS (5840 bytes), matching ESP32's
default. Only ESP8266 at 2×MSS needs the conservative count=2.
2026-03-12 16:54:03 -10:00
J. Nick Koston c04335d21d [api] Increase log Nagle coalescing on ESP32 and RP2040
Increase LOG_NAGLE_COUNT from 2 to 3 on ESP32 and RP2040, which have
larger TCP send buffers (64KB and 11.7KB respectively). This coalesces
4 log messages per Nagle cycle instead of 3, reducing the number of
individual write() calls and significantly reducing EWOULDBLOCK hits
on the log subscriber connection.

Tested on ESP32 and RP2040: buffered writes dropped from ~15% to near
zero with this change. ESP8266 and LibreTiny remain at LOG_NAGLE_COUNT=2
due to tighter buffer constraints.
2026-03-12 16:48:07 -10:00
J. Nick Koston 98379b70e9 Merge branch 'cache-errno-local' into integration 2026-03-12 15:58:32 -10:00
J. Nick KostonandClaude Opus 4.6 4e5d1cae8d Cache errno into local variable to eliminate duplicate __errno() calls
On embedded targets (ESP32, RP2040, ESP8266), errno expands to
(*__errno()) - a function call returning a pointer to thread-local
storage. The compiler cannot optimize away repeated accesses since
errno is treated as volatile. Cache it once into a const int local
to avoid redundant calls.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 15:57:16 -10:00
J. Nick Koston 3342cd04ea Merge remote-tracking branch 'upstream/dev' into integration
# Conflicts:
#	esphome/components/mdns/mdns_rp2040.cpp
2026-03-12 15:45:08 -10:00
J. Nick Koston 920af91db6 [rp2040] Fix compiler warnings in crash_handler and mdns (#14739) 2026-03-13 01:37:46 +00:00
J. Nick KostonandCopilot a744261934 [mdns] Fix RP2040 mDNS not restarting after WiFi reconnect (#14737)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-13 01:12:22 +00:00
J. Nick Koston 59c1368440 [i2c] Fix RP2040 I2C bus selection based on pin assignment (#14745) 2026-03-12 14:53:46 -10:00
J. Nick Koston 7e8e085a04 [light] Fix binary light spamming 'brightness not supported' warning with strobe effect (#14735) 2026-03-12 14:49:07 -10:00
J. Nick Koston 22b25724ae [wifi] Reject EAP/WPA2 Enterprise config on unsupported platforms (#14746) 2026-03-12 14:48:55 -10:00
J. Nick Koston 89719cf4b2 [water_heater] Set OPERATION_MODE feature flag when modes are configured (#14748) 2026-03-12 14:48:41 -10:00
J. Nick KostonandCopilot e15b19b223 [captive_portal] Fix captive portal inaccessible when web_server auth is configured (#14734)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-12 14:48:29 -10:00
J. Nick Koston 2ca13972b9 [debug] Fix missing reset reason for RP2040/RP2350 (#14740) 2026-03-12 14:48:06 -10:00
J. Nick KostonandClaude Opus 4.6 7bb4e75459 [rp2040] Use full flash for sketch in testing mode (#14747)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 14:47:16 -10:00
J. Nick Koston 47a3f29962 Merge branch 'fix-water-heater-operation-mode-flag' into integration 2026-03-12 14:44:30 -10:00
J. Nick Koston 77068ea410 [water_heater] Add integration test assertion for OPERATION_MODE feature flag 2026-03-12 14:12:47 -10:00