1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-02 19:32:19 +01:00

Fix xl9535 pin reads (#6242)

This commit is contained in:
Jesse Hills
2024-02-19 16:44:18 +13:00
parent 6eb3c65445
commit cc1813f5b9

View File

@@ -36,14 +36,14 @@ bool XL9535Component::digital_read(uint8_t pin) {
return state;
}
state = (port & (pin - 10)) != 0;
state = (port & (1 << (pin - 10))) != 0;
} else {
if (this->read_register(XL9535_INPUT_PORT_0_REGISTER, &port, 1) != i2c::ERROR_OK) {
this->status_set_warning();
return state;
}
state = (port & pin) != 0;
state = (port & (1 << pin)) != 0;
}
this->status_clear_warning();