mirror of https://github.com/arendst/Tasmota.git
Merge pull request #4 from MadDoct/patch-1
update interlocking output to include the pair info
This commit is contained in:
commit
7b2d3fb3f6
|
@ -323,10 +323,17 @@ void MCP230xx_SetOutPin(uint8_t pin,uint8_t pinstate) {
|
||||||
I2cWrite8(mcp230xx_address, MCP230xx_GPIO + port, portpins);
|
I2cWrite8(mcp230xx_address, MCP230xx_GPIO + port, portpins);
|
||||||
if (Settings.flag.save_state) { // Firmware configured to save last known state in settings
|
if (Settings.flag.save_state) { // Firmware configured to save last known state in settings
|
||||||
Settings.mcp230xx_config[pin].saved_state=portpins>>(pin-(port*8))&1;
|
Settings.mcp230xx_config[pin].saved_state=portpins>>(pin-(port*8))&1;
|
||||||
|
Settings.mcp230xx_config[pin+pinadd].saved_state=portpins>>(pin+pinadd-(port*8))&1;
|
||||||
}
|
}
|
||||||
sprintf(cmnd,ConvertNumTxt(pinstate, pinmo));
|
sprintf(cmnd,ConvertNumTxt(pinstate, pinmo));
|
||||||
sprintf(stt,ConvertNumTxt((portpins >> (pin-(port*8))&1), pinmo));
|
sprintf(stt,ConvertNumTxt((portpins >> (pin-(port*8))&1), pinmo));
|
||||||
|
if (interlock && pinmo == Settings.mcp230xx_config[pin+pinadd].pinmode) {
|
||||||
|
char stt1[4];
|
||||||
|
sprintf(stt1,ConvertNumTxt((portpins >> (pin+pinadd-(port*8))&1), pinmo));
|
||||||
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"S29cmnd_D%i\":{\"COMMAND\":\"%s\",\"STATE\":\"%s\"},\"S29cmnd_D%i\":{\"STATE\":\"%s\"}}"),pin, cmnd, stt, pin+pinadd, stt1);
|
||||||
|
} else {
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_CMND_RESPONSE, pin, cmnd, stt);
|
snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_CMND_RESPONSE, pin, cmnd, stt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // USE_MCP230xx_OUTPUT
|
#endif // USE_MCP230xx_OUTPUT
|
||||||
|
|
Loading…
Reference in New Issue