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

Add support for setting encoder position #21

Merged
merged 2 commits into from
Dec 14, 2023

Conversation

caternuson
Copy link
Contributor

For #20. Implements setting encoder position.

Tested with a PID 5752 and QT PY RP2040 running CP.

BEFORE

Adafruit CircuitPython 8.2.2 on 2023-07-31; Adafruit QT Py RP2040 with rp2040
>>> import board
>>> from adafruit_seesaw.seesaw import Seesaw
>>> i2c = board.STEMMA_I2C()
>>> ss = Seesaw(i2c, addr=73)
>>> for i in range(4):
...     print(ss.encoder_position(i))
... 
-11
-11
8
10
>>> for i in range(4):
...     ss.set_encoder_position(2342, i)
... 
>>> for i in range(4):
...     print(ss.encoder_position(i))
... 
-11
-11
8
10
>>>

AFTER

Adafruit CircuitPython 8.2.2 on 2023-07-31; Adafruit QT Py RP2040 with rp2040
>>> import board
>>> from adafruit_seesaw.seesaw import Seesaw
>>> i2c = board.STEMMA_I2C()
>>> ss = Seesaw(i2c, addr=73)
>>> for i in range(4):
...     print(ss.encoder_position(i))
... 
5
-7
1
15
>>> for i in range(4):
...     ss.set_encoder_position(2342, i)
... 
>>> for i in range(4):
...     print(ss.encoder_position(i))
... 
2342
2342
2342
2342
>>>

@caternuson
Copy link
Contributor Author

@ladyada for review

Copy link

@jmeier5261 jmeier5261 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was extremely disappointed that this functionality was not in the stock firmware since its a core function of rotary encoders. Thankfully I was able to find this PR through the forums and after $10 and a few days waiting I had the programmer. I was able to flash this on my 5752 Quad encoder board using the ATtiny817 and confirmed the functionality using my Arduino Nano ESP32 board and Arduino IDE (After messing with the seesaw library a little to get it to compile for the nano esp32). I would suggest merging this and making it the default firmware on these boards moving forward since its not reasonable to expect everyone to flash it manually just to get some basic functionality working especially since the programmer is needed and the megaTinyCore board package doesn't work for Arduino IDE 2.X. Cheers for the PR and thank you for your work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants