Repository navigation
Fix #1853 - RGBWEmulated does not work with SAMD21 clockless - #1854
Merged
Merged
Conversation
RGBWEmulatedController was not calling beginShowLeds and endShowLeds. This broke SAMD21's ClocklessController. SAMD21 also crashed because (I think) of FastLED#1101 . I changed RGBWEmu* to call showLeds instead of show Pixels. I also changed it to use higher level interfaces to reduce coupling between RGBWEmu* and CLEDController and keep m_Data non-null.
Contributor
Author
|
Is there some documentation I should be updating with this? I didn't find any docs that described what RGBWEmulated is supposed to do or how to use it, just the example. Ditto tests. Should I be adding or updating a test? |
Member
|
Oh wow, what a gift! I'm answer to your questions... I'm a fan example-driven documentation enforced by automated testing. Yes there are unit tests, you can add them if you want but will require some mocking to get this in. Let me digest this on monday when I get back from my party weekend and get this in for 3.9.12. Again, thank you very much for this! |
Contributor
Author
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The issue was that the RGBWEmulated controller did not call the device controller's
initmethod. Also, it did an update by callingshowPixels.showPixelsbypasses the device'sbeginUpdateLedsandendUpdateLedsmethods.Keep in mind that the device controller is automatically linked into the global list of controllers (private to
CLEDController). So when show occurs, the device controller's show methods (beginShowLeds,showLedsInternalandendShowLeds) are invoked. Because of the creation order, they are called immediately after RGBWEmulated's show methods.I've changed RGBWEmulated to call the device controller at a higher level. Instead of the device owning no LEDs and using LEDs passed in via showPixels, RGGWEmulated gives the LEDs immediately after allocating them (usually on the first show), then calls CLEDController::showLeds (with full brightness). showLeds handles calling beginShowLeds, showLedsInternal, and endShowLeds.
To keep the device controller from displaying the same LEDs again when its show methods are invoked, RGBWController disables the controller (
setEnable(false)).Advantages of doing it this way.
beginShowLedsandendShowLedsshowPixelsDisadvantages.
CLEDController::showLedswhich is not in the most-used code pathCRGBW also calls the device controller's
initmethod, which should be non-controversial, and it resets all the parameters that would let CPixelController modify the RGB values. Again, I changed the code to use higher-level interfaces to reduce coupling.Sorry for the wall of text. I'm new here and erring on the side of overexplanation.