From 8a0f4d1956c39feb5e78f772ab3e7a7ede13b26f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 20 Feb 2020 18:53:41 +0100 Subject: [PATCH] some edit --- .../firmwares/Shelly1/Shelly1_v1/Shelly1_v1.ino | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/_FIRMWARE/firmwares/Shelly1/Shelly1_v1/Shelly1_v1.ino b/_FIRMWARE/firmwares/Shelly1/Shelly1_v1/Shelly1_v1.ino index b5fd438..01148e1 100644 --- a/_FIRMWARE/firmwares/Shelly1/Shelly1_v1/Shelly1_v1.ino +++ b/_FIRMWARE/firmwares/Shelly1/Shelly1_v1/Shelly1_v1.ino @@ -13,7 +13,7 @@ int unsuccessfulRounds = 0; //Unsucesful atmpt counter StaticJsonDocument<250> jsonContent; bool buttonActive = false; int interuptCount = 0; -int realState = 1; +int realState = 0; int state = 0; String requestJson = ""; @@ -167,13 +167,9 @@ bool checkConnection() { Serial.print("Waiting for Wi-Fi connection"); while ( count < 30 ) { if (buttonActive){ - if (!realState == 1) { - digitalWrite(RELAY, HIGH); - realState = 1; - } else if (!realState == 0){ - digitalWrite(RELAY, LOW); - realState = 0; - } + int realStateLocal = digitalRead(SWITCH); + digitalWrite(RELAY, realStateLocal); + realState = realStateLocal; EEPROM.write(0, realState); EEPROM.commit(); buttonActive = false;