Commit Graph
27330 Commits
Author SHA1 Message Date
830517a98f [mitsubishi_cn105] Add climate component for Mitsubishi A/C units with CN105 connector (Part 3) (#15437)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick+github@koston.org>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2026-04-04 12:40:05 -10:00
J. Nick Koston 59969d4743 Simplify loop(): single yield_with_select_ call 2026-04-04 12:22:44 -10:00
J. Nick Koston c74889de67 Fix clang-tidy: rename wake_loop_impl_ to wake_loop_impl (no trailing underscore on free functions) 2026-04-04 12:10:42 -10:00
J. Nick Koston 58ab4866a6 Document Zephyr as the only platform without wake 2026-04-04 11:59:04 -10:00
J. Nick Koston 36b3d35d15 Fix Zephyr build: add fallback wakeable_delay and wake_loop_threadsafe 2026-04-04 11:58:33 -10:00
J. Nick Koston ac95bde627 Move RP2040 wakeable_delay to wake.cpp (file-scope state for alarm callback) 2026-04-04 11:49:22 -10:00
J. Nick Koston 113edd2076 Fix CI: remove redundant (void) in main_task.h, restore lwip_fast_select.h include for socket monitoring 2026-04-04 11:46:21 -10:00
J. Nick Koston 277c4f6343 Filter main_task.c and lwip_fast_select.c from platforms that don't need them 2026-04-04 11:45:44 -10:00
J. Nick Koston 1dc0559e20 Inline main_task notify helpers in header, simplify wake.h 2026-04-04 11:40:55 -10:00
J. Nick Koston 6dcdefe179 Move task notification helpers to main_task.c/h, deduplicate ESP32/LibreTiny in wake.h 2026-04-04 11:39:10 -10:00
J. Nick Koston a1e6a89fc8 Share task handle between wake.h and lwip_fast_select via main_task.h 2026-04-04 11:36:49 -10:00
J. Nick Koston 36d2b78c18 Unify ESP32/LibreTiny wake: always use g_main_task_handle, remove lwip_fast_select dependency 2026-04-04 11:34:10 -10:00
J. Nick Koston 63b8275e23 Fix ISR safety: ESP32 without fast select needs xPortInIsrContext detection 2026-04-04 11:30:45 -10:00
J. Nick Koston aa0e56bfde Fix ESP32/LibreTiny without fast select: use FreeRTOS task notifications directly 2026-04-04 11:28:21 -10:00
J. Nick Koston 80ff9f365b Fix wake.cpp: move includes outside namespace to fix cpptests build 2026-04-04 11:21:52 -10:00
J. Nick Koston cb3791ae8a Deduplicate g_main_loop_woke definition in wake.cpp 2026-04-04 11:18:54 -10:00
J. Nick Koston e2cb5df6c8 Simplify host check in socket to_code: use CORE.is_host 2026-04-04 11:17:12 -10:00
J. Nick Koston 75a2b23bdb Replace USE_SOCKET_SELECT_SUPPORT with USE_HOST 2026-04-04 11:16:41 -10:00
J. Nick Koston 5dd43bca2d Simplify wake.h file doc 2026-04-04 11:11:13 -10:00
J. Nick Koston 7e8d3ba13e Inline RP2040 wakeable_delay using function-local static + lambda callback 2026-04-04 11:08:41 -10:00
J. Nick Koston 0bf0fc7eb8 Inline ESP8266 wakeable_delay (no static state, 5 lines) 2026-04-04 11:07:41 -10:00
J. Nick Koston aaead7b5eb Move wakeable_delay into namespace internal to signal it's not public API 2026-04-04 11:07:01 -10:00
J. Nick Koston 95e8a22250 Fix wake_loop_isrsafe comment: ESP32 only, not LibreTiny 2026-04-04 11:03:07 -10:00
J. Nick Koston ad3c92e3f7 Remove unused wakeable_delay on host 2026-04-04 11:01:11 -10:00
J. Nick Koston edc5ec62e0 Fix socket to_code: USE_SOCKET_SELECT_SUPPORT only for BSD sockets on host 2026-04-04 10:59:58 -10:00
J. Nick Koston f3778edc69 Clean up dead lwip code paths under USE_SOCKET_SELECT_SUPPORT (now host-only) 2026-04-04 10:56:30 -10:00
J. Nick Koston 4be95e274d Fix host platform: use POSIX socket APIs instead of lwip_* 2026-04-04 10:55:25 -10:00
J. Nick Koston 843b63edb4 Move host wake_loop_threadsafe from application.cpp to wake.cpp 2026-04-04 10:53:15 -10:00
J. Nick Koston d3586c76ba Deduplicate wakeable_delay call in yield_with_select_ 2026-04-04 10:52:24 -10:00
J. Nick Koston 8cbf3e354b Define wakeable_delay on all platforms, simplify yield_with_select_ 2026-04-04 10:49:22 -10:00
J. Nick Koston eac783697a Fix cpptests build: handle defines.h having both USE_ESP32 and USE_HOST 2026-04-04 10:48:30 -10:00
J. Nick Koston 18ad20a1bd Add binary sensors on interrupt-enabled hubs to exercise pin_mode path 2026-04-04 10:45:46 -10:00
J. Nick Koston ffb2fe5f10 Stop setting USE_SOCKET_SELECT_SUPPORT on fast-select platforms
USE_SOCKET_SELECT_SUPPORT now exclusively means 'host select() fallback'.
ESP32/LibreTiny use USE_LWIP_FAST_SELECT instead. This eliminates
all 'USE_SOCKET_SELECT_SUPPORT && !USE_LWIP_FAST_SELECT' guards.
2026-04-04 10:44:45 -10:00
J. Nick Koston 88d7198fa4 Add wakeable_delay for ESP32/LibreTiny using ulTaskNotifyTake 2026-04-04 10:40:14 -10:00
J. Nick Koston bfad79f34c Replace unreachable delay fallback with #error 2026-04-04 10:38:27 -10:00
J. Nick Koston 91bfa8d4fa Make wake_loop_any_context available on all platforms including host 2026-04-04 10:37:35 -10:00
J. Nick Koston 72c7fc25b4 Restrict wake_loop_isrsafe to ESP32 only 2026-04-04 10:34:49 -10:00
J. Nick Koston 04b40f8f15 Clean up comments in application.h 2026-04-04 10:32:49 -10:00
J. Nick Koston e372440ed2 [core] Move wake_loop out of socket component into core
Wake primitives (esp_schedule, __sev, FreeRTOS task notifications)
are platform SDK functions that don't depend on the socket/network
stack. Move them to esphome/core/wake.h/.cpp so they work
unconditionally on all platforms.

This eliminates the require_wake_loop_threadsafe() boilerplate,
the USE_WAKE_LOOP_THREADSAFE define, and the socket AUTO_LOAD
entries that 12 components needed just to use wake.

wake_loop_threadsafe() and wake_loop_any_context() now just work
on every platform without opt-in.
2026-04-04 10:32:32 -10:00
J. Nick Koston 173195ee1b Add comments explaining why latched interrupts are not cleared at setup 2026-04-04 10:22:50 -10:00
J. Nick Koston af87f21e68 Remove unnecessary latched interrupt clearing during setup
A latched interrupt at boot is harmless - the ISR fires immediately,
loop runs, cache invalidates, and a normal read cycle clears it.
The extra register reads added unnecessary complexity.
2026-04-04 10:22:19 -10:00
J. Nick Koston aeb8e9413b Clear latched MCP23xxx interrupts during setup, fix uint8_t truncation
- MCP23008/MCP23S08: Read GPIO register before attaching ISR to clear
  any latched interrupt from a previous MCU run (chip may stay powered)
- MCP23017/MCP23S17: Read both GPIOA and GPIOB to clear latched state
- PI4IOE5V6408: Add explicit static_cast<uint8_t> for ~mode_mask_ to
  avoid implicit int-to-uint8_t truncation
2026-04-04 10:21:28 -10:00
J. Nick Koston 1e9e5ca763 Fix pin_interrupt_mode overriding auto-enabled CHANGE interrupt
MCP23XXXGPIOPin::setup() calls pin_interrupt_mode(pin, NO_INTERRUPT)
after pin_mode() already auto-enabled CHANGE, undoing the auto-enable.
Skip the explicit pin_interrupt_mode call when interrupt_pin is
configured and the user didn't override the default.
2026-04-04 10:05:00 -10:00
J. Nick Koston 85036d64d9 Fix MCP23x17 MIRROR bit, add dump_config logging, and clear PI4IOE5V6408 latched interrupts
- MCP23017/MCP23S17: Enable MIRROR bit in IOCON when interrupt_pin is
  configured so INTA and INTB are ORed together, allowing a single
  interrupt wire to catch changes on all 16 pins
- All MCP23xxx variants: Log interrupt_pin in dump_config for debugging
- PI4IOE5V6408: Read interrupt status register during setup to clear
  any latched state that could hold INT line low
- MCP23XXXBase: Move setup_interrupt_pin_() to protected visibility
2026-04-04 10:03:40 -10:00
J. Nick Koston 8234512a89 Auto-enable chip-level interrupts for input pins
- MCP23x08/x17: auto-enable CHANGE interrupt mode in pin_mode() when
  interrupt_pin is configured, so users don't need to manually set
  interrupt: CHANGE on every pin
- PI4IOE5V6408: write interrupt enable mask for input pins in
  write_gpio_modes_() when interrupt_pin is configured
2026-04-04 09:44:59 -10:00
J. Nick Koston d1e737280f Fix ESP8266 SPI test pin conflict: use GPIO0 for interrupt_pin 2026-04-04 09:18:04 -10:00
J. Nick Koston 3773ff9a98 Fix clang-tidy: rename setup_interrupt_pin_ to setup_interrupt_pin 2026-04-04 09:17:29 -10:00
J. Nick Koston 41e09c1e6c [mcp23xxx][pi4ioe5v6408] Add optional interrupt pin to eliminate polling
Extend interrupt_pin support to MCP23008, MCP23017, MCP23S08, MCP23S17,
and PI4IOE5V6408 GPIO expander components. Same approach as PCF8574/PCA9554:
when configured, the component disables its loop and only wakes on interrupt,
and the cache stays valid between interrupts so binary sensors return from
cache instead of doing I2C/SPI reads every loop iteration.

For MCP23xxx, the interrupt_pin config and C++ logic lives in the shared
MCP23XXXBase template class, so all four variants (I2C 8/16-pin, SPI
8/16-pin) inherit it automatically.

Inspired by jesserockz's work in #11959 which proposed a more comprehensive
interrupt-driven approach with per-pin interrupt status register reading.
This implementation takes a simpler path by leveraging the existing
CachedGpioExpander cache invalidation mechanism.
2026-04-04 09:12:09 -10:00
J. Nick Koston ec11c17e74 Merge remote-tracking branch 'upstream/pcf8574-pca9554-interrupt-pin' into integration 2026-04-04 09:08:11 -10:00
J. Nick Koston 9f3fb37d12 Remove duplicate @brief line in cached_gpio.h 2026-04-04 08:59:09 -10:00