Add no pull-up control to Shelly 2

Add no pull-up control to Shelly 2 module (default is pull-up, change GPIO2 to Switch3n for no pull-up) (#4841)
This commit is contained in:
Theo Arends 2019-01-06 18:50:56 +01:00
parent 0195cabbd6
commit e1d903eab3
4 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,7 @@
/* 6.4.1.7 20190106
* Fix HLW8012, HJL01 and BL0937 based energy sensors low Power (below 10W) measurement regression from 6.4.1.6
* Add relay status functionality to LED2 when configured leaving LED1 for (wifi/mqtt) status indication
* Add no pull-up control to Shelly 2 module (default is pull-up, change GPIO2 to Switch3n for no pull-up) (#4841)
*
* 6.4.1.6 20190105
* Add commands PowerCal, VoltageCal and CurrentCal for HLW8012, HJL01 and BL0937 based energy sensors

View File

@ -1775,7 +1775,8 @@ void ButtonHandler(void)
}
} else {
if (pin[GPIO_KEY1 +button_index] < 99) {
if (!((uptime < 4) && (0 == pin[GPIO_KEY1 +button_index]))) { // Block GPIO0 for 4 seconds after poweron to workaround Wemos D1 RTS circuit
// if (!((uptime < 4) && (0 == pin[GPIO_KEY1 +button_index]))) { // Block GPIO0 for 4 seconds after poweron to workaround Wemos D1 RTS circuit
if (uptime > 3) { // Block GPIO for 4 seconds after poweron to workaround Wemos D1 / Obi RTS circuit
button_present = 1;
button = digitalRead(pin[GPIO_KEY1 +button_index]);
}

View File

@ -1367,7 +1367,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
{ "Shelly 2", // Shelly2 (ESP8266 - 2MB) - https://shelly.cloud/shelly2/
0,
GPIO_TXD, // GPIO01 MCP39F501 Serial input
0,
GPIO_USER, // GPIO02 Decide if we use (no) pull-up
GPIO_RXD, // GPIO03 MCP39F501 Serial output
GPIO_REL1, // GPIO04
GPIO_REL2, // GPIO05
@ -1378,7 +1378,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_SWT1, // GPIO12
0,
0, // GPIO13
GPIO_SWT2, // GPIO14
0, // GPIO15 MCP39F501 Reset
0, 0

View File

@ -110,6 +110,10 @@ void SwitchProbe(void)
void SwitchInit(void)
{
if (SHELLY2 == Settings.module) {
if (switch_no_pullup > 0) { switch_no_pullup = 0xffff; } // If any switch is no pull-up make them all no pull-up
}
switches_found = 0;
for (byte i = 0; i < MAX_SWITCHES; i++) {
lastwallswitch[i] = 1; // Init global to virtual switch state;