mirror of https://github.com/arendst/Tasmota.git
Merge pull request #3556 from MadDoct/development
Correct bug with toggle command and pinmode 6 when using interlocking
This commit is contained in:
commit
0cee695df4
|
@ -68,9 +68,7 @@ const char MCP230XX_CMND_RESPONSE[] PROGMEM = "{\"S29cmnd_D%i\":{\"COMMAND\":\"%
|
|||
|
||||
const char* ConvertNumTxt(uint8_t statu, uint8_t pinmod=0) {
|
||||
#ifdef USE_MCP230xx_OUTPUT
|
||||
if (pinmod == 6) {
|
||||
if (statu < 2) statu = abs(statu-1);
|
||||
}
|
||||
if (pinmod == 6 && statu < 2) statu = abs(statu-1);
|
||||
#endif // USE_MCP230xx_OUTPUT
|
||||
switch (statu) {
|
||||
case 0:
|
||||
|
@ -300,7 +298,7 @@ void MCP230xx_SetOutPin(uint8_t pin,uint8_t pinstate) {
|
|||
uint8_t pinmo = Settings.mcp230xx_config[pin].pinmode;
|
||||
uint8_t interlock = Settings.flag.interlock;
|
||||
int pinadd = (pin % 2)+1-(3*(pin % 2)); //check if pin is odd or even and convert to 1 (if even) or -1 (if odd)
|
||||
char cmnd[7], stt[7];
|
||||
char cmnd[7], stt[4];
|
||||
if (pin > 7) port=1;
|
||||
portpins = MCP230xx_readGPIO(port);
|
||||
if (interlock && pinmo == Settings.mcp230xx_config[pin+pinadd].pinmode) {
|
||||
|
@ -310,9 +308,13 @@ void MCP230xx_SetOutPin(uint8_t pin,uint8_t pinstate) {
|
|||
} else {
|
||||
if (pinstate) portpins &= ~(1 << pin+pinadd-(port*8)),portpins |= (1 << pin-(port*8)); else portpins &= ~(1 << pin-(port*8));
|
||||
}
|
||||
} else {
|
||||
if (pinmo == 6) {
|
||||
portpins |= (1 << pin+pinadd-(port*8)),portpins ^= (1 << pin-(port*8));
|
||||
} else {
|
||||
portpins &= ~(1 << pin+pinadd-(port*8)),portpins ^= (1 << pin-(port*8));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (pinstate < 2) {
|
||||
if (pinstate) portpins |= (1 << pin-(port*8)); else portpins &= ~(1 << pin-(port*8));
|
||||
|
|
Loading…
Reference in New Issue