Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Also fixes a few CI things - spotbugs doesn't need to pass, and formatter diff stages work now
Using LEDs
Two things are needed in code to be able to use LEDs: an
AddressableLED
object, which is a WPI class that can write data out on a PWM port to control an LED strip, and anAddressableLEDBuffer
, which is used to store the data for LED strips.This is about as much as WPILib provides for us - if we want to do fancier things with LEDs, we'd need to write that ourselves:
If we want to do animated effects, that would be more complicated code, and would be repetitive (remember "Don't Repeat Yourself"?)
Animating LEDs
To make it easier to manage animating LEDs without manually writing the color of each and every LED yourself, I've added a few classes to manage animations and building up more complex animations from simple ones. Animations require a reader and a writer to run - they deliberately don't work with LED data buffers directly, because that prevents animations from being efficiently chained together.
We can update the LED subsystem to work with animations - here, we add a dataView that animations can work with, and a method that runs an animation as a command. This lets us bind animations to button presses, robot state, or match timing just like any other command
Of course, we can also define some prebuilt commands in this subsystem:
And even make some fairly complicated animated patterns:
Be sure to look at the
Animation
class, there's a lot of helpful things in there.