Commit Graph
13296 Commits
Author SHA1 Message Date
J. Nick Koston fde32555dc Restrict wake_loop_any_context to ESP32 only
LibreTiny lacks IRAM_ATTR support needed for ISR-safe paths,
and BK72xx doesn't support the mrs ipsr instruction in Thumb mode.
The existing fast select functionality on LibreTiny is unaffected.
2026-02-28 16:32:05 -10:00
J. Nick Koston fcb21998f8 Guard portYIELD_FROM_ISR with USE_ESP32
LibreTiny's FreeRTOS port does not provide portYIELD_FROM_ISR.
On ARM Cortex-M, FreeRTOS internally sets the PendSV bit when
vTaskNotifyGiveFromISR wakes a higher-priority task, so the
context switch happens automatically when the ISR returns.
2026-02-28 15:35:48 -10:00
J. Nick Koston 54126fef36 Only set USE_LWIP_FAST_SELECT when select support is available
The fast select code paths and wake_loop_any_context() require
USE_SOCKET_SELECT_SUPPORT. Gate USE_LWIP_FAST_SELECT on not using
lwip_tcp implementation which does not provide select() support.
2026-02-28 15:08:30 -10:00
J. Nick Koston 9f7508e50b Add IRAM_ATTR to esphome_get_ipsr for future-proofing
Currently a no-op on LibreTiny but ensures the function stays
in IRAM if the platform later defines IRAM_ATTR.
2026-02-28 15:01:52 -10:00
J. Nick Koston fb998468b5 Fix comment about function calls and initialize ipsr
- Update ISR safety comment: point 3 now reflects that
  wake_loop_any_context() is called (ISR-safe)
- Initialize ipsr = 0 as safety net before inline asm
2026-02-28 15:01:37 -10:00
J. Nick Koston bdeba1710e Address review feedback for ISR wake support
- Replace __get_IPSR() with inline asm to avoid CMSIS header dependency
  on LibreTiny chip families that may not declare it (e.g. beken-72xx)
- Pass local variable to wake_from_isr and call portYIELD_FROM_ISR for
  immediate context switch instead of passing NULL
- Update comment in component.cpp to mention both ESP32 and LibreTiny
  platform-specific context detection
- Switch USE_LWIP_FAST_SELECT from cg.add_define to cg.add_build_flag
  so it is visible in .c translation units, aligning guards across all
  source files
2026-02-28 14:54:05 -10:00
J. Nick Koston ec8d2b5f0d Merge remote-tracking branch 'upstream/dev' into isr-wake-enable-loop-soon 2026-02-28 14:29:15 -10:00
J. Nick KostonandCopilot 3f97b3b706 [core] Extract set_status_flag_ helper to deduplicate status_set methods (#14384)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-28 14:27:06 -10:00
J. Nick Koston 82e620bcf5 [ld2450] Single-pass zone target counting (#14387) 2026-02-28 14:26:55 -10:00
J. Nick Koston 80e0761bf1 [ld2450] Use integer dedup for direction text sensor updates (#14386) 2026-02-28 14:26:31 -10:00
J. Nick Koston c0781d3680 [ld2450] Use atan2f for angle calculation (#14388) 2026-02-28 14:26:08 -10:00
J. Nick Koston b7cb65ec49 [ci] Fix TypeError in ci-custom.py when POST lint checks fail (#14378) 2026-02-28 14:23:20 -10:00
J. Nick Koston fdbfac15db [uart] Replace wake-on-RX task+queue with direct ISR callback (#14382) 2026-03-01 00:21:08 +00:00
J. Nick KostonandCopilot 28424d6acd [ld2410][ld2412] Fix signed char causing incorrect distance values (#14380)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-28 23:50:12 +00:00
J. Nick Koston b679b04d14 [core] Move CONF_STOP_BITS, CONF_DATA_BITS, CONF_PARITY to const.py (#14379) 2026-02-28 13:27:33 -10:00
J. Nick Koston d43aa2ea90 Merge branch 'uart-isr-wake-on-rx' into isr-wake-enable-loop-soon 2026-02-28 13:16:24 -10:00
Jonathan SwobodaandCopilot b7d651dd17 [core] Defer entity automation codegen to prevent sibling ID deadlocks (#14381)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-28 13:10:53 -10:00
J. Nick Koston e7fc69e453 reorder 2026-02-28 12:26:31 -10:00
J. Nick Koston 2d4117f370 [core] Wake main loop from any context in enable_loop_soon_any_context()
enable_loop_soon_any_context() sets volatile flags but does not wake
the main loop from ulTaskNotifyTake() sleep. This means components
using ISR-driven state changes (e.g. GPIO binary sensors) wait up
to ~16ms for the select timeout before their loop runs.

Add wake_loop_any_context() that detects the calling context (ISR vs
task) using xPortInIsrContext() (ESP32) or __get_IPSR() (LibreTiny)
and calls the appropriate FreeRTOS API. This is safe from ISR, thread,
and main loop contexts.

Also relax the wake_loop_isrsafe() guard from requiring both
USE_WAKE_LOOP_THREADSAFE and USE_LWIP_FAST_SELECT to just
USE_LWIP_FAST_SELECT, since the ISR wake path uses
vTaskNotifyGiveFromISR directly and does not depend on the
UDP socket mechanism.
2026-02-28 11:15:26 -10:00
J. Nick Koston 59db01e8d7 Fix IRAM_ATTR not defined on LibreTiny (bk72xx)
IRAM_ATTR is defined by esp_attr.h on ESP32 but not on LibreTiny.
Add a no-op fallback in the C file since hal.h (which defines it
for C++) cannot be included from C.
2026-02-28 11:15:17 -10:00
J. Nick Koston 3c5d877d96 Fix clang-tidy naming: snake_case params, no trailing underscore on static method
- pxHigherPriorityTaskWoken → px_higher_priority_task_woken
- uart_rx_isr_callback_ → uart_rx_isr_callback
2026-02-28 10:53:52 -10:00
J. Nick Koston 89c43b49c2 [uart] Replace wake-on-RX task+queue with direct ISR callback
Use the ESP-IDF UART driver's uart_set_select_notif_callback() to wake
the main loop directly from the UART ISR via vTaskNotifyGiveFromISR(),
eliminating the FreeRTOS trampoline task and event queue that were
previously needed when wake_loop_threadsafe() used a UDP loopback socket.

With fast lwip select, the main loop sleeps on ulTaskNotifyTake(), so
the ISR-safe vTaskNotifyGiveFromISR() can wake it directly.

Saves ~2.6KB RAM per UART instance with wake-on-RX enabled:
- 2,240 bytes FreeRTOS task stack
- ~340 bytes event queue (20 entries + control block)
- 8 bytes QueueHandle_t + TaskHandle_t fields

Also adds Application::wake_loop_isrsafe() as the ISR-safe counterpart
to wake_loop_threadsafe(), backed by esphome_lwip_wake_main_loop_from_isr().
2026-02-28 10:40:33 -10:00
J. Nick Koston 757e8d90e6 [core] Inline set_component_state_ and use it in Application (#14369) 2026-02-28 07:20:34 -10:00
J. Nick Koston 7d52a9587f [api] Outline keepalive ping logic from APIConnection::loop() (#14374) 2026-02-28 07:20:20 -10:00
J. Nick Koston 067d773aac [core] Make register_component protected, remove runtime checks (#14371) 2026-02-28 07:19:55 -10:00
Clyde Stubbs 089d1e55e7 [mipi_dsi] Fix Waveshare P4 7B board config (#14372) 2026-02-28 20:37:04 +11:00
Raymond Richmond 6c0998f220 [gt911] Support for interrupt signal via IO Expander (#14358) 2026-02-28 18:26:06 +11:00
J. Nick KostonandClaude Opus 4.6 49cc389bf0 [esp32] Wrap printf/vprintf/fprintf to eliminate _vfprintf_r (~11 KB flash) (#14362)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 17:28:05 -10:00
J. Nick Koston 8480e8df9f [uart] Revert UART0 default pin workarounds (fixed in ESP-IDF 5.5.2) (#14363) 2026-02-27 17:27:51 -10:00
J. Nick Koston e7d4f2608b [sen6x] Fix test sensor ID collisions with sen5x (#14367) 2026-02-27 16:01:17 -10:00
Ryan Wagoner d1b4813197 [web_server] Add climate preset, fan mode, and humidity support (#14061) 2026-02-27 14:20:13 -10:00
Jonathan SwobodaandCopilot 298ee7b92e [gps] Fix codegen deadlock when automations reference sibling sensors (#14365)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-27 19:08:42 -05:00
J. Nick Koston 5c56b99742 [ci] Fix C++ unit tests missing time component dependency (#14364) 2026-02-27 13:19:11 -10:00
b9d70dcda2 [sen6x] Add SEN6x sensor support (#12553)
Co-authored-by: Martin Ebner <martinebner@me.com>
Co-authored-by: Tobias Stanzel <tobi.stanzel@gmail.com>
Co-authored-by: Big Mike <mike@bigmike.land>
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2026-02-27 16:41:28 -05:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 5e3857abf7 Bump click from 8.1.7 to 8.3.1 (#11955)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-27 16:25:36 -05:00
Laura WrattenandJonathan Swoboda bb567827a1 [sht3xd] Allow sensors that don't support serial number read (#14224)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2026-02-27 16:23:32 -05:00
J. Nick KostonandClaude Opus 4.6 280f874edc [rp2040] Use native time_us_64() for millis_64() (#14356)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 11:18:02 -10:00
Jonathan SwobodaandCopilot f6755aabae [ci] Add PR title format check (#14345)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-27 15:18:07 -05:00
J. Nick Koston 52af4bced0 [component] Devirtualize call_dump_config (#14355) 2026-02-27 10:01:23 -10:00
J. Nick KostonandClaude Opus 4.6 63e757807e [zephyr] Use native k_uptime_get() for millis_64() (#14350)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 10:01:09 -10:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> edd63e3d2d Bump actions/download-artifact from 7.0.0 to 8.0.0 (#14327)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-27 14:43:10 -05:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 32133e2f46 Bump ruff from 0.15.3 to 0.15.4 (#14357)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-27 14:42:20 -05:00
Clyde Stubbs 2255c68377 [esp32] Enable execute_from_psram for P4 (#14329) 2026-02-28 06:40:55 +11:00
J. Nick Koston 9c1d1a0d9f [color] Use integer math in Color::gradient to reduce code size (#14354) 2026-02-27 19:25:13 +00:00
J. Nick KostonandClaude Opus 4.6 8698b01bc7 [host] Use native clock_gettime for millis_64() (#14340)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 18:54:13 +00:00
J. Nick KostonandCopilot 3411ce2150 [core] Fix Application asm label for Mach-O using __USER_LABEL_PREFIX__ (#14334)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-27 08:49:57 -10:00
J. Nick Koston 29e1e8bdfd [wifi] Add LibreTiny component test configs (#14351) 2026-02-27 18:45:20 +00:00
J. Nick Koston 317dd5b2da [ci] Skip memory impact target branch build when tests don't exist (#14316) 2026-02-27 08:42:08 -10:00
Michael CassanitiandJonathan Swoboda 4ae7633418 [safe_mode] Add feature to explicitly mark a boot as successful (#14306)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2026-02-27 13:23:02 -05:00
J. Nick Koston c3a0eeceec [wifi] Use direct SDK APIs for LibreTiny SSID retrieval (#14349) 2026-02-27 18:17:17 +00:00