Added existance check for alarm.json and dev.json
This commit is contained in:
@@ -35,11 +35,9 @@ void startLittleFS()
|
|||||||
void loadDevSettings()
|
void loadDevSettings()
|
||||||
{
|
{
|
||||||
Serial.println("loadSettings");
|
Serial.println("loadSettings");
|
||||||
File file = LittleFS.open("/dev.json", "r");
|
if (LittleFS.exists("/dev.json"))
|
||||||
if (!file)
|
|
||||||
{
|
{
|
||||||
return;
|
File file = LittleFS.open("/dev.json", "r");
|
||||||
}
|
|
||||||
DynamicJsonDocument doc(128);
|
DynamicJsonDocument doc(128);
|
||||||
DeserializationError error = deserializeJson(doc, file);
|
DeserializationError error = deserializeJson(doc, file);
|
||||||
if (error)
|
if (error)
|
||||||
@@ -59,6 +57,7 @@ void loadDevSettings()
|
|||||||
}
|
}
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadSettings()
|
void loadSettings()
|
||||||
|
|||||||
@@ -329,12 +329,9 @@ time_t lastAlarmTime = 0;
|
|||||||
|
|
||||||
void PeripheryManager_::checkAlarms()
|
void PeripheryManager_::checkAlarms()
|
||||||
{
|
{
|
||||||
File file = LittleFS.open("/alarms.json", "r");
|
if (LittleFS.exists("/alarms.json"))
|
||||||
if (!file)
|
|
||||||
{
|
{
|
||||||
return;
|
File file = LittleFS.open("/alarms.json", "r");
|
||||||
}
|
|
||||||
|
|
||||||
DynamicJsonDocument doc(file.size() * 1.33);
|
DynamicJsonDocument doc(file.size() * 1.33);
|
||||||
DeserializationError error = deserializeJson(doc, file);
|
DeserializationError error = deserializeJson(doc, file);
|
||||||
if (error)
|
if (error)
|
||||||
@@ -387,6 +384,7 @@ void PeripheryManager_::checkAlarms()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *PeripheryManager_::readUptime()
|
const char *PeripheryManager_::readUptime()
|
||||||
|
|||||||
Reference in New Issue
Block a user