Moode Forum
Rotary Encoder: What are the possibilities? - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7)
+--- Thread: Rotary Encoder: What are the possibilities? (/showthread.php?tid=1229)

Pages: 1 2


Rotary Encoder: What are the possibilities? - chbla - 03-30-2019

Hi there,

I've got a quick question regarding the rotary encoder.
I'm using an IQAudio PiDigiAmp+ it forwards Pins for the
rotary encoder as well as mute.

Somehow the rot encoder does not seem to work for squeezelite, is this true?
I would like to control the volume for squeezelite/spotify/bluetooth - is this possible
with a rotary encoder?

Edit: I just noticed it doesn't work for any of the sources. It just clicks in the speaker...
any idea what causes this?

I'm using this one:
https://www.aliexpress.com/item/Promotion-3Pcs-6mm-D-Shaft-18-Position-360-Degree-Rotary-Encoder-w-Push-Button/32430672725.html?spm=a2g0s.9042311.0.0.27424c4dsKyyao


Thank you,
Christoph


RE: Rotary Encoder: What are the possibilities? - Tim Curtis - 03-30-2019

moOde 's built in rotary encoder driver controls MPD volume and also updates the volume knob. Controlling the volume for any of the renderers happens on the client that's running the playback app for the renderer and thus a rotary encoder is not applicable.


RE: Rotary Encoder: What are the possibilities? - chbla - 03-30-2019

(03-30-2019, 12:49 PM)Tim Curtis Wrote: moOde 's built in rotary encoder driver controls MPD volume and also updates the volume knob. Controlling the volume for any of the renderers happens on the client that's running the playback app for the renderer and thus a rotary encoder is not applicable.

Thank you Tim. Any idea why I only get a weird clicking noise in the speaker when using the encoder?
Does it log anything or how could I debug this?


RE: Rotary Encoder: What are the possibilities? - Tim Curtis - 03-30-2019

The driver runs the commands below when it detects clockwise or counterclockwise movement in the encoder. you could just run these manually from ssh to verify that MPD volume is changing and the knob is being updated.

Code:
/var/www/command/rotvol.sh -up 1

/var/www/command/rotvol.sh -dn 1



RE: Rotary Encoder: What are the possibilities? - chbla - 03-30-2019

(03-30-2019, 01:26 PM)Tim Curtis Wrote: The driver runs the commands below when it detects clockwise or counterclockwise movement in the encoder. you could just run these manually from ssh to verify that MPD volume is changing and the knob is being updated.

Code:
/var/www/command/rotvol.sh -up 1

/var/www/command/rotvol.sh -dn 1

Thank you Tim, the scripts itself work so I assume it's a problem either with the connection or the script that calls these commands.
Can you maybe tell me from where this is called and if I can test that?


RE: Rotary Encoder: What are the possibilities? - Tim Curtis - 03-30-2019

They are called from the rotary encoder driver.

The binary is /usr/local/bin/rotenc
The source code is in the Git repo
https://github.com/moode-player/moode/blob/master/other/rotenc/rotenc.c


RE: Rotary Encoder: What are the possibilities? - chbla - 03-30-2019

(03-30-2019, 02:58 PM)Tim Curtis Wrote: They are called from the rotary encoder driver.

The binary is /usr/local/bin/rotenc
The source code is in the Git repo
https://github.com/moode-player/moode/blob/master/other/rotenc/rotenc.c

Thank you, do you have any idea what the following debug output means?
DEBUG: 1 
ISRDBG: 0 
delay: 100 
accel: 2 
step: 3 
pin_a: 38 
pin_b: 40 
gpio: Unable to open GPIO direction interface for pin -1: No such file or directory
gpio: Unable to open GPIO direction interface for pin -1: No such file or directory
start


RE: Rotary Encoder: What are the possibilities? - chbla - 03-30-2019

No worries, I used the wrong IDs - it works if I use 28, 29 instead.

However, this is still very strange:

If I run rotenc the music playback (moode playlists) is muted. If I turn the encoder, the volume in the interface
is correctly increased/decreased, but I don't have sound anymore until I reboot.

Also I have these cracking noises in my speakers...


RE: Rotary Encoder: What are the possibilities? - Tim Curtis - 03-30-2019

The driver uses the wiringPi GPIO library and so you need to use wiringPi pin numbering scheme.
http://wiringpi.com/pins/

You can also run the cmd below to print out the pin numbers

Code:
gpio readall

Note: The cmd won't work on Pi-3A+ until I bump to wiringPi 2.50 lib.

-Tim


RE: Rotary Encoder: What are the possibilities? - chbla - 03-30-2019

Thanks, I figured out how to correctly read the GPIOs.

However:

- there are still cracking sounds when I turn the encoder
- if I try to read the GPIO with this simple script, it works, but as soon as I start the script, Moode stops the music and somehow
does not recover: https://www.raspberrypi.org/forums/viewtopic.php?t=198815

@Tim Curtis is there anything I can do to debug this or fix it?