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

Feature/rgb animation refactor #2736

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Sapphirewhale
Copy link

@Sapphirewhale Sapphirewhale commented Dec 29, 2024

Hi all! This is my first time contributing to this repo (also first time working on an OS, and first time writing C since uni), so feel free to let me know if you have any feedback on the code or PR. Here's the summary of my changes:

  • Refactors the existing underglow effects system to make it easier to add new effects and effect callbacks
  • Adds a new dts binding to provide board developers with a way to map LED positions to physical positions
  • Adds a new underglow effect callback for key presses, with an accompanying listener
  • Adds three new LED effects:
    • Matrix: Has leds light up in sequence following columns down the keyboard, with previous LEDs fading, simulating code monitors from the matrix
    • Glitter: Lights up leds corresponding to the pressed keys
    • Ripple: Lights up leds in an expanding circle around the pressed keys (this one has some performance issues :( )

Tested on a glove80 with both this repo and the version written from the moergo-sc fork.
I did write this all in the hopes that it would work out of the box on a different keyboard, but I don't have one available to test with, so if you're feeling up to writing up the underglow transform and testing it on your own board, feel free to let me know if you have any issues and I can try to fix it up.

The effects I've added are things that I figured would help break down my testing, and that I personally enjoyed, but I'm happy to break them out into a separate PR or remove them entirely, my main goal was to make this code easier to modify for anyone else in the community with fun ideas for LED effects.
The ripple effect was the main effect I wanted to implement, but I'm afraid that it's not especially performant, if you have the time and motivation to work out what's causing that and fix it I would greatly appreciate it.

I'm also happy to write up some basic documentation on how to add effects and use some of the utility functions if anyone could point me to a good spot in the docs.

PR check-list

  • Branch has a clean commit history
  • Additional tests are included, if changing behaviors/core code that is testable.
  • Proper Copyright + License headers added to applicable files (Generally, we stick to "The ZMK Contributors" for copyrights to help avoid churn when files get edited)
  • Pre-commit used to check formatting of files, commit messages, etc.
  • Includes any necessary documentation changes.

Converts the rgb_underglow_effect enum into a struct, allowing for new effects to be added without the need for a new case statement and enum value
Allows underglow effects to provide a callback to be triggered whenever a key is pressed on the keyboard. This allows for the building of underglow effects that react to key presses.
Adds an underglow transform dts binding, which defines a mapping from physical positions to underglow pixel indexes, allowing developers to identify the index for the LED which corresponds to a given keypress, and generally place LEDs from the strip in physical space.
Adds functions and values to be used in animated and reactive rgb underglow effects
Adds functionality to disable and enable ext power based on whether any LEDs are currently active.
Removing duplicate underglow effects list (whoops)
Adds a new underglow effect simulating symbols scrolling down the keyboard columns similar to the code monitors from the matrix.
Adds a new underglow effect which turns on the LED underneath each key with a random color whenever they are pressed, then gradually fades them out
Adds a new underglow effect simulating a ripple of light emanating from any pressed key.
@Sapphirewhale Sapphirewhale marked this pull request as ready for review December 31, 2024 05:36
@Sapphirewhale Sapphirewhale requested a review from a team as a code owner December 31, 2024 05:36
@Nick-Munnich
Copy link
Contributor

I'm afraid that this comment of mine also applies here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants