Could this be related?
Results 231 to 240 of 275
-
2019-08-25, 03:06 #231
-
2019-08-25, 06:10 #232
There is a command line utility, but that works using an extra daemon running. You can read and set pins directly from a shell, there is no need for external commands.
https://raspberrypi-aa.github.io/session2/bash.htmlpiCorePlayer a small player for the Raspberry Pi in RAM.
Homepage: https://www.picoreplayer.org
Please donate if you like the piCorePlayer
-
2019-08-25, 06:13 #233
-
2019-09-07, 08:49 #234
A few updates.
pigpio library is interesting, but I was using it sort of wrong.....here is a new sbpd binary, its dynamically linked now.
https://dl.dropboxusercontent.com/s/...r26t8ii35/sbpd
Requirements:
- pigpio.tcz - library and tools extension
- First start pigpiod with root access. This self daemonizes, and there are no command line options.
- Then run sbpd as you normally would, except note the change in encoder setup. I've added a detent mode, which will only increment based on a detent. (Assuming most encoders are 4 steps per physical detent) This really smooths out the enocder increments.
Code:For rotary encoders (one, volume only): e,pin1,pin2,CMD[,mode] "e" for "Encoder" p1, p2: GPIO PIN numbers in BCM-notation CMD: Command. one of. VOLU for Volume TRAC for Prev/Next track mode: Optional. one of 0 - Detent mode - Assumes 1 dial click is 4 steps. 1 - Step mode (default)
To your last question, the pigpio extension includes a program called pigs which is a command line interface to the gpio. It's a bit clunky, but you can set and read pins through this command.....it requires the pigpiod to be running.piCorePlayer a small player for the Raspberry Pi in RAM.
Homepage: https://www.picoreplayer.org
Please donate if you like the piCorePlayer
-
2019-09-08, 15:01 #235
Thanks Paul. Just back from a weekend away and I've been trying this out. I installed pigpiod.tcz from the piCorePlayer repository, and I included the command to start it as the first line of my sbpd script that is called at boot as a User Command from the [Tweaks] page.
Then I downloaded your latest sbpd from your dropbox link, copied it into my home directory and changed its permissions to 755 so that I could execute it from a shell.
All the buttons work exactly as before, as does the rotary encoder when called with mode 1.
When I call the encoder with mode 0 it's working much more uniformly, but not exactly as I expected from your description. I was expecting a volume increment of 4 for every click of the encoder, but instead I'm getting an increment of 1 for every two encoder clicks. I guess my encoder is not the same as yours. Could you perhaps allow the user to define their encoder's number of steps per click as part of the mode 0 call?
I ended up using the methods described in your earlier link:
Code:# Export pin to userspace if [ ! -e /sys/class/gpio/gpio$pin ]; then echo "$pin" > /sys/class/gpio/export fi # set control pin to output mode echo "out" > /sys/class/gpio/gpio$pin/direction # set pin to "0" to turn fan off initially echo "0" > /sys/class/gpio/gpio$pin/value . . . # turn fan on echo "1" > /sys/class/gpio/gpio$pin/value
-
2019-09-08, 17:13 #236
Likely a different encoder. I’ll make it so you put a number in there that will define the steps......
I’m busy at work this week, so it might take till next weekend.piCorePlayer a small player for the Raspberry Pi in RAM.
Homepage: https://www.picoreplayer.org
Please donate if you like the piCorePlayer
-
2019-09-08, 23:05 #237
No rush at all on my part - both modes work, so we're only talking about tweaking the user experience here. My encoder is a Keyes KY-040.
-
2019-09-24, 10:20 #238
For those wanting to interface buttons and encoders with jivelite, rather than sending commands to LMS, adding the uinput keyboard driver was rather trivial.
For now I'm just planning to add single key commands.......
For example on an encoder
e,p1,p2,CMD[,mode] e,20,21,KEY:103-108
would define an encoder on pins 20 and 20, which would send KEY_UP or KEY_DOWN based on the direction of the encoder.
Would like some ideas before I get to far along.piCorePlayer a small player for the Raspberry Pi in RAM.
Homepage: https://www.picoreplayer.org
Please donate if you like the piCorePlayer
-
2019-09-24, 11:29 #239
Excellent news. I can't say I've got any bright ideas at this point, but being able to navigate Jivelite will be very useful. If the encoder supports a 'push' as well, then I'd probably set that up as the 'right' arrow, and I'd probably put the 'left' arrow on a long push.
-
2019-09-25, 10:40 #240
Chill,
Would you mind testing this out for me. My current jivelite setup is a bit difficult to add encoders and buttons to......but I did verify that I'm getting keyboard events.
https://dl.dropboxusercontent.com/s/...pkskgzj4c/sbpd
This is the latest source using pigpio, so make sure you have that library setup.
We are using the kernel uinput module, so you need to load it, then set the permission to group writable, so you don't need to run sbpd with root permissions.
Code:sudo modprobe uinput sudo chmod g+w /dev/uinput
Code:For rotary encoders (one, volume only): e,pin1,pin2,CMD[,edge] "e" for "Encoder" p1, p2: GPIO PIN numbers in BCM-notation CMD: Command. one of. \n\ VOLU for Volume\n\ TRAC for Prev/Next track\n\ KEY:<Positive key_name>-<Negative key_name> mode: Optional. one of\n\ 1 - Step mode (default)\n\ 2-9 - Detent mode - Assumes 1 dial click is x steps. For buttons: b,pin,CMD[,resist,pressed,CMD_LONG,long_time] "b" for "Button" pin: GPIO PIN numbers in BCM-notation CMD: Command. One of: PLAY: Play/pause PREV: Jump to previous track NEXT: Jump to next track VOL+: Increase volume VOL-: Decrease volume POWR: Toggle power state Commands can be defined in config file use -f option, ref:sbpd_commands.cfg Command type SCRIPT. SCRIPT:/path/to/shell/script.sh Command type KEY. KEY:<linux key_name>. resist: Optional. one of 0 - Internal resistor off 1 - pull down - input puts 3v on GPIO pin 2 - pull up (default) - input pulls GPIO pin to ground pressed: Optional GPIO pinstate for button to read pressed 0 - state is 0 (default) 1 - state is 1 CMD_LONG: Command to be used for a long button push, see above command list long_time: Number of milliseconds to define a long press
Code:./sbpd -v e,20,21,KEY:KEY_UP-KEY_DOWN,4 b,20,KEY:KEY_RIGHT,2,0,KEY:KEY_LEFT,500
piCorePlayer a small player for the Raspberry Pi in RAM.
Homepage: https://www.picoreplayer.org
Please donate if you like the piCorePlayer