- incorrect bus length
- invalid relay state
- preset JSON corruption on network call
- iro & rangetouch serving
This commit is contained in:
Blaz Kristan
2021-12-11 23:17:47 +01:00
parent 2f411dfc9c
commit 5462d1e9f8
4 changed files with 29 additions and 10 deletions

View File

@@ -12,7 +12,15 @@ bool applyPreset(byte index, byte callMode)
const char *filename = index < 255 ? "/presets.json" : "/tmp.json";
if (fileDoc) {
uint8_t core = 1;
//crude way to determine if this was called by a network request
#ifdef ARDUINO_ARCH_ESP32
core = xPortGetCoreID();
#endif
//only allow use of fileDoc from the core responsible for network requests
//do not use active network request doc from preset called by main loop (playlist, schedule, ...)
if (fileDoc && core) {
errorFlag = readObjectFromFileUsingId(filename, index, fileDoc) ? ERR_NONE : ERR_FS_PLOAD;
JsonObject fdo = fileDoc->as<JsonObject>();
if (fdo["ps"] == index) fdo.remove("ps"); //remove load request for same presets to prevent recursive crash