Skip to content

Increase maximum playlist duration#5455

Merged
DedeHai merged 4 commits intowled:mainfrom
DedeHai:longPlaylistTime
Mar 27, 2026
Merged

Increase maximum playlist duration#5455
DedeHai merged 4 commits intowled:mainfrom
DedeHai:longPlaylistTime

Conversation

@DedeHai
Copy link
Copy Markdown
Collaborator

@DedeHai DedeHai commented Mar 27, 2026

Duration limit is now virtually removed, it can go up to millis() limit, i.e. 49.7 days.
Comes at a cost of increased playlist item size, though only a minor issue and only on EPS8266.

Also fixed a long standing bug in the UI: number input fields were not properly limited, especially playlist duration and playlist transition time. This is now fixed: an even listener enforces the given limits for a much better UX as numbers clip instantly and not only after saving (or not at all).

This PR is a prerequesit for #5379

Summary by CodeRabbit

  • New Features

    • Greatly increased maximum playlist entry duration support and updated duration/transition input limits and sizing in the UI.
  • Bug Fixes

    • Improved numeric input validation with automatic clamping and immediate UI refresh.
    • Fixed playlist duration handling for higher precision and to prevent overflow.
  • Chores

    • Refactored duration conversion and runtime tracking for consistency; updated sample build configuration flag.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 27, 2026

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

Updated playlist duration handling to milliseconds in firmware; adjusted frontend number-input sanitization and playlist editor inputs (max values, ids, widths); changed a sample build flag in platformio_override.

Changes

Cohort / File(s) Summary
Backend — Playlist duration
wled00/playlist.cpp
Per-entry dur changed from uint16_t (tenths) to uint32_t (milliseconds); load/save now convert/clamp between tenths and ms, runtime comparisons use ms, and infinite-duration sentinel moved to UINT32_MAX.
Frontend — Number inputs & playlist UI
wled00/data/index.js
Added document-level input listener to clamp input[type="number"] to min/max and call oninput; refactored pleTr to always parse/validate/clamp transition values; updated playlist editor: Duration max→4294967, Transition max→65.5, changed Transition input id pattern and added inline widths.
Config sample
platformio_override.sample.ini
Replaced sample commented disable flag -D WLED_DISABLE_PXMAGIC with -D WLED_DISABLE_PIXELFORGE in the env:WLED_generic8266_1M block.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • blazoncek
  • willmmiles
  • netmindz
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: increasing maximum playlist duration from uint16_t to uint32_t, enabling durations up to ~49.7 days instead of the previous limit.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@wled00/data/index.js`:
- Around line 313-327: The input handler attached via d.addEventListener
currently always calls t.oninput() when the parsed value is a number, causing
redundant handler runs; change the logic in that listener (the block that parses
val, max, min and checks bounds) so t.oninput() is invoked only if clamping
actually changed t.value (i.e., when val > max or val < min or when setting
t.value to a coerced string would modify it). Keep the existing parseFloat
checks and use the same t, val, max, min symbols to decide whether to call
t.oninput().
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2f5d3881-3473-4d9f-b074-3bef54786488

📥 Commits

Reviewing files that changed from the base of the PR and between 6a16593 and 1b0c447.

📒 Files selected for processing (2)
  • wled00/data/index.js
  • wled00/playlist.cpp

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@wled00/data/index.js`:
- Line 2135: The duration input's HTML max (pl${p}du${i}) is too low compared to
the firmware clamp (playlist.cpp allows 42949672 deciseconds => 4294967.2s),
causing valid backend values to be rejected; update the max on the input element
(and any client-side validation in pleDur) to 4294967.2 to match the firmware,
or alternatively reduce the firmware clamp so both sides agree—ensure changes
reference the pl${p}du${i} input, pleDur handler, and plJson duration values.
- Around line 1975-1979: When duration is reduced the code clamps only the
duration field value but never re-clamps the paired transition, so
plJson[p].transition[i] can remain larger than the new dur; update the paired
transition value whenever duration is changed by computing the new allowed
transition = Math.min(parsedTransition, newDur, parseFloat(field.max) or dv) and
assign it back to plJson[p].transition[i] (and to the corresponding transition
field.value if present). Apply this fix at both places where duration is clamped
(the block using parseFloat(field.max); let val = parseFloat(field.value); val =
Math.min(val, max, dv > 0 ? dv : max); field.value = val;) and the similar block
at the other occurrence so the transition is always re-clamped to not exceed the
reduced duration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7572ee7a-8a39-4a68-941b-fe2585e3b964

📥 Commits

Reviewing files that changed from the base of the PR and between 1b0c447 and cbd1c05.

📒 Files selected for processing (1)
  • wled00/data/index.js

Copy link
Copy Markdown
Member

@softhack007 softhack007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes in the C++ part look good to me.
I cannot say much about the JS/DOM changes, i'm still a beginner with JS 🤷‍♂️

@DedeHai
Copy link
Copy Markdown
Collaborator Author

DedeHai commented Mar 27, 2026

there is a slight bug in JS still, not a regression but can be done cleaner.

@DedeHai DedeHai merged commit e4351c8 into wled:main Mar 27, 2026
24 checks passed
@DedeHai DedeHai deleted the longPlaylistTime branch March 27, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants