Fix shelly2 ghost switching

Fix shelly2 ghost switching caused by lack of pull-up inputs (#4255)
This commit is contained in:
Theo Arends 2018-11-10 10:48:28 +01:00
parent 3332ab01a1
commit 7a235cc8ef
3 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,7 @@
/* 6.3.0.5 20181107 /* 6.3.0.5 20181107
* Add code image and optional commit number to version * Add code image and optional commit number to version
* Add support for Gosund SP1 v2.3 Power Socket with Energy Monitoring (#4297) * 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 * 6.3.0.4 20181106
* Add command SetSensorXX 0/1 to disable/re-enable compiled xsns_XX_sensor.ino driver * Add command SetSensorXX 0/1 to disable/re-enable compiled xsns_XX_sensor.ino driver

View File

@ -2383,8 +2383,9 @@ void SerialInput()
void GpioSwitchPinMode(uint8_t index) void GpioSwitchPinMode(uint8_t index)
{ {
if (pin[GPIO_SWT1 +index] < 99) { 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 uint8_t no_pullup = bitRead(switch_no_pullup, index); // 0 = INPUT_PULLUP, 1 = INPUT
if (no_pullup) { if (no_pullup) {
if (SHELLY2 == Settings.module) { 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); pinMode(pin[GPIO_SWT1 +index], (16 == pin[GPIO_SWT1 +index]) ? INPUT_PULLDOWN_16 : (no_pullup) ? INPUT : INPUT_PULLUP);
*/
} }
} }

View File

@ -1125,9 +1125,9 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_REL1, // GPIO04 GPIO_REL1, // GPIO04
GPIO_REL2, // GPIO05 GPIO_REL2, // GPIO05
0, 0, 0, 0, 0, 0, // Flash connection 0, 0, 0, 0, 0, 0, // Flash connection
GPIO_SWT1_NP, // GPIO12 GPIO_SWT1, // GPIO12
0, 0,
GPIO_SWT2_NP, // GPIO14 GPIO_SWT2, // GPIO14
0, // GPIO15 MCP39F501 Reset 0, // GPIO15 MCP39F501 Reset
0, 0 0, 0
}, },