pimoroni / mopidy-raspberry-gpio

Mopidy GPIO Control Plugin for the Raspberry Pi (Using RPi.GPIO)
Apache License 2.0
21 stars 25 forks source link

Support for rotary encoder #12

Closed martinfelis closed 3 years ago

martinfelis commented 3 years ago

Adds support for rotary encoders (potential fix for #11). Two pins can be linked by specifying the same id for the rotenc_idoption e.g.:

    [raspberry-gpio]
    enabled = true
    bcm21 = volume_down,active_low,10,rotenc_id=vol,step=1
    bcm20 = volume_up,active_low,10,rotenc_id=vol,step=1

In principle multiple rotary encoders should be supported, simply use different rotenc_ids.

In case you want to use the reverse rotation simply swap the events in the first argument to the bcm specification.

codecov-io commented 3 years ago

Codecov Report

Merging #12 (289edf8) into master (b4f6137) will increase coverage by 3.67%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #12      +/-   ##
==========================================
+ Coverage   91.08%   94.76%   +3.67%     
==========================================
  Files           2        4       +2     
  Lines         101      172      +71     
==========================================
+ Hits           92      163      +71     
  Misses          9        9              
Impacted Files Coverage Δ
mopidy_raspberry_gpio/frontend.py 93.75% <100.00%> (+2.08%) :arrow_up:
mopidy_raspberry_gpio/rotencoder.py 100.00% <100.00%> (ø)
mopidy_raspberry_gpio/__init__.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b4f6137...289edf8. Read the comment docs.

martinfelis commented 3 years ago

@Gadgetoid thanks for the hint.

Gadgetoid commented 3 years ago

Thanks for the awesome addition to this library!

Now to... uh... figure out how to release this sucker. It's been a while.

martinfelis commented 3 years ago

In case it is possible to add this somehow: the contributions of this pull request was joint work with @bombadil.