Conversation
Updated comments and functionality for the detonator buttons, including new features like mute and countdown timer sound.
Reset Variation on Off(). Clean up unused bools.
Semi final bc detonator buttons
Updated comments
Make smoothswings swapping better when Alt is switched. (profezzorn#893)
Updated comments for clarity and corrected logic in IsHandled method.
| } | ||
| bool IsHandled(HandledFeature effect) override { | ||
| if (current_style_) | ||
| if (!current_style_) |
There was a problem hiding this comment.
This was inverted and I guess just went unnoticed for a long time.
There was a problem hiding this comment.
Fix should be in a separate PR.
profezzorn
left a comment
There was a problem hiding this comment.
I think this could be a one-liner....
| NUM_BLADES is 1 in this example, and the style sees a blade with three LEDs. | ||
| Note that LED addresses start at zero, so LED 20 is index 19. | ||
|
|
||
| That means you do NOT HAVE to list all the LEDs you don't want in an extra |
There was a problem hiding this comment.
We don't need to document the things you don't have to do.
| blade = first_subblade_wrapper->blade_; | ||
| } | ||
|
|
||
| // Negative indices are allowed, they just mean that the LED goes nowhere. |
There was a problem hiding this comment.
This comment doesn't match the code.
| // addresses a few of the LEDs. That way the LEDs which aren't part of any | ||
| // sub-blade end up dark instead of showing whatever happened to be in the | ||
| // frame buffer already. | ||
| if (blank_unused_leds_) blade_->clear(); |
There was a problem hiding this comment.
The if statement is redundant. (because Run() is only called once per subblade group.)
I think the comment is not very helpful.
Maybe say something like:
Without clearing the blade, pixels which aren't part of any subblade will get random values.
There was a problem hiding this comment.
I assume you meant the comment is redundant, and that the code is fine, hence the comment suggestion?
I changed it to // Without clearing the blade, pixels which aren't part of any subblade may get random values.
Better?
There was a problem hiding this comment.
No, I meant the if statement is redundant, just "blade_->clear();" should be enough.
There was a problem hiding this comment.
I see. Yes it is. Edited.
| // list, so any LED which isn't part of some sub-blade has to be turned off | ||
| // explicitly. This is set on the primary sub-blade, which is the one that | ||
| // runs all the styles in the chain. | ||
| void SetBlankUnusedLeds() { |
| Usage: SubBladeWithList<int1, int2, ...>(blade_definition) | ||
| Like SubBlade, but you provide a custom list of LED indices instead of a range. | ||
| Useful for ring-based or irregular LED layouts. | ||
| The style only sees the LEDs in the list, and every LED of the underlying blade |
There was a problem hiding this comment.
This is a long and weird comment, why not just say:
Pixels wrapped into a subblade, but not referenced by any subblade will be black.
| blade = first_subblade_wrapper->blade_; | ||
| } | ||
|
|
||
| // Unmapped LEDs are allowed; a negative mapping means that this |
There was a problem hiding this comment.
This should be done at compilation time.
| ret->SetupSubBlade(blade, 0, count); | ||
| // first_subblade_wrapper is the primary sub-blade of this chain, and the | ||
| // one which gets to blank out the LEDs that this list doesn't cover. | ||
| first_subblade_wrapper->SetBlankUnusedLeds(); |
| SubBladeWrapper* next_; | ||
| int blade_number_; | ||
| bool primary_ = false; | ||
| bool blank_unused_leds_ = false; |
I will update the POD if/when this is approved.
Basically, this update allows the user to avoid needing to fill out the SubBladeWithList with a "dummy" blade definition containing all the non-targeted pixels.
So for example, if you only want to light up 3 pixels anywhere along a 95 pixel blade, instead of needing to do the current requirement of:
It can now just be
Tested and working well.