Skip to content

Remixing pixels on a single strip (and AVR clockless bugfixes) - #1265

Closed
ben-xo wants to merge 18 commits into
FastLED:masterfrom
ben-xo:feature/PixelCommand
Closed

ben-xo wants to merge 18 commits into
FastLED:masterfrom
ben-xo:feature/PixelCommand

Conversation

@ben-xo

@ben-xo ben-xo commented Jul 28, 2021 •

Copy link
Copy Markdown
Contributor

I present here a patch (which is currently only implemented fully for Clockless Trinket) which fixes a few long standing bugs as well as enabling new features.

Features

  • Interrupts can now be enabled on AVR.
  • Linked-list type "PixelCommand" (implemented only in Clockless Trinket at the moment) allows you to link together pointers within your LED array to render on the same strip without physically moving the data round. This allows for example:
    -- free "reverse" (on a per sub-block basis)
    -- mirroring
    -- repeating a short array of pixels onto a longer strip on a loop
    -- rotation (showing N...END, 0..N, then N+1..END, 0..N+1, etc)
    -- offsetting
    -- could also be used for scrolling vertically or horizontally on grids
  • define to disable the minimum wait period (if you do your own FPS)

Bugs Fixed

  1. clockless_trinket can now use negative skips. I jumped through some hoops to get this to work on gcc by freeing up 3 variables in the ASM constraints!
  2. NO_CORRECTION in controller.h is renamed to NO_COLOR_CORRECTION, because it clashes with a NO_CORRECTION In clockless_trinket (used to disable the clock skew correction
  3. removed trace of timer juggling - clockless_trinket should not be interfering with TCCR0A
  4. pixel arrays of length 0 no longer hang.

If you want to see it in action… i can provide video.

ben-xo and others added 18 commits December 31, 2020 17:12
…ockless signal.

This enables very fast interrupts (such an audio sampler) to work for e.g. sound reactive light setups, with minimal jitter.
… short pulses to stop them becoming long pulses.
…olor correction, the other with clock skew. Rename one of the uses.
…ender back to back, which allows offsetting without rewriting all the data.
it glitches the showN() function by occassionally taking too long when the frame loop point and an ISR fire at the same time.
…ent CRGB arrays and show them on a single strip.

The main purpose of this is to allow joining together of different offsets in a way that's fast enough for WS2811s. For example, by taking two pointers into your regular LED array, you can perform offsetting (e.g. scrolling rotation around a circular strip) without actually moving any of the CRGB data in RAM. This allows for a number of effects at essentially no cost.
@kriegsman

Copy link
Copy Markdown
Member

@ben-xo this continues to be a truly amazing piece of work; I love what you're doing in here. @samguyer and I have discussed it a bunch -- particularly the support for (short) interrupts, and I'd like to merge it in to the main library.

One thing that I'd like to ask for is that you consider making the the inclusion of the new SEI / CLI that you've added inside the output loops conditionally compiled in, depending on the value of FASTLED_ALLOW_INTERRUPTS. That way, code that is not trying to interrupts won't have to spend the clock cycles (or code size bytes), but code that is trying to use interrupts will get the extra instructions and capabilities. How does that seem to you?

Again, this is an amazing piece of work, and I'm very interested in getting it merged in, and shipped out to the world. Also, I'd like to play with it myself! Thanks again for the great contributions!

@ben-xo

ben-xo commented Jul 29, 2021

Copy link
Copy Markdown
Contributor Author

@ben-xo this continues to be a truly amazing piece of work; I love what you're doing in here. @samguyer and I have discussed it a bunch -- particularly the support for (short) interrupts, and I'd like to merge it in to the main library.

One thing that I'd like to ask for is that you consider making the the inclusion of the new SEI / CLI that you've added inside the output loops conditionally compiled in, depending on the value of FASTLED_ALLOW_INTERRUPTS. That way, code that is not trying to interrupts won't have to spend the clock cycles (or code size bytes), but code that is trying to use interrupts will get the extra instructions and capabilities. How does that seem to you?

Hooray, glad you're finding this interesting!!

Because of the way the _D1() / _D2() / _D3() delays are structured, it shouldn't actually add any clock cycles. But it could add code size bytes, you're right.

I would be most happy to pry-apart this PR into smaller more focussed PRs. I kinda just filed it all in one to gauge interest.

I'll open a series of more focussed PRs and try to apply your recommendations.

Again, this is an amazing piece of work, and I'm very interested in getting it merged in, and shipped out to the world. Also, I'd like to play with it myself! Thanks again for the great contributions!

😊

@ben-xo

ben-xo commented Jul 29, 2021

Copy link
Copy Markdown
Contributor Author

closing this PR; opening a series of new PRs.

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.

2 participants