-
Notifications
You must be signed in to change notification settings - Fork 613
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
AddressableLED ColorOrder #2329
Conversation
Three years, do we want to do anything with this? What was this blocked on? (not that I expect anyone to remember...) |
It needs a C++ version, but the problem is that you can't do a C++ version of this in the same way, since the LEDData class in C++ is a bit-for-bit wrapper around the C structure. We could maybe make a templated LEDData class (or simply separate LEDData classes) to do the different color order variants? |
What's the use case for this, anyway? |
Most COTS led strips are not RGB color order, and many differ from the typical BGR too. I have a few GRB strips |
wpilibj/src/main/java/edu/wpi/first/wpilibj/AddressableLEDBuffer.java
Outdated
Show resolved
Hide resolved
default -> { | ||
// Unreachable | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://docs.oracle.com/en/java/javase/17/language/switch-expressions.html this shouldn't be required for enums?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, for some reason, a bunch of places in WPILib have default cases for enums anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh weird...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a switch expression, it's still a statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The empty default is functionally equivalent to not handling it
Implementing the c++ version via templates is now significantly more difficult due to the LED pattern library. |
I think the right answer for this may be to do the color channel swizzling when the buffer is copied to the FPGA, rather than on every write, using NEON SIMD to make it fast using code similar to https://github.com/ermig1979/Simd/blob/master/src/Simd/SimdNeonBgrToRgb.cpp (effectively the same code as discussed here: https://developer.arm.com/documentation/102159/0400/Load-and-store---example-RGB-conversion). We'd want to align and pad out the internal buffers to avoid boundary conditions. |
In the interest of preventing duplicated work- I've got the simd solution mostly implemented, just need to take some time and finish up all the little details. |
Superseded by #7102. |
No description provided.