-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Effect transitions #3311
Effect transitions #3311
Conversation
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.
Transitions look amazing!
@@ -381,6 +381,26 @@ typedef struct Segment { | |||
byte *data; // effect data pointer | |||
static uint16_t maxWidth, maxHeight; // these define matrix width & height (max. segment dimensions) | |||
|
|||
typedef struct TemporarySegmentData { |
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 is not bad at all, so this is just a suggestion, but wouldn't it be more maintainable to make TemporarySegmentData
an anonymous struct CoreSegmentData
and use it both within Segment
and Transition
? All the members could still be accessed like usual (e.g. seg.speed
) since the anonymous struct has no name. Copying could probably also be simplified from how it is implemented now in saveSegenv()
as the whole struct could be copied in one line (not sure if it is possible to do that with anonymous structs though).
Oh, and _briT
, _cctT
and _modeT
could be added to the struct too, instead of being in the transition (although that would use 4 bytes more per transition currently due to alignment, so it can stay as is for the time being).
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.
I did experiment with that but it is not easy to use anonymous struct in two places.
_bri, ... were initially in the structure but I was having issues with restoring values so I moved them back out of the struct.
wled00/FX_fcn.cpp
Outdated
@@ -470,6 +557,7 @@ void Segment::setMode(uint8_t fx, bool loadDefaults) { | |||
sOpt = extractModeDefaults(fx, "mY"); if (sOpt >= 0) mirror_y = (bool)sOpt; // NOTE: setting this option is a risky business | |||
sOpt = extractModeDefaults(fx, "pal"); if (sOpt >= 0) setPalette(sOpt); //else setPalette(0); | |||
} | |||
markForReset(); |
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 is a good change, resetting mid-transition like in main
led to quite a few issues (new effect allocating data just for it to reset and re-allocate mid-transition), so I will probably change it there too for b4. Should probably be un-commented in WS2812FX::setMode
as well.
wled00/FX_fcn.cpp
Outdated
@@ -1079,13 +1170,15 @@ void WS2812FX::service() { | |||
_segment_index = 0; | |||
Segment::handleRandomPalette(); // move it into for loop when each segment has individual random palette | |||
for (segment &seg : _segments) { | |||
if (!seg.isActive()) continue; |
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.
Continuing before seg.resetIfRequired()
causes segment data to not be freed if the segment is deleted. Could this be the cause of the leak you observed?
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.
Good catch.
Fixed skipped pixel flashing.
- breaking change - remove leading 0 checkmark - add reverse scroll checkmark - add vertical scroll if text fits into segment (intensity ==0 or ==255) - rotated characters - leading 0 check added to short texts (i.e. #DDMM0) Fixes #3322
@blazoncek I've tested the new code on my "portable 16x8" equipment - looks good 👍 I just noticed a problem with the "Matrix" effect when "global LEDs buffer" is disabled. Only the top row is changing, all other rows stay dark. Not sure if this is related to fx-blending, or maybe its a general bug. Will re-test with my bigger setup in the next days, to see if I can confirm the problem on a second ESP32. |
For fun create a gap file (to disable a few LEDs) and observe the outcome. 😁 Matrix is flawed. In many ways. |
Oh, and BTW all of my units now use |
I'll try that 😁 Just took a quick look at the Matrix effect code, and it seems it will 100% fail without absolutely lossless getPixelColor(). Lines 5136 to 5137 in ba1b6f3
Maybe let's consider Matrix a hopeless case, and get back to it once our universes have imploded, or when one of us is totally bored 😝 whatever comes first ;-) |
I want the lady in red and a steak. 😉 |
@softhack007 as @Aircoookie is currently busy do you agree to merge this and then create a new beta release? |
by @blazoncek
Enables smooth blending from the previous effect if the effect is changed.