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