Replace floating-point random offset calculation with integer
multiply-and-shift, eliminating soft-float calls on ESP8266 and
FPU instructions on ESP32/RP2040.
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.
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.
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.
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>
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
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>
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
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.
The RP2040 I2C bus was previously assigned Wire/Wire1 based on the order
I2C buses were defined in YAML, not based on which GPIO pins were used.
This caused I2C1 to not work when only a single bus was configured with
I2C1 pins (e.g., GPIO6/GPIO7).
Now selects the correct Wire instance using the RP2040/RP2350 GPIO pin
mapping formula: (pin / 2) % 2. Also adds config validation to catch
SDA/SCL pin mismatches and duplicate controller assignments.
Closes https://github.com/esphome/esphome/issues/14742
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.
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.