From 06833d6f8b06917f5ddd46b87ae002ddcf7ee2f1 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 4 Sep 2025 14:36:27 -0500 Subject: [PATCH] [sx1509] Migrate to CachedGpioExpander to reduce I2C bus usage --- esphome/components/sx1509/sx1509.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/esphome/components/sx1509/sx1509.cpp b/esphome/components/sx1509/sx1509.cpp index ea3d5a6adb..a7f2e446e3 100644 --- a/esphome/components/sx1509/sx1509.cpp +++ b/esphome/components/sx1509/sx1509.cpp @@ -77,15 +77,12 @@ void SX1509Component::loop() { } bool SX1509Component::digital_read_hw(uint8_t pin) { - if (this->ddr_mask_ & (1 << pin)) { - if (!this->read_byte_16(REG_DATA_B, &this->input_mask_)) - return false; - return true; - } - return false; + // Always read all pins when any input pin is accessed + return this->read_byte_16(REG_DATA_B, &this->input_mask_); } bool SX1509Component::digital_read_cache(uint8_t pin) { + // Return cached value for input pins, false for output pins if (this->ddr_mask_ & (1 << pin)) { return this->input_mask_ & (1 << pin); }