Skip to content

Default presets and playlist in Firmware #4288

Open

Description

@viktor6

How can I build a firmware with presets and a playlist?
Why can't I put the wled_presets.json file next to platformio.ini?

{ "0": {}, "1": { "on": true, "bri": 125, "transition": 7, "mainseg": 0, "seg": [{ "id": 0, "start": 0, "stop": 100, "grp": 1, "spc": 0, "of": 0, "on": true, "frz": false, "bri": 255, "cct": 127, "set": 0, "col": [[255, 160, 0], [0, 0, 0], [0, 0, 0]], "fx": "r", "sx": 128, "ix": 128, "pal": 0, "c1": 128, "c2": 128, "c3": 16, "sel": true, "rev": false, "mi": false, "o1": false, "o2": false, "o3": false, "si": 0, "m12": 1 } ], "n": "AllRandomPreset" }, "2": { "playlist": { "ps": [1], "dur": [300], "transition": [30], "repeat": 0, "end": 0, "r": 0 }, "on": true, "n": "AllRandomPlaylist" } }

Activity

  1. netmindz commented on Dec 5, 2024

    @netmindz
    Member

    I know that some users have been experimenting with building a firmware file with default presets added, hopefully we can get that added as an official option once they get that working reliably

  2. added
    keep
    on Dec 5, 2024
  3. changed the title [-]Firmware presets and playlist[/-] [+]Default presets and playlist in Firmware[/+] on Dec 5, 2024
  4. david-hogberg commented on Dec 5, 2024

    @david-hogberg

    If you're using PlatformIO, you can add to your board configuration:

    board_build.filesystem = littlefs
    board_build.filesystem_size = xxxx

    where xxxx is the size of the filesystem partition. Check the size of the partition in the csv file listed in board_build.partitions (probably named 'spiffs' rather than 'littlefs' though).

    Put your presets.json in a data directory and change the 'data_dir' config parameter to point to this directory (at the top of the platformio.ini file). You can of course use the default ./wled00/data folder for this as well but then it'll also encode all the htm-files etc.

    Finally use 'Build Filesystem Image' in PlatformIO to build a littelfs.bin file with your preset file (found in .pio/build/your_env). Flash this to your board at the appropriate offset.

    I've done this for an s3 mini board with 8MB flash (custom pcb design). Seems to be working fine so far, though I've also heard some accounts of discrepancies between pio and wled regarding littlefs handling that could cause issues. If anyone knows more about this let me know.

  5. viktor6 commented on Dec 5, 2024

    @viktor6
    Author

    If you're using PlatformIO, you can add to your board configuration:

    board_build.filesystem = littlefs board_build.filesystem_size = xxxx

    where xxxx is the size of the filesystem partition. Check the size of the partition in the csv file listed in board_build.partitions (probably named 'spiffs' rather than 'littlefs' though).

    Put your presets.json in a data directory and change the 'data_dir' config parameter to point to this directory (at the top of the platformio.ini file). You can of course use the default ./wled00/data folder for this as well but then it'll also encode all the htm-files etc.

    Finally use 'Build Filesystem Image' in PlatformIO to build a littelfs.bin file with your preset file (found in .pio/build/your_env). Flash this to your board at the appropriate offset.

    I've done this for an s3 mini board with 8MB flash (custom pcb design). Seems to be working fine so far, though I've also heard some accounts of discrepancies between pio and wled regarding littlefs handling that could cause issues. If anyone knows more about this let me know.

    Is this a theory or do you do it this way? Can you make a video on how to do it?

  6. added this to the 0.16.0 candidate milestone on Dec 5, 2024
  7. netmindz commented on Dec 6, 2024

    @netmindz
    Member

    Thanks for sharing @david-hogberg, can you explain how you flash the littlefs.bin with the correct offset and where that value comes from?

  8. david-hogberg commented on Dec 6, 2024

    @david-hogberg

    @viktor6 Yes I do it this way. Any specific part you want more details on?

    @netmindz You can also press 'Upload Filesystem Image' in PlatformIO after you've built the image :)

    Otherwise offsets are defined in a separate column in the partitions table. It'll look something like this:

    Name Type SubType Offset Size Flags
    nvs data nvs 0x9000 0x5000
    otadata data ota 0xe000 0x2000
    app0 app ota_0 0x10000 0x200000
    app1 app ota_1 0x210000 0x200000
    spiffs data spiffs 0x410000 0x3E0000
    coredump data coredump 64K

    If you're using esptool, you can then do esptool.py --port [PORT] write_flash [OFFSET] [IMAGE_FILE]

    There's also a merge_bin command that lets you merge all the bin files to a single file.

  9. modified the milestones: 16.0.0 beta, 16.1 on Mar 9, 2026
  10. modified the milestones: 16.1, 17.0 on Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementkeep

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions