Skip to content
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

Segments >0 not correctly applied when preset cycle is active #1447

Closed
lucaf86 opened this issue Dec 7, 2020 · 3 comments
Closed

Segments >0 not correctly applied when preset cycle is active #1447

lucaf86 opened this issue Dec 7, 2020 · 3 comments
Labels
bug confirmed The bug is reproducable and confirmed

Comments

@lucaf86
Copy link

lucaf86 commented Dec 7, 2020

Describe the bug
I have a preset with two segment, each segment has a different configuration with diferent effects.
Here the API command: {"on":true,"bri":28,"transition":7,"mainseg":0,"seg":[{"id":0,"start":0,"stop":298,"grp":1,"spc":1,"on":true,"bri":255,"col":[[0,0,255],[8,255,0],[0,0,0]],"fx":96,"sx":89,"ix":29,"pal":48,"sel":true,"rev":false,"mi":false},{"id":1,"start":1,"stop":298,"grp":1,"spc":1,"on":true,"bri":255,"col":[[0,0,189],[0,0,207],[255,255,255]],"fx":28,"sx":128,"ix":128,"pal":3,"sel":true,"rev":false,"mi":false},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0}]}
If I apply the preset standalone it works as expected but if it's part o a preset cycle the second segment has the same configuration of the first segment.

To Reproduce
insert the above preset in a preset cycle

Expected behavior
Segments >0 should be restored as configured in the API

WLED version

  • Board: Wemos D1 mini
  • Version 0.11.0 Mirai
  • Format self-compiled

Additional context
Anything else you'd like to say about the problem?

Thank you for your help!

@lucaf86 lucaf86 added the bug label Dec 7, 2020
@lucaf86 lucaf86 changed the title Segments >0 not correctly configuredwhen preset cycle is active Segments >0 not correctly applied when preset cycle is active Dec 7, 2020
@lucaf86
Copy link
Author

lucaf86 commented Dec 7, 2020

I Think I've found the issue but I'm not sure how to fix it.
When the preset is changed inside a preset cycle the function colorUpdated(int callMode) is called and strip.applyToAllSelected = true forces to update all the segments with the same configuration.
Inside setEffectConfig() (called by colorUpdated()) there is a loop which overwrites all the segments:
if (applyToAllSelected) {
for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++)
{
if (_segments[i].isSelected())
{
_segments[i].speed = s;
_segments[i].intensity = in;
_segments[i].palette = p;
setMode(i, m);
applied = true;
}
}
}

maybe is sufficient to avoid forcing strip.applyToAllSelected = true in this case but I don't know if it has consequences.
Has a temporary workaround, setting "sel":false for the second segments solve the problem

@Aircoookie
Copy link
Owner

Thank you very much for the troubleshooting, it is highly appreciated! Will change that right away!
strip.applyToAllSelected must indeed be false with 0.11 presets - I missed changing this, as true was correct in 0.10.

@Aircoookie Aircoookie added the confirmed The bug is reproducable and confirmed label Dec 7, 2020
@Aircoookie
Copy link
Owner

This should now be fixed in latest master :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed The bug is reproducable and confirmed
Projects
None yet
Development

No branches or pull requests

2 participants