Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions wled00/presets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,12 @@ void handlePresets()
changePreset = true;
} else {
if (!fdo["seg"].isNull() || !fdo["on"].isNull() || !fdo["bri"].isNull() || !fdo["nl"].isNull() || !fdo["ps"].isNull() || !fdo[F("playlist")].isNull()) changePreset = true;
if (!(tmpMode == CALL_MODE_BUTTON_PRESET && fdo["ps"].is<const char *>() && strchr(fdo["ps"].as<const char *>(),'~') != strrchr(fdo["ps"].as<const char *>(),'~')))

// TODO:
// Scenario 1: boot preset (CALL_MODE_INIT AND sets lor>0) - do not strip ps, allowing boot preset to chain 1 single preset
// Scenario 2: boot playlist (CALL_MODE_DIRECT_CHANGE AND sets lor>0) - continue, else re-queue. is CALL_MODE_DIRECT_CHANGE correct or do I need to pass through CALL_MODE_INIT or create a new special-case call mode

if (!(tmpMode == CALL_MODE_INIT || (tmpMode == CALL_MODE_BUTTON_PRESET && fdo["ps"].is<const char *>() && strchr(fdo["ps"].as<const char *>(),'~') != strrchr(fdo["ps"].as<const char *>(),'~')))) // exception for CALL_MODE_INIT and button preset
fdo.remove("ps"); // remove load request for presets to prevent recursive crash (if not called by button and contains preset cycling string "1~5~")
deserializeState(fdo, CALL_MODE_NO_NOTIFY, tmpPreset); // may change presetToApply by calling applyPreset()
}
Expand Down Expand Up @@ -282,4 +287,4 @@ void deletePreset(byte index) {
writeObjectToFileUsingId(getPresetsFileName(), index, &empty);
presetsModifiedTime = toki.second(); //unix time
updateFSInfo();
}
}
14 changes: 14 additions & 0 deletions wled00/wled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,20 @@ void WLED::setup()

if (needsCfgSave) serializeConfigToFS(); // usermods required new parameters; need to wait for strip to be initialised #4752

if (bootPreset > 0) {
if (!presetNeedsSaving()) {
Comment thread
smitty078 marked this conversation as resolved.
Outdated
handlePlaylist(); // handle boot playlist at setup
Comment thread
smitty078 marked this conversation as resolved.
Outdated
yield();
Comment thread
smitty078 marked this conversation as resolved.
Outdated
}
handlePresets(); // handle boot preset (including playlist) at setup
// Allow a boot preset to chain to one numeric preset exactly once (if it sets lor)
// Allow a boot playlist is able to apply the first preset (if it sets lor)
// In both cases, pre-existing protection against recursion is preserved
// See logic inside of handlePresets()
yield();
handlePresets();
}

if (strcmp(multiWiFi[0].clientSSID, DEFAULT_CLIENT_SSID) == 0 && !configBackupExists())
showWelcomePage = true;

Expand Down