Merge remote-tracking branch 'upstream/main' into mdev

This commit is contained in:
Ewoud
2023-02-06 21:06:13 +01:00
27 changed files with 4603 additions and 4258 deletions

View File

@@ -274,7 +274,7 @@ void savePreset(byte index, const char* pname, JsonObject sObj)
} else {
// this is a playlist or API call
if (sObj[F("playlist")].isNull()) {
// we will save API call immediately
// we will save API call immediately (often causes presets.json corruption)
presetToSave = 0;
if (index > 250 || !fileDoc) return; // cannot save API calls to temporary preset (255)
sObj.remove("o");
@@ -284,11 +284,12 @@ void savePreset(byte index, const char* pname, JsonObject sObj)
sObj.remove(F("psave"));
if (sObj["n"].isNull()) sObj["n"] = saveName;
initPresetsFile(); // just in case if someone deleted presets.json using /edit
writeObjectToFileUsingId(getFileName(index), index, fileDoc);
writeObjectToFileUsingId(getFileName(index<255), index, fileDoc);
presetsModifiedTime = toki.second(); //unix time
updateFSInfo();
} else {
// store playlist
// WARNING: playlist will be loaded in json.cpp after this call and will have repeat counter increased by 1
includeBri = true; // !sObj["on"].isNull();
playlistSave = true;
}