Commit Graph
24652 Commits
Author SHA1 Message Date
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
J. Nick Koston cd6c65c670 [water_heater] Set OPERATION_MODE feature flag when modes are configured
The template water_heater component was setting the supported modes
list but not setting the WATER_HEATER_SUPPORTS_OPERATION_MODE feature
flag, causing Home Assistant to not know that mode selection is
supported.

Fixes https://github.com/esphome/esphome/issues/14605
2026-03-12 14:10:57 -10:00
J. Nick Koston a4d278874b Merge branch 'fix-rp2040-crash-handler-section-attr' into integration 2026-03-12 13:42:04 -10:00
J. Nick Koston b62f7037df replace copilots broken suggestion with something that actually works 2026-03-12 13:41:53 -10:00
J. Nick Koston f4eddbea29 Merge remote-tracking branch 'origin/dev' into integration 2026-03-12 13:39:05 -10:00
J. Nick Koston acdc24971c Merge remote-tracking branch 'origin/fix-rp2040-testing-mode-flash' into integration 2026-03-12 13:38:56 -10:00
J. Nick Koston 5203305060 Merge remote-tracking branch 'origin/fix-rp2040-crash-handler-section-attr' into integration 2026-03-12 13:38:48 -10:00
J. Nick Koston 1b78f55bdf Merge branch 'fix-rp2040-i2c-bus-selection' into integration 2026-03-12 13:38:29 -10:00
J. Nick Koston 975854bd9f Merge remote-tracking branch 'upstream/fix-wifi-eap-rp2040-validation' into integration 2026-03-12 13:38:21 -10:00
J. Nick KostonandClaude Opus 4.6 ce2e0381c1 [rp2040] Use full flash for sketch in testing mode
In testing mode, set filesystem_size to 0m so the full 2MB flash is
available for the sketch partition. This prevents linker overflow when
CI groups many components into a single build, matching the approach
used by ESP8266's testing mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 13:34:20 -10:00
J. Nick KostonandCopilot fb88550a8d Update esphome/components/mdns/mdns_rp2040.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-12 13:31:53 -10:00
J. Nick Koston fd8e510745 [light] Fix ambiguous set_effect overload for const char* (#14732) 2026-03-12 18:28:25 -05:00
J. Nick Koston d7310fff32 [wifi] Reject EAP/WPA2 Enterprise config on unsupported platforms
WPA2 Enterprise (EAP) is only implemented for ESP32 and ESP8266 but the
config schema accepted it on all platforms. On RP2040 this caused a
bootloop with no useful error message. Now rejects EAP config at
validation time on unsupported platforms.

Closes https://github.com/esphome/esphome/issues/14743
2026-03-12 13:26:44 -10:00
J. Nick Koston 32e8efb7b7 Use formula-based description instead of incomplete GPIO pin lists
Addresses review feedback: the hard-coded pin lists only covered RP2040
GPIOs and were incomplete for RP2350 (GPIO up to 47). Now describes the
(gpio / 2) % 2 rule instead.
2026-03-12 13:24:27 -10:00