Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgb_2d: 2D RGB effects extension. #985

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Gadgetoid
Copy link
Contributor

Add a 2D RGB effects extensions which allows for effects like Larson scanning or rainbow cycling to span the whole width/height of a board.

After making RGB fast on the Keybow 2040 I wanted some nice effects to run on it.

This is a very early prototype of a 2D RGB effects extension.

Features:

  • Effects are pluggable by design
  • Animations are wall-timed - time.monotonic() isn't great for this afaik but it works - to be framerate independent
  • Effects are constant time, you can know how quick a colour cycle will finish, etc
  • Reports framerate (potential, not actual) over debug

Limitations:

  1. Supports only one PixelBuf or compatible, use an extension instance for each PixelBuf
  2. All key binding and customisation functionality has been removed until the core is finished
  3. Effects are functions which return an animate closure, they can set up some basic variables to store state, or accept config arguments but mostly only take a "t" variable from which RGB effects are algorithmically derived
  4. Only tested on a 4x4 matrix powered by an RP2040

TODO:

  • Add support for passing config args to effects, maybe via an effects stack which would allow a user to customise each effects finer points to their board and then just control basic stuff (brightness, hue, selected effect) via key bindings for the whole stack
  • Add back all the key bindings
  • Documentation
  • Testing (anyone got a nice big RGB backlit board to run this on?)

Add a 2D RGB effects extensions which allows for effects like larson scanning
or rainbow cycling to span the whole width/height of a board.

Signed-off-by: Phil Howard <[email protected]>
@Gadgetoid
Copy link
Contributor Author

I should probably also pay attention to the mentioned issues here: https://kmkfw.zulipchat.com/#narrow/stream/384078-KMK-development/topic/RGB.20Feature.3F

I don't believe animations really need start and stop methods, they should be as close to stateless - think pixel shader - as possible. They serve only to answer the question: "what colour should this LED be at this time."

rgb_2d is not trying to refactor rgb but there are probably few reasons why it couldn't replace it.

Key awareness is something I looked into but I don't know enough about the codebase to tackle it yet. I wanted animation effects that would respond to a keypress but without an LED->Key map and a position aware keypress handler that's a non starter.

@xs5871
Copy link
Collaborator

xs5871 commented Jun 13, 2024

Matrix animations, or even some kind of positional awareness of addressable LEDs would be a sensible addition. What I don't want to happen is yet another LED extension that shares 80% of the funcionality with the other 4.

@Gadgetoid
Copy link
Contributor Author

I couldn’t even find the other four. Did I miss a link somewhere?

But- yes - agreed.

@xs5871
Copy link
Collaborator

xs5871 commented Jun 14, 2024

rgb, peg_rgb_matrix, led, statusled all share at least some kind of functionality. The "other 4" was more of a "O(4)" estimate.

@Gadgetoid
Copy link
Contributor Author

Haha!

I’m already planning out another rewrite since I do a lot of Things With LEDs and have some Ideas. Regrettably I have few actual boards to test with so I’m probably going to have to make one first 🤣

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