Commit Graph

13621 Commits

Author SHA1 Message Date
J. Nick Koston
fd3aa3f2ef [esp32] IRAM_ATTR on dispatch, document cold path
Put IRAM_ATTR back on esp_log_format (tiny ~43 byte dispatch function)
to match esp_log_va's IRAM placement and avoid cache miss. Leave the
512-byte formatting function in flash — it's cold on 99.9% of builds
(only runs during early boot and at DEBUG framework log level).
2026-03-13 18:18:19 -10:00
J. Nick Koston
4fbd0f1595 [esp32] Rename esp_log_format_early_ to esp_log_format_direct_ 2026-03-13 18:10:30 -10:00
J. Nick Koston
dc2d241c49 [esp32] Remove IRAM_ATTR from esp_log_format override 2026-03-13 18:09:03 -10:00
J. Nick Koston
5adc673981 [esp32] Remove pointless ISR check, document flash limitation
The ISR with cache disabled case can't be handled without
esp_rom_vprintf — the caller's format string and tag are also in
flash, so even esp_rom_printf would crash. This is the same
limitation V1 had. Document it and keep the simpler code.
2026-03-13 18:07:49 -10:00
J. Nick Koston
623f7249b8 [esp32] Add ISR safety check for constrained env logging
constrained_env combines three conditions: scheduler not running,
in ISR, or cache disabled. Only the first is safe for flash access.

Check xPortInIsrContext() (IRAM-resident) explicitly:
- In ISR: output tag only via esp_rom_printf (ROM). Flash may be
  inaccessible. This matches V1 behavior where ISR logging was
  best-effort.
- Not in ISR (scheduler not running, PHY init): call flash-resident
  esp_log_format_early_ which formats the full message.

This ensures the override is safe for all constrained env cases
without pulling in esp_rom_vprintf (1.2KB IRAM).
2026-03-13 18:05:07 -10:00
J. Nick Koston
98f0e53053 [esp32] Update stale comments and remove unused includes 2026-03-13 18:01:16 -10:00
J. Nick Koston
159005e91a [esp32] Use 512-byte stack buffer for early/constrained log formatting 2026-03-13 17:59:35 -10:00
J. Nick Koston
fac141e3fd [esp32] Avoid esp_rom_vprintf and fix constrained env crash
- Route constrained env (PHY init, efuse reads) through the early
  boot path which uses vsnprintf + esp_rom_printf. This avoids both
  the fwrite lock crash on USB JTAG devices and pulling in
  esp_rom_vprintf (1.2KB IRAM).
- Call esp_log_vprint_func directly on the normal path instead of
  going through the esp_log_vprintf inline (which would reference
  esp_rom_vprintf for the constrained env dispatch).
- Remove IRAM_ATTR from esp_log_format_early_ since it's only called
  when flash is accessible (early boot and constrained env with cache
  enabled like PHY init and efuse reads).
2026-03-13 17:58:42 -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
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
Jonathan Swoboda
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
Jonathan Swoboda
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
Jonathan Swoboda
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
Thomas SAMTER
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
a6c08576be [sensor] Use FixedRingBuffer in SlidingWindowFilter, add window_size limit (#14736) 2026-03-13 10:17:40 -10:00
dependabot[bot]
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
Jonathan Swoboda
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 Swoboda
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
Michael Kerscher
15ec46abfe [vbus] add DeltaSol CS4 (Citrin Solar 1.3) (#12477) 2026-03-12 22:31:16 -07: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 Koston
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 Koston
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 Koston
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
fd8e510745 [light] Fix ambiguous set_effect overload for const char* (#14732) 2026-03-12 18:28:25 -05:00
Brian Kaufman
25c74c8f99 [OTA] Stage exact uploaded size for ESP8266 web OTA (gzip fix) (#14741) 2026-03-12 13:23:29 -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 Koston
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 Koston
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