Skip to content

Conversation

@nariox
Copy link
Contributor

@nariox nariox commented Apr 17, 2019

Sometimes it's desirable to set the initial value to a predefined value (say, a encoder that controls both "volume" and "frequency", by switching between these functions, it's helpful if we can set the initial value to the current internal value.

I've been doing this by setting the min_val to -100, and then applying the offset to my current value, but I've figured this is more elegant.
I've tried to keep it compatible with how it was previously, but please correct me if this is not right.

Sometimes it's desirable to set the initial value to a predefined value (say, a encoder that controls both "volume" and "frequency", by switching between these functions, it's helpful if we can set the initial value to the current internal value. I've been doing this by setting the min_val to -100, and then applying the offset to my current value, but I've figured this is more elegant. I've tried to keep it compatible with how it was previously, but please correct me if this is not right.
@SpotlightKid SpotlightKid self-assigned this Apr 17, 2019
@SpotlightKid SpotlightKid changed the title Allow setting the initial value manually [encoder] Allow setting the initial value manually Apr 17, 2019
@SpotlightKid SpotlightKid merged commit 3531900 into SpotlightKid:master Apr 17, 2019
@SpotlightKid
Copy link
Owner

SpotlightKid commented Apr 17, 2019

Good idea, thanks!

I'll change the position of the init_val keyword parameter in the init method signature to come before min_val in a follow-up commit, though.

@nariox
Copy link
Contributor Author

nariox commented Apr 17, 2019

Thank you for the quick merge. I left it as the last so it remains compatible with previous versions, but I agree it would make sense to keep it together with min and max values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants