raphaelyancey / pyKY040

🎛 High-level Python interface for the KY040 rotary encoder
https://pypi.org/project/pyky040/
GNU General Public License v3.0
26 stars 16 forks source link

Add initial position value #5

Open Bcow7 opened 4 years ago

raphaelyancey commented 4 years ago

Thanks for the PR @Bcow7!

Is there a reason you got rid of this line ? If you don't use initial_pos then you still would want it to be set to a default.

Bcow7 commented 4 years ago

You are right. I missed the default value

raphaelyancey commented 4 years ago

My bad, that's on me — self.counter is initialized to 0 at the instanciation. So you were right, you can get rid of the line.

Since your first commit I've added tests. Could you add a few lines for this new param? Also we need to assert self.initial_pos >= self.min_counter and self.initial_pos <= self.max_counter in the lib, and your test would check that it is enforced. You can create a new test function I think, because anyway I need to add tests for all those type assertions.

If you don't have time for this I'll do it, just tell me! Sorry for those back-and-forth I'm kind of new to managing PRs ;)