From 7a235cc8ef57572bac23f5afb378b226fac9ceee Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 10 Nov 2018 10:48:28 +0100 Subject: [PATCH] Fix shelly2 ghost switching Fix shelly2 ghost switching caused by lack of pull-up inputs (#4255) --- sonoff/_changelog.ino | 1 + sonoff/sonoff.ino | 6 ++++-- sonoff/sonoff_template.h | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 83a3eb644..1fae97a15 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,6 +1,7 @@ /* 6.3.0.5 20181107 * Add code image and optional commit number to version * Add support for Gosund SP1 v2.3 Power Socket with Energy Monitoring (#4297) + * Fix shelly2 ghost switching caused by lack of pull-up inputs (#4255) * * 6.3.0.4 20181106 * Add command SetSensorXX 0/1 to disable/re-enable compiled xsns_XX_sensor.ino driver diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index c4b0cbb20..e92536a1b 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -2383,8 +2383,9 @@ void SerialInput() void GpioSwitchPinMode(uint8_t index) { if (pin[GPIO_SWT1 +index] < 99) { -// pinMode(pin[GPIO_SWT1 +index], (16 == pin[GPIO_SWT1 +index]) ? INPUT_PULLDOWN_16 : bitRead(switch_no_pullup, index) ? INPUT : INPUT_PULLUP); - + pinMode(pin[GPIO_SWT1 +index], (16 == pin[GPIO_SWT1 +index]) ? INPUT_PULLDOWN_16 : bitRead(switch_no_pullup, index) ? INPUT : INPUT_PULLUP); +/* + // Re-enable pull-up on Shelly2 as of 20181110 (#4255) uint8_t no_pullup = bitRead(switch_no_pullup, index); // 0 = INPUT_PULLUP, 1 = INPUT if (no_pullup) { if (SHELLY2 == Settings.module) { @@ -2393,6 +2394,7 @@ void GpioSwitchPinMode(uint8_t index) } } pinMode(pin[GPIO_SWT1 +index], (16 == pin[GPIO_SWT1 +index]) ? INPUT_PULLDOWN_16 : (no_pullup) ? INPUT : INPUT_PULLUP); +*/ } } diff --git a/sonoff/sonoff_template.h b/sonoff/sonoff_template.h index 642914a53..2735ac76e 100644 --- a/sonoff/sonoff_template.h +++ b/sonoff/sonoff_template.h @@ -1125,9 +1125,9 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_REL1, // GPIO04 GPIO_REL2, // GPIO05 0, 0, 0, 0, 0, 0, // Flash connection - GPIO_SWT1_NP, // GPIO12 + GPIO_SWT1, // GPIO12 0, - GPIO_SWT2_NP, // GPIO14 + GPIO_SWT2, // GPIO14 0, // GPIO15 MCP39F501 Reset 0, 0 },