Saiyato / volumio-rotary-encoder-plugin

Simple dual rotary encoder plugin for Volumio 2.x
MIT License
19 stars 6 forks source link

"SW" on rotary encoder not working for short/long press #21

Closed Sirnut closed 3 years ago

Sirnut commented 3 years ago

I've set this plugin up and have been trying to get it to work with my Raspi 2 B+ IQAudio DAC+ and KY040 encoder

I'm using GPIO spots CLK:5 DW:6 SW:13

Knob rotation is registered with no issue, but I seem to have trouble getting the push function of the knob to be registered

Saiyato commented 3 years ago

Hi @Sirnut ,

I did some googling, not sure why you picked GPIO13, but that pin has PWM functionality and is pulled down instead of up. See: https://elinux.org/RPi_BCM2835_GPIOs

This means you have a few options, the list is not exhaustive, but these come to mind:

  1. Use another pin, which is pulled up (see: https://raspberryautomation.com/raspberry-gpio-pins/)
  2. Pull up the pin in config.txt gpio=13=ip,pu (documentation here: https://www.raspberrypi.org/documentation/configuration/config-txt/gpio.md)
  3. Patch the code to suit your setup if you're unable to select another pin (e.g. due to hardware design, case, etc.)
  4. Create a PR to dynamically select which pins are pulled which way per board revision (and x86). Just kidding, this is pretty much undoable :wink:

TL;DR Pick another GPIO like 2, 3, 4, 7 or 8 (anyone pulled up), pull the GPIO up manually (in SW or HW) or patch the code to work with pulled-down pins.

Sirnut commented 3 years ago

Big thanks for the quick response. Full disclosure I've been out of the game for a while and completely forgot about the pull up/down status. I changed the pin in my config.txt and everything works as it should!

Thank you again for your help!!