Hi guys nice script, but I try to connect two rotary decoders...

I added a second button and rotary section...
Not sure how to call them correct at the end of the script.

Here's what I got so far but I think I'm missing something, how does one
add two different commands for each rotary instead of this "VOLU"


Code:
--------------------
    #!/bin/sh
  
  # start pigpiod daemon
  pigpiod -t 0 -f -l -s 10
  
  # wait for pigpiod to initialize - indicated by 'pigs t' exit code of zero
  
  count=10 # approx time limit in seconds
  while ! pigs t >/dev/null 2>&1 ; do
  if [ $((count--)) -le 0 ]; then
  printf "\npigpiod failed to initialize within time limit\n"
  exit 1
  fi
  # printf "\nWaiting for pigpiod to initialize\n"
  sleep 1
  done
  printf "\npigpiod is running\n"
  
  # load uinput module - required to be able to send keystrokes
  # then set the permission to group writable, so you don't need to run sbpd 
with root permiss...
  sudo modprobe uinput
  sudo chmod g+w /dev/uinput
  
  PLAYER_MAC=aa:bb:cc:dd:ee:ff
  # button 1
  SW1=24                                           # GPIO pin number
  SH1=PAUS                                         # command for SHORT press
  LO1=MUTE                                         # command for LONG press
  LMS1=500                                         # milliseconds for long press
  
  #button 2
  SW2=23                                           # GPIO pin number
  SH2=POWR                                         # command for SHORT press
  LO2=RSRT                                         # command for LONG press
  LMS2=1000                                        # milliseconds for long press
  
  # rotary 1
  ROT1=21                                          # GPIO pin number
  ROT2=20                                          # GPIO pin number
  MODE=2 # Detent mode - Assumes 1 dial click is x steps. 1=Step Mode (default)
  
  # rotary 2
  ROT3=18                                          # GPIO pin number
  ROT4=19                                          # GPIO pin number
  MOD2=2 # Detent mode - Assumes 1 dial click is x steps. 1=Step Mode (default)
  
  sbpd -v -M $PLAYER_MAC -f /home/tc/sbpd_commands.cfg \
  b,$SW1,$SH1,2,0,$LO1,$LMS1 \
  b,$SW2,$SH2,2,0,$LO2,$LMS2 \
  e,$ROT1,$ROT2,VOLU,$MODE \
  e,$ROT3,$ROT4,TRCK,$MOD2
  
--------------------


could anyone give an advice how to configure the script to use VOL+/VOL-
for ROT1 and ROT2 and NEXT/PREV for ROT3 and ROT4 and how the sbpd call
should exactly look like?

thanx for your help!


------------------------------------------------------------------------
Damn's Profile: http://forums.slimdevices.com/member.php?userid=68909
View this thread: http://forums.slimdevices.com/showthread.php?t=114075

_______________________________________________
diy mailing list
diy@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/diy

Reply via email to