Merge pull request #6524 from andrethomas/mcp230xx

Mcp230xx - Add 1 and 0 as option for ON and OFF
This commit is contained in:
Theo Arends 2019-09-30 17:53:45 +02:00 committed by GitHub
commit b850ac1231
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -5,6 +5,7 @@
* Add initial support for MQTT logging using command MqttLog <loglevel> (#6498) * Add initial support for MQTT logging using command MqttLog <loglevel> (#6498)
* Add Zigbee more support - collect endpoints and clusters, added ZigbeeDump command * Add Zigbee more support - collect endpoints and clusters, added ZigbeeDump command
* Add initial support for shutters by Stefan Bode (#288) * Add initial support for shutters by Stefan Bode (#288)
* Add use case for sensor29 pin,1 and sensor29 pin,0 to substitute ON and OFF respectively with MCP230xx driver
* *
* 6.6.0.13 20190922 * 6.6.0.13 20190922
* Add command EnergyReset4 x,x to initialize total usage for two tarrifs * Add command EnergyReset4 x,x to initialize total usage for two tarrifs

View File

@ -628,11 +628,11 @@ bool MCP230xx_Command(void) {
#ifdef USE_MCP230xx_OUTPUT #ifdef USE_MCP230xx_OUTPUT
if (Settings.mcp230xx_config[pin].pinmode >= 5) { if (Settings.mcp230xx_config[pin].pinmode >= 5) {
uint8_t pincmd = Settings.mcp230xx_config[pin].pinmode - 5; uint8_t pincmd = Settings.mcp230xx_config[pin].pinmode - 5;
if (!strcmp(subStr(sub_string, XdrvMailbox.data, ",", 2), "ON")) { if ((!strcmp(subStr(sub_string, XdrvMailbox.data, ",", 2), "ON")) || (!strcmp(subStr(sub_string, XdrvMailbox.data, ",", 2), "1"))) {
MCP230xx_SetOutPin(pin,abs(pincmd-1)); MCP230xx_SetOutPin(pin,abs(pincmd-1));
return serviced; return serviced;
} }
if (!strcmp(subStr(sub_string, XdrvMailbox.data, ",", 2), "OFF")) { if ((!strcmp(subStr(sub_string, XdrvMailbox.data, ",", 2), "OFF")) || (!strcmp(subStr(sub_string, XdrvMailbox.data, ",", 2), "0"))) {
MCP230xx_SetOutPin(pin,pincmd); MCP230xx_SetOutPin(pin,pincmd);
return serviced; return serviced;
} }