Fixed one bug
This commit is contained in:
parent
98a082dd67
commit
651ade7334
@ -251,6 +251,7 @@ void onConfirmReceiving(const uint8_t *target, const uint16_t id, const bool sta
|
|||||||
|
|
||||||
void loadConfig()
|
void loadConfig()
|
||||||
{
|
{
|
||||||
|
ETS_GPIO_INTR_DISABLE();
|
||||||
if (!LittleFS.exists("/config.json"))
|
if (!LittleFS.exists("/config.json"))
|
||||||
saveConfig();
|
saveConfig();
|
||||||
File file = LittleFS.open("/config.json", "r");
|
File file = LittleFS.open("/config.json", "r");
|
||||||
@ -272,10 +273,13 @@ void loadConfig()
|
|||||||
sensorType = json["sensorType"];
|
sensorType = json["sensorType"];
|
||||||
workMode = json["workMode"];
|
workMode = json["workMode"];
|
||||||
file.close();
|
file.close();
|
||||||
|
delay(50);
|
||||||
|
ETS_GPIO_INTR_ENABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveConfig()
|
void saveConfig()
|
||||||
{
|
{
|
||||||
|
ETS_GPIO_INTR_DISABLE();
|
||||||
StaticJsonDocument<512> json;
|
StaticJsonDocument<512> json;
|
||||||
json["firmware"] = firmware;
|
json["firmware"] = firmware;
|
||||||
json["espnowNetName"] = espnowNetName;
|
json["espnowNetName"] = espnowNetName;
|
||||||
@ -296,6 +300,8 @@ void saveConfig()
|
|||||||
File file = LittleFS.open("/config.json", "w");
|
File file = LittleFS.open("/config.json", "w");
|
||||||
serializeJsonPretty(json, file);
|
serializeJsonPretty(json, file);
|
||||||
file.close();
|
file.close();
|
||||||
|
delay(50);
|
||||||
|
ETS_GPIO_INTR_ENABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupWebServer()
|
void setupWebServer()
|
||||||
@ -346,6 +352,7 @@ void IRAM_ATTR buttonInterrupt()
|
|||||||
|
|
||||||
void switchingRelay()
|
void switchingRelay()
|
||||||
{
|
{
|
||||||
|
ETS_GPIO_INTR_ENABLE();
|
||||||
relayStatus = !relayStatus;
|
relayStatus = !relayStatus;
|
||||||
if (relayPin)
|
if (relayPin)
|
||||||
{
|
{
|
||||||
@ -363,7 +370,6 @@ void switchingRelay()
|
|||||||
}
|
}
|
||||||
saveConfig();
|
saveConfig();
|
||||||
sendStatusMessage();
|
sendStatusMessage();
|
||||||
ETS_GPIO_INTR_ENABLE();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendAttributesMessage(const uint8_t type)
|
void sendAttributesMessage(const uint8_t type)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user