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 1/2] 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 }, From 9872f942ae12ddbd4c849e6586c3ab3c6148da30 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 10 Nov 2018 15:10:58 +0100 Subject: [PATCH 2/2] 6.3.0.6 Change GUI page load 6.3.0.6 20181110 * Change GUI Configure Module by using AJAX for data fetch to cut page size (and memory use) by 40% --- sonoff/_changelog.ino | 5 ++- sonoff/sonoff_version.h | 2 +- sonoff/xdrv_01_webserver.ino | 73 +++++++++++++++++++++--------------- 3 files changed, 47 insertions(+), 33 deletions(-) diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 1fae97a15..01108f603 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,4 +1,7 @@ -/* 6.3.0.5 20181107 +/* 6.3.0.6 20181110 + * Change GUI Configure Module by using AJAX for data fetch to cut page size (and memory use) by 40% + * + * 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) diff --git a/sonoff/sonoff_version.h b/sonoff/sonoff_version.h index aef909e8a..7f25e0ebc 100644 --- a/sonoff/sonoff_version.h +++ b/sonoff/sonoff_version.h @@ -20,7 +20,7 @@ #ifndef _SONOFF_VERSION_H_ #define _SONOFF_VERSION_H_ -#define VERSION 0x06030005 +#define VERSION 0x06030006 #define D_PROGRAMNAME "Sonoff-Tasmota" #define D_AUTHOR "Theo Arends" diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index c645808eb..37d63d566 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -84,7 +84,7 @@ const char HTTP_HEAD[] PROGMEM = "function lc(p){" "la('?t='+p);" // ?t related to WebGetArg("t", tmp, sizeof(tmp)); "}"; - + const char HTTP_HEAD_RELOAD[] PROGMEM = "setTimeout(function(){location.href='.';},4000);"; @@ -160,17 +160,28 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM = ""; const char HTTP_SCRIPT_MODULE1[] PROGMEM = "var os;" - "function sk(s,g){" + "function sk(s,g){" // s = value, g = id and name "var o=os.replace(\"value='\"+s+\"'\",\"selected value='\"+s+\"'\");" "eb('g'+g).innerHTML=o;" "}" "function sl(){" - "var o0=\""; + "if(x!=null){x.abort();}" // Abort any request pending + "x=new XMLHttpRequest();" + "x.onreadystatechange=function(){" + "if(x.readyState==4&&x.status==200){" + "var i,o=x.responseText.replace(/}1/g,\"