WLED icon indicating copy to clipboard operation
WLED copied to clipboard

FSEQ Playback from LittleFS and SD

Open fastbytes opened this issue 2 years ago • 35 comments

Credit goes to @constant-flow for the original idea and structure created for TPM2 playback! https://github.com/Aircoookie/WLED/pull/2292

Adds support for playback of FSEQ files from xLights or Vixen Includes support for both SD_MMC and SD via SPI (e.g. TTGO devices) Uses FSEQFile class to prevent overlapping functions

NOTE: Created REALTIME_MODE_FSEQ using 10 instead of 9 (next available value) to keep compatibility with TPM2RECORD once both are merged

fastbytes avatar Dec 12 '21 17:12 fastbytes

Hi @guardmedia

Wow, great !

How do I activate it ? shouldn't it be on the drop down menu together with the now missing ddp, artnet and so on. What pins do I use for the sd card ?

Thanks

Harald

harueg avatar Dec 12 '21 19:12 harueg

What type of fseq files ?

harueg avatar Dec 12 '21 19:12 harueg

Hi @guardmedia

Wow, great !

How do I activate it ? shouldn't it be on the drop down menu together with the now missing ddp, artnet and so on. What pins do I use for the sd card ?

Thanks

Harald

Hi @harueg,

Take a look at the comments in https://github.com/Aircoookie/WLED/pull/2413/files#diff-d81c4924f6e5d3564ea86ee4f97939e6ef6273897f4b2d002c9bf93ab5a08113 which should explain most of your questions.

The pins you use will depend on the module being used. You will want to check the pinout specifications for your board, or you may be lucky enough to just use the SD_MMC library as-is (doesn't require SPI pins to be defined).

What type of fseq files ?

Technically any V1 or V2 file without compression should work. This is compatible with the default FSEQ output from xLights. https://manual.xlights.org/xlights/chapters/chapter-five-menus/file

// reference spec of FSEQ: https://github.com/Cryptkeeper/fseq-file-format
// first-party FPP file format guide: https://github.com/FalconChristmas/fpp/blob/master/docs/FSEQ_Sequence_File_Format.txt

fastbytes avatar Dec 12 '21 20:12 fastbytes

Hi @guardmedia

Thanks for the quick answer ! Will go through all this information. What pins for sd card did you define, when you compiled the binary ?

Thanks

Harald

harueg avatar Dec 19 '21 17:12 harueg

Hi @guardmedia

Thanks for the quick answer ! Will go through all this information. What pins for sd card did you define, when you compiled the binary ?

Thanks

Harald

This was covered already in the links I shared above, which includes the PINs used for a TTGO T8 board as well. Here's the link again for reference.

fastbytes avatar Dec 29 '21 14:12 fastbytes

i'm trying this on my own build pcb. it loads a fsec file. this file length should be 30 sec. only it takes 1 sec to complete. any idea? i do not get any error.

log: 15:52:23.202 -> FSEQ load animation on LED 0 to 50 15:52:23.202 -> Read file from SD: /rainbow.fseq 15:52:23.202 -> FSEQ file_header: 15:52:23.202 -> channel_data_offset = 108 15:52:23.202 -> minor_version = 0 15:52:23.202 -> major_version = 2 15:52:23.202 -> header_length = 72 15:52:23.202 -> channel_count = 152 15:52:23.202 -> frame_count = 1200 15:52:23.202 -> step_time = 25 15:52:23.202 -> flags = 0 15:52:23.202 -> JSON buffer released. (11) 15:52:23.202 -> JSON buffer released. (12) 15:52:23.401 -> Finished playing recording, disabling realtime mode

Never mind. I am sleeping. It is working.

haubke avatar May 07 '22 13:05 haubke

Hi guardmedia

Successfully compiled your fork. But the fseq features didn't show on the UI. Are there settings to be made before compiling ? In platformio.ini ? Or elsewhere ?

It always wants to compile D1 mini, although platformio setting is default_envs = esp32dev Is there a manual for the compiler settings ?

Thank you so much Harald

harueg avatar Aug 07 '22 19:08 harueg

@guardmedia could you talk to @constant-flow about making this a usermod? It has a much greater chance of being merged that way and since both of your solutions work complementing each other it should be better to have them in one usermod.

blazoncek avatar Aug 08 '22 11:08 blazoncek

Hi Guys ! Sounds great ! Would that maybe also activate the sd card on the https://github.com/srg74/WLED-ESP32-universal-controller ? Or did I miss something in this code ?

Thanks

Harald

harueg avatar Aug 08 '22 12:08 harueg

@blazoncek I guess this is a good idea to make the mod format-independent. @guardmedia I'm currently (and slowly) progressing with the implementation as a usermod. You can see the current state here. My plan is to not only support TPM2, but multiple formats like FSEQ and maybe others if someone writes the code.

The code for the mod was quite similar to the original, you may be able to prep a snippet of code for the FSEQ any time soon, so I could merge it into my branch.

I'm currently thinking it might be even cleaner to split SD (MMC & SPI) and playback-rec into two usermods so others could built something completely different with SD-support than playback.

@harueg there's quite some high chance it will support the mentioned board, but as I don't have one of these i can't test it

constant-flow avatar Aug 14 '22 21:08 constant-flow

Hi @constant-flow

I am not dependent on a special board design at the moment.

Thanks for your efforts !

harueg avatar Aug 16 '22 12:08 harueg

Thank you for your work! Looks good at first glance. I too think we should treat .fseq playback and general SD support as two different things, although I would like both to be included in WLED by default! This is since a small sequence could also be stored in the integrated LittleFS filesystem and SD could also be used for e.g. config/preset storage and/or backup.

The upcoming QuinLED Dig-Octa Brainboard will have a native SD slot by the way :)

Aircoookie avatar Sep 02 '22 01:09 Aircoookie

So i found some time to split both into separate usermods and am quite happy with it. To be clear i didn't add fseq-parsing based of @guardmedia 's code. I'd be happy to merge a tested adjustment (as this whole thing is now a usermod) but would stay away from patching/debugging it myself to fit the new shape.

The mod for Playback-Recordings can be found here The mod for SD-Card can be found here

@Aircoookie I bodged together an SD-adapter-card with soldered wires dead-bugging into an ESP32 to test the SPI mode with the same pin config as the QuinLED Dig-Octa Brainboard. I used those pins as the default for now ... and 🎉 SPI and MMC behave the same, tho SPI is more configurable :)

Further more I added a repeat option to repeat x-times or loop for-∞, as well as a fps option to define a framerate used for playback speed.

@blazoncek General feedback is welcome, if everything is fine I'd start another PR.

constant-flow avatar Sep 03 '22 22:09 constant-flow

@constant-flow I'll have a look later this week.

blazoncek avatar Sep 04 '22 07:09 blazoncek

Question about interaction with other usermods and effects, especially audioreactive usermod.

Audioreactive has a kind of 'kill switch' in certain realtime modes, if WLED built-in animations (fx.cpp) no longer control LEDs.The reason is that audioreactive is quite cpu intensive, and we try to give back cpu ressources when all LEDs are under external control, so WLED can achieve higher FPS.

Created REALTIME_MODE_FSEQ using 10 instead of 9 (next available value) to keep compatibility with TPM2RECORD once both are merged.

Is your new usermod also controlling all LEDs, so I should update our realtime modes 'kill list' in audioreactive, once the playback usermod code is merged?

softhack007 avatar Sep 25 '22 09:09 softhack007

I'm sorry, but I can't tell how this behaves with other mods modifying the LEDs, especially with the reactive-mod.

So far the Playback-Recordings mod is build using no special functions, to manipulate the LEDs. It can control all or one segment right now. The Realtime-mode is basically just an identifier for the web interface what to display and is using right now the default-realtime-mode ID, but could deserve a custom one in the future 😄. You referred to a code in this PR, which was based off my original PR, where SD + Playback were still combined and where I wasn't using the full potential of Usermods.

The original poster could adjust their fseq playback code to match the new approach, so it can be merged in as another format allowed for playback.

When it comes to signalling the end of the realtime playback, it seems like there is still a bug, because the Web interface still shows the RT-mode on, while it signalled the end of it via exitRealtime(), but i guess this is some kind of simple race condition, so the web isn't updated properly.

constant-flow avatar Oct 15 '22 18:10 constant-flow

@constant-flow: I tried your great usermod "Playback-Recordings" with 0.13.3 (ESP32dev) but I had two issues with it:

  1. In the usermod descrpition you wrote that default fps rate is 25. But when I played a tpm2-file without defining a fps rate, the animation (recorded with Jinx! @ 25 fps) was way too fast. Manually setting the fps rate to 25 via preset worked and the animation was played with the proper speed.

  2. Skipping / Leaving the real time mode didn't work. In opposite to the web interface which behaved properly and left the realtime mode, the leds still continued playing the animation - flickering and overlayed by the now chosen WLED effect.

ElToberino avatar Nov 06 '22 17:11 ElToberino

Hi @ElToberino

Where did you find this usermod ? Really looked hard @constant-flow 's fork. Couldn't find fesqrecord.h neither. In the header of a fseq file there is usually a frame rate setting, not in tpm2 ?

harueg avatar Nov 06 '22 19:11 harueg

@harueg It's linked some posts above.

I use Jinx! as a tpm2 recorder which always outputs 25 fps. So it should run properly out of the box without manually configuring fps rate.

ElToberino avatar Nov 06 '22 21:11 ElToberino

Thanks ! Are there different versions of the fork on github ? Strange.

Did you store the files on sd card or flash ? and uploaded them with /edit ? any special directory ?

Did some projects with Jinx! as well. The developer even made a special edition for me with up to 60.000 leds. And promised he would get back at it with enhancements. That was 4 years ago. I really liked the ease of use.

harueg avatar Nov 06 '22 21:11 harueg

It's just another branch of his fork - but that's indeed a little confusing...

I haven't tested the sd card support yet - I just uploaded my file via ..../edit (no special directory).

Jinx! is indeed a great software (I even think it's the best matrix software) and it's really regrettable that its developer has stopped any further development.

ElToberino avatar Nov 06 '22 21:11 ElToberino

Hi, sorry if things got a bit confusing (I tried my best to put links to what I refer to). For now I'll leave this PR (FSEQ Playback from LittleFS and SD) thread and will do updates on my original PR FSEQ Playback from LittleFS and SD. I posted here to basically inform @guardmedia that the base of this PR has changed and they could add fseq capabilities to my mod so it supports TPM2 and FSEQ. I'll answer open points concerning my TPM2 mod there. k/thx/bye 😃

constant-flow avatar Nov 06 '22 22:11 constant-flow

yep, I cloned exactly that fork to platformio, was also without this usermod. worked as zip file.

You should have a look at xlights, once you are over the slightly complicated workflow, it is really versatil.

harueg avatar Nov 06 '22 22:11 harueg

Did you get this error as well ? xtensa-esp32-elf-g++: error: wled00/wled00.ino.cpp: No such file or directory

harueg avatar Nov 06 '22 22:11 harueg

xtensa-esp32-elf-g++: error: wled00/wled00.ino.cpp: No such file or directory

@harueg I think that's the "compile it again and it will succeed"-bug I have with WLED from time to time.

constant-flow avatar Nov 08 '22 20:11 constant-flow

Yep, saw quindors video last night about compiling wled

But thank you

harueg avatar Nov 08 '22 20:11 harueg

Did you get this error as well ? xtensa-esp32-elf-g++: error: wled00/wled00.ino.cpp: No such file or directory

Yep, happens for me also, randomly. I think it's a problem in platformio, and nothing related to WLED. only known solution is to compile again.

softhack007 avatar Nov 09 '22 11:11 softhack007

Hi, sorry if things got a bit confusing (I tried my best to put links to what I refer to). For now I'll leave this PR (FSEQ Playback from LittleFS and SD) thread and will do updates on my original PR FSEQ Playback from LittleFS and SD. I posted here to basically inform @guardmedia that the base of this PR has changed and they could add fseq capabilities to my mod so it supports TPM2 and FSEQ. I'll answer open points concerning my TPM2 mod there. k/thx/bye 😃

Is there any news on Usermod with playback capabilities? Hardware is ready to use microSD card ;)

srg74 avatar May 08 '23 00:05 srg74

Is there any news on Usermod with playback capabilities? Hardware is ready to use microSD card ;)

Please take a look into this PR.. In pinciple the usermod works fine - but there are problems with a larger amount of leds. (Please read the discussion.) I hope someone can fix or modify it.

ElToberino avatar Jun 21 '23 19:06 ElToberino

@Aircoookie & @softhack007 I think it is time we finally tackle this PR (with help from @guardmedia and @constant-flow) as there are a few controller boards with SD card slots readily available. Would you agree?

blazoncek avatar Jul 25 '23 16:07 blazoncek