bugfix: prevent preset loading from resetting other errors
without this fix, any not-yet reported error - like filesystem problems at startup, or out-of-memory - was rest by successfully loading a preset.
This commit is contained in:
		| @@ -143,6 +143,7 @@ void applyPresetWithFallback(uint8_t index, uint8_t callMode, uint8_t effectID, | ||||
|  | ||||
| void handlePresets() | ||||
| { | ||||
|   byte presetErrFlag = ERR_NONE; | ||||
|   if (presetToSave) { | ||||
|     strip.suspend(); | ||||
|     doSaveState(); | ||||
| @@ -166,14 +167,16 @@ void handlePresets() | ||||
|   #ifdef ARDUINO_ARCH_ESP32 | ||||
|   if (tmpPreset==255 && tmpRAMbuffer!=nullptr) { | ||||
|     deserializeJson(*pDoc,tmpRAMbuffer); | ||||
|     errorFlag = ERR_NONE; | ||||
|   } else | ||||
|   #endif | ||||
|   { | ||||
|   errorFlag = readObjectFromFileUsingId(getPresetsFileName(tmpPreset < 255), tmpPreset, pDoc) ? ERR_NONE : ERR_FS_PLOAD; | ||||
|   presetErrFlag = readObjectFromFileUsingId(getPresetsFileName(tmpPreset < 255), tmpPreset, pDoc) ? ERR_NONE : ERR_FS_PLOAD; | ||||
|   } | ||||
|   fdo = pDoc->as<JsonObject>(); | ||||
|  | ||||
|   // only reset errorflag if previous error was preset-related | ||||
|   if ((errorFlag == ERR_NONE) || (errorFlag == ERR_FS_PLOAD)) errorFlag = presetErrFlag; | ||||
|  | ||||
|   //HTTP API commands | ||||
|   const char* httpwin = fdo["win"]; | ||||
|   if (httpwin) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Frank
					Frank