-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Is your feature request related to a problem? Please describe.
I'm developing a BLE mod for wled which works fine for commands except preset/playlist deletion (device crashes). I then noticed that presets are deleted using immediate file operations rather than asynchronously using flags, which is how presets are saved for example. Same for API calls. Is this there a reason for this or a bug? Issue solved if I move deletion to be handled later in the main loop (see below).
Deletion still works fine using wifi, but thought it might be a general stability improvement anyway.
Describe the solution you'd like
In presets.cpp: Instead of directly initiating file operations in deletePreset(index), called from deserializeState, set a flag presetToDelete = index that's picked up in handlePresets(). Something like this:
void handlePresets()
{
if (presetToDelete) {
doDeleteState();
return;
}
if (presetToSave) {
doSaveState();
return;
}
...
}
Adds consistent behaviour between preset deletion and saving, and prevents potential blocking operations during preset deletion.