From 867df4225aa241a555f5143461888fbe64147564 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 9 Apr 2026 16:55:41 -1000 Subject: [PATCH] [sx1509] Clear interrupt source before resetting cache --- esphome/components/sx1509/sx1509.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/esphome/components/sx1509/sx1509.cpp b/esphome/components/sx1509/sx1509.cpp index ab2b8ac0365..81e0fc592f3 100644 --- a/esphome/components/sx1509/sx1509.cpp +++ b/esphome/components/sx1509/sx1509.cpp @@ -52,15 +52,15 @@ void SX1509Component::dump_config() { } void SX1509Component::loop() { - // Reset cache at the start of each loop - this->reset_pin_cache_(); if (this->interrupt_pin_ != nullptr) { - // Clear interrupt source to deassert INT line + // Clear interrupt source before resetting cache to avoid losing + // pin changes that occur between cache reset and interrupt clear uint16_t interrupt_source = 0; this->read_byte_16(REG_INTERRUPT_SOURCE_B, &interrupt_source); - if (!this->has_keypad_) { - this->disable_loop(); - } + } + this->reset_pin_cache_(); + if (this->interrupt_pin_ != nullptr && !this->has_keypad_) { + this->disable_loop(); } if (this->has_keypad_) {