mirror of
https://github.com/esphome/esphome.git
synced 2026-09-16 01:28:39 +00:00
[sx1509] Clear interrupt source before resetting cache
This commit is contained in:
@@ -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_) {
|
||||
|
||||
Reference in New Issue
Block a user