@@ -628,7 +628,7 @@ void MCP23xModuleInit(void) {
628628#endif
629629 while ((Mcp23x.max_devices < MCP23XXX_MAX_DEVICES) && PinUsed (GPIO_MCP23SXX_CS, Mcp23x.max_devices )) {
630630 Mcp23x.chip = Mcp23x.max_devices ;
631- uint32_t pin_int = (Mcp23x.iocon .ODR ) ? 0 : Mcp23x.chip ; // INT pins are open-drain outputs and supposedly connected together to one GPIO
631+ uint32_t pin_int = (Mcp23x.iocon .ODR ) ? 0 : Mcp23x.chip ; // INT ODR pins are open-drain outputs and supposedly connected together to one GPIO
632632 Mcp23x.device [Mcp23x.chip ].pin_int = (PinUsed (GPIO_MCP23XXX_INT, pin_int)) ? Pin (GPIO_MCP23XXX_INT, pin_int) : -1 ;
633633 Mcp23x.device [Mcp23x.chip ].pin_cs = Pin (GPIO_MCP23SXX_CS, Mcp23x.max_devices );
634634 digitalWrite (Mcp23x.device [Mcp23x.chip ].pin_cs , 1 );
@@ -719,6 +719,8 @@ void MCP23xModuleInit(void) {
719719 return ;
720720 }
721721
722+ AddLog (LOG_LEVEL_DEBUG_MORE, PSTR (" MCP: INT open-drain %d" ), Mcp23x.iocon .ODR );
723+
722724 Mcp23x.relay_offset = TasmotaGlobal.devices_present ;
723725 Mcp23x.relay_max -= UpdateDevicesPresent (Mcp23x.relay_max );
724726
@@ -774,7 +776,8 @@ void MCP23xInit(void) {
774776 gpio = MCP23xRead16 (MCP23X17_GPIOA); // Clear MCP23x17 interrupt
775777 }
776778 if (Mcp23x.iocon .ODR && Mcp23x.chip ) { continue ; }
777- pinMode (Mcp23x.device [Mcp23x.chip ].pin_int , (Mcp23x.iocon .ODR ) ? INPUT_PULLUP : INPUT);
779+ // pinMode(Mcp23x.device[Mcp23x.chip].pin_int, (Mcp23x.iocon.ODR) ? INPUT_PULLUP : INPUT);
780+ pinMode (Mcp23x.device [Mcp23x.chip ].pin_int , INPUT_PULLUP);
778781 attachInterrupt (Mcp23x.device [Mcp23x.chip ].pin_int , MCP23xInputIsr, (Mcp23x.iocon .ODR ) ? FALLING : CHANGE);
779782 }
780783 }
0 commit comments