From 55691affaa961acb02df0c26a50ac2cd98b04cba Mon Sep 17 00:00:00 2001 From: andrethomas Date: Sat, 21 Jul 2018 14:24:34 +0200 Subject: [PATCH] Bugfix on MCP230xx driver --- sonoff/xsns_29_mcp230xx.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sonoff/xsns_29_mcp230xx.ino b/sonoff/xsns_29_mcp230xx.ino index 46846a7a0..2df5f80da 100644 --- a/sonoff/xsns_29_mcp230xx.ino +++ b/sonoff/xsns_29_mcp230xx.ino @@ -213,9 +213,9 @@ void MCP230xx_ApplySettings(void) { uint8_t reg_iodir = 0xFF; for (uint8_t idx = 0; idx < 8; idx++) { if (Settings.mcp230xx_config[idx].enable) { + reg_iodir |= (1 << idx); // Force pin to input state if enabled if (Settings.mcp230xx_config[idx].inten) { // Int is enabled in some form or another reg_gpinten |= (1 << idx); - reg_iodir |= (1 << idx); // Force pin to input state if enabled } if (Settings.mcp230xx_config[idx].pullup) { reg_gppu |= (1 << idx); @@ -231,9 +231,9 @@ void MCP230xx_ApplySettings(void) { reg_iodir = 0xFF; for (uint8_t idx = 8; idx < 16; idx++) { if (Settings.mcp230xx_config[idx].enable) { + reg_iodir |= (1 << idx - 8); // Force pin to input state if enabled if (Settings.mcp230xx_config[idx].inten) { // Int is enabled in some form or another reg_gpinten |= (1 << idx - 8); - reg_iodir |= (1 << idx - 8); // Force pin to input state if enabled } if (Settings.mcp230xx_config[idx].pullup) { reg_gppu |= (1 << idx - 8);