kopia lustrzana https://github.com/Aircoookie/WLED
Add default preset name if none specified.
rodzic
f8bc0bd2b5
commit
05bc81bf4e
|
@ -53,6 +53,7 @@ bool applyPreset(byte index, byte callMode)
|
|||
void savePreset(byte index, bool persist, const char* pname, JsonObject saveobj)
|
||||
{
|
||||
if (index == 0 || (index > 250 && persist) || (index<255 && !persist)) return;
|
||||
char tmp[12];
|
||||
JsonObject sObj = saveobj;
|
||||
|
||||
const char *filename = persist ? "/presets.json" : "/tmp.json";
|
||||
|
@ -65,7 +66,11 @@ void savePreset(byte index, bool persist, const char* pname, JsonObject saveobj)
|
|||
if (!requestJSONBufferLock(10)) return;
|
||||
#endif
|
||||
sObj = doc.to<JsonObject>();
|
||||
if (pname) sObj["n"] = pname;
|
||||
|
||||
if (sObj["n"].isNull() && pname == nullptr) {
|
||||
sprintf_P(tmp, PSTR("Preset %d"), index);
|
||||
sObj["n"] = tmp;
|
||||
} else if (pname) sObj["n"] = pname;
|
||||
|
||||
DEBUGFS_PRINTLN(F("Save current state"));
|
||||
serializeState(sObj, true);
|
||||
|
|
Ładowanie…
Reference in New Issue