mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-21 15:06:38 +01:00
fixes crash on apconfig
This commit is contained in:
@@ -357,7 +357,7 @@
|
||||
{
|
||||
"key": "bytes",
|
||||
"name": "bytes",
|
||||
"desc": "70 bytes, formatted as 0x00,0x00,...",
|
||||
"desc": "76 bytes, formatted as 0x00,0x00,...",
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -248,15 +248,16 @@ void initAPconfig() {
|
||||
LittleFS.begin(true);
|
||||
DynamicJsonDocument APconfig(150);
|
||||
File configFile = LittleFS.open("/current/apconfig.json", "r");
|
||||
DeserializationError error = deserializeJson(APconfig, configFile);
|
||||
if (error) {
|
||||
if (configFile) {
|
||||
DeserializationError error = deserializeJson(APconfig, configFile);
|
||||
if (error) {
|
||||
configFile.close();
|
||||
Serial.println("failed to read apconfig.json. Using default config");
|
||||
}
|
||||
configFile.close();
|
||||
Serial.println("failed to read apconfig.json. Using default config");
|
||||
}
|
||||
configFile.close();
|
||||
|
||||
config.channel = APconfig["channel"] | 25;
|
||||
strlcpy(config.alias, APconfig["alias"], sizeof(config.alias));
|
||||
if (APconfig["alias"]) strlcpy(config.alias, APconfig["alias"], sizeof(config.alias));
|
||||
config.led = APconfig["led"] | 255;
|
||||
config.language = APconfig["language"] | getDefaultLanguage();
|
||||
config.maxsleep = APconfig["maxsleep"] | 10;
|
||||
|
||||
Reference in New Issue
Block a user