Edit: I got this slightly wrong. Seems like all the slider functions are called when you move any slider.
If you call a user defined function from inside a slider function, all of the slider functions get called - not just the one for the slider you touched. Inline code in the functions seems fine. If you just want to change variables
or calculate inside slider functions it works as expected.
Here’s a short pattern that illustrates the behavior (on firmware 2.23). ~Move Control1, and only value1 changes. Now, uncomment the call to Moving either control will change both value1 and value2.ChangeValue2
in sliderControl2
.
If this is the way it’s supposed to work, or if it’s a real pain to fix, I’m totally good with it now that I know what’s going on. That leads to my next question though: How do I update a pattern I uploaded to the library? I used function calls in sliders in some code I uploaded last night, and I’d like to fix them to get rid of the icky unnecessary blinkiness when moving controls.
Thanks!
export var value2 = 0;
export function changeValue2() {
value2 += 1;
}
export function sliderControl1(v) {
value1 += 1;
}
export function sliderControl2(v) {
value2 += 1;
// changeValue2();
}
export function beforeRender(delta) {
t1 = time(.1);
}
export function render(index) {
h = t1 + index/pixelCount ; s=1 ; v=1;
hsv(h, s, v);
}