From 651ade7334276a4e5b6147fd5c2306c836830a77 Mon Sep 17 00:00:00 2001 From: Alexey Zholtikov Date: Sun, 26 Feb 2023 14:21:47 +0300 Subject: [PATCH] Fixed one bug --- src/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 798bed0..315c827 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -251,6 +251,7 @@ void onConfirmReceiving(const uint8_t *target, const uint16_t id, const bool sta void loadConfig() { + ETS_GPIO_INTR_DISABLE(); if (!LittleFS.exists("/config.json")) saveConfig(); File file = LittleFS.open("/config.json", "r"); @@ -272,10 +273,13 @@ void loadConfig() sensorType = json["sensorType"]; workMode = json["workMode"]; file.close(); + delay(50); + ETS_GPIO_INTR_ENABLE(); } void saveConfig() { + ETS_GPIO_INTR_DISABLE(); StaticJsonDocument<512> json; json["firmware"] = firmware; json["espnowNetName"] = espnowNetName; @@ -296,6 +300,8 @@ void saveConfig() File file = LittleFS.open("/config.json", "w"); serializeJsonPretty(json, file); file.close(); + delay(50); + ETS_GPIO_INTR_ENABLE(); } void setupWebServer() @@ -346,6 +352,7 @@ void IRAM_ATTR buttonInterrupt() void switchingRelay() { + ETS_GPIO_INTR_ENABLE(); relayStatus = !relayStatus; if (relayPin) { @@ -363,7 +370,6 @@ void switchingRelay() } saveConfig(); sendStatusMessage(); - ETS_GPIO_INTR_ENABLE(); } void sendAttributesMessage(const uint8_t type)