From 4a47514a2566c558d9e7b1cbd10dbe7da8455e5c Mon Sep 17 00:00:00 2001 From: Barbudor Date: Fri, 23 Dec 2022 21:17:24 +0100 Subject: [PATCH] PCF8574 input pin initialization fix (#17499) * step1 - quick test patch * mistake, pullup should be disabled * 2nd test version * refactoring * final --- tasmota/tasmota_xdrv_driver/xdrv_28_pcf8574.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_28_pcf8574.ino b/tasmota/tasmota_xdrv_driver/xdrv_28_pcf8574.ino index 25e0018fc..907329992 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_28_pcf8574.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_28_pcf8574.ino @@ -123,7 +123,9 @@ void Pcf8574Init(void) Pcf8574.max_connected_ports = 0; // reset no of devices to avoid duplicate ports on duplicate init. for (uint32_t idx = 0; idx < Pcf8574.max_devices; idx++) { // suport up to 8 boards PCF8574 uint8_t gpio = Pcf8574Read(idx); - Pcf8574.pin_mask[idx] = gpio; + // Insure the input pins are actually writen a 1 for proper input operation + Pcf8574.pin_mask[idx] = gpio | ~Settings->pcf8574_config[idx]; + Pcf8574Write(idx); // Write back to the register #ifdef USE_PCF8574_MQTTINPUT Pcf8574.last_input[idx] = gpio & ~Settings->pcf8574_config[idx]; #endif // #ifdef USE_PCF8574_MQTTINPUT