Hallo zusammen,
ich habe mich an die Bauanleitung von splitti79 auf seiner Homepage gehalten. Nach dem Zusammenbau funktioniert jetzt so weit alles bis auf eine Kleinigkeit:
Wenn ich die Lautstärke nach oben regle (also den Acarde-Knopf gedrückt halte) ist die Musik nicht mehr zu hören. Sobald man den Button loslässt, ist die Musik da und auch in erhöhter Lautstärke. Generell scheint die Funktion des Lauterstellens also zu funktionieren. Auch bei kurzem Drücken sind leichte Aussetzer in der Tonwiedergabe feststellbar.
Sehr seltsam, denn der Leiser-Knopf funktioniert einwandfrei. Ich habe auch schon die Knöpfe in der Funktion vertauscht mit dem selben Resultat, weshalb ich nicht glaube, dass es ein Hardware-Problem ist.
Hier ist der Inhalt von
~/oled_phoniebox/scripts/gpio-buttons/gpio-buttons.py
#!/usr/bin/python0
from gpiozero import Button
from signal import pause
from subprocess import check_call
from time import sleep
# This script will block any I2S DAC e.g. from Hifiberry, Justboom, ES9023, PCM5102A
# due to the assignment of GPIO 19 and 21 to a buttons
# 2018-10-31
# Added the function on holding volume + - buttons to change the volume in 0.3s interval
#
# 2018-10-15
# this script has the `pull_up=True` for all pins. See the following link for additional info:
# https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/259#issuecomment-430007446
#
# 2017-12-12
# This script was copied from the following RPi forum post:
# https://forum-raspberrypi.de/forum/thread/13144-projekt-jukebox4kids-jukebox-fuer-kinder/?postID=312257#post312257
# I have not yet had the time to test is, so I placed it in the misc folder.
# If anybody has ideas or tests or experience regarding this solution, please create pull requests or contact me.
jukebox4kidsPath = "/home/pi/RPi-Jukebox-RFID"
def def_shutdown():
check_call(jukebox4kidsPath+"/scripts/playout_controls.sh -c=shutdown", shell=True)
def def_volU():
check_call(jukebox4kidsPath+"/scripts/playout_controls.sh -c=volumeup", shell=True)
def def_volD():
check_call(jukebox4kidsPath+"/scripts/playout_controls.sh -c=volumedown", shell=True)
def def_vol0():
check_call(jukebox4kidsPath+"/scripts/playout_controls.sh -c=mute", shell=True)
def def_next():
for x in range(0, 19):
if btn_next.is_pressed == True :
sleep(0.1)
else:
check_call(jukebox4kidsPath+"/scripts/playout_controls.sh -c=playernext", shell=True)
break
def def_contrastup():
if btn_prev.is_pressed == True :
check_call("/usr/bin/touch /tmp/o4p_overview.temp", shell=True)
else:
check_call("/usr/bin/python3 /home/pi/oled_phoniebox/scripts/contrast/contrast_up.py", shell=True)
def def_contrastdown():
if btn_next.is_pressed == True :
check_call("/usr/bin/touch /tmp/o4p_overview.temp", shell=True)
else:
check_call("/usr/bin/python3 /home/pi/oled_phoniebox/scripts/contrast/contrast_down.py", shell=True)
def def_prev():
for x in range(0, 19):
if btn_prev.is_pressed == True :
sleep(0.1)
else:
check_call(jukebox4kidsPath+"/scripts/playout_controls.sh -c=playerprev", shell=True)
break
def def_halt():
check_call(jukebox4kidsPath+"/scripts/playout_controls.sh -c=playerpause", shell=True)
def toggle_display():
check_call("/home/pi/oled_phoniebox/scripts/toggle_display/toggle_display.sh", shell=True)
#btn_shut = Button(3, hold_time=2)
#btn_vol0 = Button(21,pull_up=True)
btn_volup = Button(16,pull_up=True,hold_time=0.3,hold_repeat=True)
btn_voldown = Button(13,pull_up=True,hold_time=0.3,hold_repeat=True)
btn_next = Button(26,pull_up=True,hold_time=2.0,hold_repeat=False)
btn_prev = Button(27,pull_up=True,hold_time=2.0,hold_repeat=False)
btn_halt = Button(12,pull_up=True,hold_time=2.0,hold_repeat=False)
#btn_shut.when_held = def_shutdown
#btn_vol0.when_pressed = def_vol0
btn_volup.when_pressed = def_volU
#When the Volume Up button was held for more than 0.3 seconds every 0.3 seconds he will call a ra$
btn_volup.when_held = def_volU
btn_voldown.when_pressed = def_volD
#When the Volume Down button was held for more than 0.3 seconds every 0.3 seconds he will lower t$
btn_voldown.when_held = def_volD
btn_next.when_pressed = def_next
btn_next.when_held = def_contrastup
btn_prev.when_pressed = def_prev
btn_prev.when_held = def_contrastdown
btn_halt.when_pressed = def_halt
btn_halt.when_held = toggle_display
pause()
Alles anzeigen
ich bin mir nicht sicher ob ich in dieser Datei
./RPi-Jukebox-RFID/settings/gpio_settings.ini
nicht vielleicht auch noch was anpassen muss (zumindest hat es den Anschein, denn hier passen die Pins für die VolumeControl nicht):
[DEFAULT]
enabled: True
[VolumeControl]
enabled: True
Type: TwoButtonControl ;or RotaryEncoder
PinUp: 5
PinDown: 6
pull_up: True
hold_time: 0.3
hold_repeat: True
timeBase: 0.1 ;only for RotaryEncoder
functionCallDown: functionCallVolD
functionCallUp: functionCallVolU
functionCallTwoButtons: functionCallVol0 ;only for TwoButtonControl
[PrevNextControl]
enabled: True
Type: TwoButtonControl
Pin1: 22
Pin2: 23
functionCall1: functionCallPlayerPrev
functionCall2: functionCallPlayerNext
functionCallTwoButtons: None
pull_up: True
hold_time: 0.3
hold_repeat: False
[PlayPause]
enabled: True
Type: Button
Pin: 27
pull_up: True
hold_time: 0.3
functionCall: functionCallPlayerPause
[Shutdown]
enabled: False
Type: Button
Pin: 3
pull_up: True
hold_time: 2
functionCall: functionCallShutdown
[Volume0]
enabled: False
Type: Button
Pin: 17
pull_up: True
hold_time: 0.3
functionCall: functionCallVol0
[VolumeUp]
enabled: False
Type: Button
Pin: 16
pull_up: True
[VolumeDown]
enabled: False
Type: Button
Pin: 19
pull_up: True
hold_time: 0.3
hold_repeat: True
functionCall: functionCallVolD
[NextSong]
enabled: False
Type: Button
Pin: 26
pull_up: True
hold_time: 0.3
functionCall: functionCallPlayerNext
[PrevSong]
enabled: False
Type: Button
Pin: 20
pull_up: True
hold_time: 0.3
functionCall: functionCallPlayerPrev
[Halt]
enabled: False
Type: Button
Pin: 21
pull_up: True
hold_time: 0.3
functionCall: functionCallPlayerPauseForce
Alles anzeigen
Angaben zur Installation
OS: Raspbian GNU/Linux 10 (buster)
Phoniebox Version: 2.2 - 305325d - master (ohne Spotify)
Edition: Classic edition (barebones)
Im Forum bin ich auf ein verwandtes Thema
Phoniebox: Bei Lautstärkeregelung mit Rotary Encoder habe ich Aussetzer bei der Wiedergabe
gestoßen, bin mir aber nicht sicher, ob es dieselbe Urasache hat.
Es wäre super, wenn einer ein Idee hätte und mir in dieser Sache weiterhelfen könnte vielen Dank!
Gruß Alexander