Commit Graph
24596 Commits
Author SHA1 Message Date
J. Nick Koston 7f8e12a679 Merge fix-rp2040-debug-reset-reason into integration 2026-03-12 12:27:07 -10:00
J. Nick Koston 1017ce87d6 [debug] Implement reset reason for RP2040/RP2350
The debug component's reset reason text sensor was returning an empty
string on RP2040/RP2350 platforms. Read the chip reset registers to
report the actual reset source.

RP2040: reads VREG_AND_CHIP_RESET for POR and RUN pin.
RP2350: reads POWMAN chip_reset for POR, brown-out, RUN pin, and
power supply glitch.
Both: checks watchdog_caused_reboot() from the Pico SDK, and
distinguishes between crash (HardFault), watchdog timeout, and
software reset by consulting the crash handler data.

Also adds buf_append_str() helper to helpers.h for efficient plain
string appends without format parsing overhead.
2026-03-12 12:26:37 -10:00
J. Nick Koston 9826af8af1 Merge remote-tracking branch 'origin/fix-rp2040-crash-handler-section-attr' into integration 2026-03-12 12:19:57 -10:00
J. Nick Koston 06cb1839f2 [rp2040] Fix compiler warnings in crash_handler and mdns
Fix two GCC warnings on RP2040 builds:

1. crash_handler.cpp: Move __attribute__((section(".noinit"))) from
   the struct type to the variable declaration where it belongs.

2. mdns_rp2040.cpp: Suppress IRAM_ATTR macro redefinition warning
   caused by Arduino-Pico's PolledTimeout.h redefining it to empty.
2026-03-12 12:19:38 -10:00
J. Nick Koston 1e3925c5a3 Merge remote-tracking branch 'origin/fix-rp2040-crash-handler-section-attr' into integration 2026-03-12 12:17:20 -10:00
J. Nick Koston 5da6fff7be Merge remote-tracking branch 'upstream/fix-rp2040-debug-reset-reason' into integration 2026-03-12 12:17:08 -10:00
J. Nick Koston 662f14e10b [debug] Implement reset reason for RP2040/RP2350
The debug component's reset reason text sensor was returning an empty
string on RP2040/RP2350 platforms. Read the chip reset registers to
report the actual reset source.

RP2040: reads VREG_AND_CHIP_RESET for POR, RUN pin, and debug port.
RP2350: reads POWMAN chip_reset for POR, brown-out, RUN pin, watchdog
variants, glitch detect, debugger, rescue, and core powerdown.
Both: checks watchdog_caused_reboot() from the Pico SDK.

Also adds buf_append_str() helper to helpers.h for efficient plain
string appends without format parsing overhead.
2026-03-12 12:16:16 -10:00
J. Nick Koston 35d060154c [rp2040] Fix -Wattributes warning in crash_handler
Move __attribute__((section(".noinit"))) from the struct type to the
variable declaration where it belongs. GCC warns because the section
attribute applies to variables, not types.
2026-03-12 12:13:58 -10:00
J. Nick Koston 3fb393456c Merge remote-tracking branch 'origin/fix-rp2040-mdns-reconnect' into integration 2026-03-12 12:06:21 -10:00
J. Nick Koston c7560f6878 [mdns] Fix RP2040 mDNS not restarting after WiFi reconnect
The RP2040's LEAmDNS library relies on LwipIntf::stateUpCB() to
restart mDNS when the network interface reconnects. However, this
callback is stubbed out in arduino-pico because the original ESP8266
implementation used schedule_function() which doesn't exist in
arduino-pico, and the callback can't safely run directly since netif
status callbacks fire from IRQ context while _restart() allocates
UDP sockets.

The previous workaround blocked all component setup via can_proceed()
until WiFi connected, which only helped on initial boot but did not
handle reconnects.

Replace with a proper fix: detect WiFi reconnection from the existing
50ms mDNS update interval (main loop context) and call
MDNS.notifyAPChange() to restart mDNS probing and announcing.
2026-03-12 12:05:32 -10:00
J. Nick Koston c1a4320c62 Merge remote-tracking branch 'origin/fix-rp2040-mdns-reconnect' into integration 2026-03-12 11:58:57 -10:00
J. Nick Koston f869bbcfa6 Merge remote-tracking branch 'origin/captive-portal-auth-bypass' into integration 2026-03-12 11:58:52 -10:00
J. Nick Koston b0dd029e9b Merge remote-tracking branch 'origin/fix-light-set-effect-ambiguous-overload' into integration 2026-03-12 11:58:45 -10:00
J. Nick Koston 4d7ab65ab6 Merge branch 'refactor/sliding-window-static-ring-buffer' into integration 2026-03-12 11:58:34 -10:00
J. Nick Koston f6d3ce7eb3 [mdns] Fix RP2040 mDNS not restarting after WiFi reconnect
The RP2040's LEAmDNS library relies on LwipIntf::stateUpCB() to
restart mDNS when the network interface reconnects. However, this
callback is stubbed out in arduino-pico because the original ESP8266
implementation used schedule_function() which doesn't exist in
arduino-pico, and the callback can't safely run directly since netif
status callbacks fire from IRQ context while _restart() allocates
UDP sockets.

The previous workaround blocked all component setup via can_proceed()
until WiFi connected, which only helped on initial boot but did not
handle reconnects.

Replace with a proper fix: detect WiFi reconnection from the existing
50ms mDNS update interval (main loop context) and call
MDNS.notifyAPChange() to restart mDNS probing and announcing.
2026-03-12 11:55:03 -10:00
J. Nick Koston 7ce12c31f3 add clear for https://github.com/esphome/esphome/pull/14733 2026-03-12 11:19:34 -10:00
J. Nick Koston bdf7608990 [sensor] Add FixedRingBuffer and use it in SlidingWindowFilter
Add FixedRingBuffer<T, MAX_CAPACITY> to helpers.h as the runtime-sized
equivalent of StaticRingBuffer. Uses std::conditional_t to auto-select
uint8_t/uint16_t/uint32_t index types based on MAX_CAPACITY.

Convert SlidingWindowFilter from manual ring buffer logic on FixedVector
to FixedRingBuffer<float>, eliminating window_head_, window_count_,
and window_size_ fields.
2026-03-12 11:07:35 -10:00
J. Nick KostonandCopilot 2f4d7eae05 Update esphome/components/web_server_base/web_server_base.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-12 10:15:58 -10:00
J. Nick Koston b20a2a12a8 [captive_portal] Fix captive portal inaccessible when web_server auth is configured
Closes https://github.com/esphome/esphome/issues/12710
2026-03-12 10:06:07 -10:00
J. Nick Koston 2c087bc2e1 Add test for set_effect with const char* literal
Ensures the const char* overload resolves the ambiguous call
reported in #14728.
2026-03-12 08:13:25 -10:00
J. Nick Koston 8884a0d163 [light] Fix ambiguous set_effect overload for const char*
When calling set_effect("None") from a lambda, the compiler cannot
choose between set_effect(optional<std::string>) and
set_effect(const std::string&) since both require one implicit
conversion from const char*. Add explicit const char* overload to
resolve the ambiguity.

Fixes https://github.com/esphome/esphome/issues/14728
2026-03-12 07:52:07 -10:00
J. Nick Koston 05d285ba86 [api] Fix heap-buffer-overflow in protobuf message dump for StringRef (#14721) 2026-03-12 07:16:53 -10:00
J. Nick Koston 186ca4e458 [uart] Allow hardware UART with single pin on RP2040 (#14725) 2026-03-12 07:16:38 -10:00
J. Nick Koston 618312f0ee [api] Fix undefined behavior in noise handshake with empty rx buffer (#14722) 2026-03-12 07:16:23 -10:00
J. Nick Koston 70d188202a [adc] Fix PICO_VSYS_PIN compile error on RP2350 boards (#14724) 2026-03-12 07:16:08 -10:00
J. Nick Koston 4a21afe7ce [ota][socket] Fix ESP8266/RP2040 OTA timeout by using SO_RCVTIMEO instead of polling (#14675) 2026-03-12 07:15:48 -10:00
J. Nick KostonandCopilot fd1d016795 [time] Fix settimeofday() failure on ESP8266 (#14707)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-12 07:15:34 -10:00
J. Nick KostonandClaude Opus 4.6 03c091adfc [esp32_ble_client] Fix disconnect race that causes stuck connections (#14211)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 07:15:21 -10:00
J. Nick Koston a3a88acfcf [socket] Fast path for TCP_NODELAY bypasses lwip_setsockopt overhead (#14693) 2026-03-12 07:15:04 -10:00
J. Nick Koston 07f8ae6c82 [socket] Fix use-after-free in LWIP PCB close/abort path (#14706) 2026-03-12 07:14:49 -10:00
Matthias Königandpre-commit-ci-lite[bot] 25c30ac5bb [mqtt] Fixed permission denied error for client certificates on Windows (#13525)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2026-03-12 12:00:08 -04:00
guillempagesandJonathan Swoboda a76767a0ab [runtime_image] Update jpegdec lib version (#14726)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2026-03-12 10:15:20 -04:00
Kevin Ahrendt 511d185772 [audio] Bump microOpus to v0.3.5 (#14727) 2026-03-12 08:56:01 -04:00
Brian Kaufman c4c19c8a6c [web_server] use DETAIL_ALL in update_all_json_generator (#14711) 2026-03-11 23:07:26 -10:00
Massimo Antonello fe2d60ccec [one_wire] allow changing address at runtime (#12150) 2026-03-12 01:52:58 -07:00
Keith Burzinski 657890695f [ledc] Fix high-pressure crash & recovery (#14720) 2026-03-12 03:16:02 -05:00
J. Nick Koston 69997bb486 Merge remote-tracking branch 'origin/ota-so-rcvtimeo' into integration 2026-03-11 22:08:30 -10:00
J. Nick Koston 216cc47e4e [socket] Extract read_locked_() so readv() never calls wait_for_data_() under lock
readv() holds LWIP_LOCK for the entire scatter-gather operation and
previously called read() internally, which would call wait_for_data_()
→ socket_delay() while the lock was held — blocking recv_fn() on RP2040.

Extract read_locked_() with the state checks and copy logic. Both
read() and readv() call wait_for_data_() before acquiring the lock,
then use read_locked_() under the lock.
2026-03-11 22:07:59 -10:00
Adam DeMuriandJ. Nick Koston 8a5f008aee [modbus] Fix buffer overflow in modbus (#14719)
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2026-03-11 22:00:26 -10:00
J. Nick Koston 40baa87e21 Merge remote-tracking branch 'origin/ota-so-rcvtimeo' into integration 2026-03-11 21:46:07 -10:00
J. Nick Koston 235d75f830 [socket] Extract waiting_for_data_() inline helper
Deduplicate the unlocked pre-check condition used in read(),
readv(), and wait_for_data_(). Safety documentation lives on
the helper in the header.
2026-03-11 21:34:25 -10:00
J. Nick Koston fe6ba153bc [socket] Fix RP2040 socket_delay race that could miss a wake
Remove the redundant s_socket_woke = false between the early-return
check and the while loop. If an IRQ fires in that window (recv_fn
sets s_socket_woke = true), clearing the flag would lose the wake
and sleep until the timer fires. Now the while loop sees the flag
immediately and exits. The flag is cleared after the loop instead.
2026-03-11 21:32:11 -10:00
J. Nick Koston fe576b1aa5 [socket] Document safety of unlocked reads in wait_for_data_/read/readv 2026-03-11 21:28:31 -10:00
J. Nick Koston ab422809f5 [socket] Simplify SO_RCVTIMEO: extract wait_for_data_() for read/readv
Replace read_locked_() approach with a simpler wait_for_data_() called
at the top of both read() and readv(), keeping the original read/readv
structure intact.
2026-03-11 21:25:20 -10:00
J. Nick Koston 96f59a11ac [socket] Release LWIP lock during SO_RCVTIMEO wait and handle spurious wakes
- Extract read_locked_() to avoid holding LWIP_LOCK during socket_delay(),
  which would block recv_fn() on RP2040 (needs async_context lock)
- Loop around socket_delay() for remaining time on spurious wakes from
  other sockets, ensuring SO_RCVTIMEO semantics are correct
- Fix readv() to use read_locked_() directly instead of calling read(),
  avoiding recursive locking and unintended socket_delay() waits
2026-03-11 21:19:51 -10:00
J. Nick Koston 5fb521f85f Merge branch 'fix-dump-buffer-strlen' into integration 2026-03-11 20:55:01 -10:00
J. Nick Koston 332f20756f Merge remote-tracking branch 'upstream/fix-noise-null-memcpy' into integration 2026-03-11 20:54:55 -10:00
J. Nick Koston 2f12865388 [api] Fix undefined behavior in noise handshake with empty rx buffer
When rx_buf_ is empty during the client hello phase of the noise
handshake, rx_buf_.data() can return nullptr. Passing nullptr to
std::memcpy as the source argument is undefined behavior even when
the size is 0. Guard the memcpy with a size check.

Found by UndefinedBehaviorSanitizer in #14718.
2026-03-11 20:49:07 -10:00
J. Nick Koston 23fd34daf3 [api] Fix heap-buffer-overflow in protobuf message dump for StringRef
StringRef fields decoded from protobuf point into the receive buffer
and are NOT null-terminated. DumpBuffer::append(const char*) calls
strlen() which reads past the buffer. Use the (const char*, size_t)
overload instead.

Found by AddressSanitizer in #14718.
2026-03-11 20:48:17 -10:00
J. Nick Koston 381ae03db9 Merge branch 'dev' into ota-so-rcvtimeo 2026-03-11 20:29:47 -10:00