![]() |
[How to do instruction] Use hardware momentary switches to control moOde - Printable Version +- Moode Forum (https://moodeaudio.org/forum) +-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3) +--- Forum: FAQ and Guides (https://moodeaudio.org/forum/forumdisplay.php?fid=9) +--- Thread: [How to do instruction] Use hardware momentary switches to control moOde (/showthread.php?tid=198) |
RE: Use hardware momentary switches to control moOde - sisim - 04-12-2020 Hello, I just switched from Volumio to Moode and I'm very satisfied, the software is working much better! I have set up the GPIO button handler to ON and tried to configure the GPIO but it's not working : ![]() - Pin 16 : mpc stop - Pin 24 : /var/www/vol.sh up 1 - Pin 17: mpc next Is there something else I need to do? How could I investigate? Also, I have another question: is there a possibility to configure different functions if I do a long press? I see for example in https://github.com/bnielsen1965/rpi-gpio-buttons that the option pressed sets the timing. Thanks for your support! RE: Use hardware momentary switches to control moOde - Tim Curtis - 04-12-2020 In GPIO Config does the line below appear under the SAVE button? "NOTE: Use a comma to delimit arguments in the CMD field. Example: mpc,load,My Playlist" RE: Use hardware momentary switches to control moOde - sisim - 04-12-2020 (04-12-2020, 12:38 PM)Tim Curtis Wrote: In GPIO Config does the line below appear under the SAVE button? Hello Tim, thank you so much for your quick reply, and congratulation again for your work!! No, this line does not appear under the SAVE button. I tried though (mpc,stop) and it doesn't work either. Any other idea? RE: Use hardware momentary switches to control moOde - Tim Curtis - 04-12-2020 I see that the comma delimiter was part of upcoming 6.5.0 release. In 6.4.2 space is the delimiter. It's odd that the commands are apparently not being executed. The way to troubleshoot is as follows: 1. Turn off GPIO button handler in System config 2. Open an SSH terminal 3. Run it from the command line Code: sudo /var/www/command/gpio-buttons.py 4. Press a button 5. Note any errors or debug logging that's printed. RE: Use hardware momentary switches to control moOde - sisim - 04-12-2020 I don't see anything ![]() Code: pi@moode:~ $ sudo /var/www/command/gpio-buttons.py Also, my setup is that the GPIO button is connected between +3V and GND (EDIT: wrong, I should have written: "GPIO pin is connected to +3V when I press the button"). I don't know if it's useful to know that or not. RE: Use hardware momentary switches to control moOde - Tim Curtis - 04-12-2020 The parameters look ok. You will need to add some debug to the python script to see if the callback function that's mapped to the pin is actually being executed. Code: sudo nano /var/www/command/gpio-buttons.py add a print statement to the code block below then save (Ctrl-x y return (or enter) Code: def sw_1_event(channel): RE: Use hardware momentary switches to control moOde - sisim - 04-12-2020 I added your lines, it looks like this now: Code: # Main But I still don't see anything happening when I press any button ![]() RE: Use hardware momentary switches to control moOde - Tim Curtis - 04-12-2020 That would suggest the code is not detecting any change in the pin state. Below is the code block for button 1. Code: if str(row['id']) == '1' and row['enabled'] == '1': Pin numbering used is SoC. https://raspi.tv/2013/rpi-gpio-basics-4-setting-up-rpi-gpio-numbering-systems-and-inputs Code: # Use SoC pin numbering RE: Use hardware momentary switches to control moOde - TheOldPresbyope - 04-12-2020 @sisim I'm not sure exactly what " my setup is that the GPIO button is connected between +3V and GND" means, but perhaps you need to detect a FALLING transition instead of the RISING transition I see in the code Tim quoted. Regards, Kent RE: Use hardware momentary switches to control moOde - sisim - 04-12-2020 The numbering is the one I use as well. For example, the pin 16 in the Moode settings is "physically" the pin 36 on the Pi, right? Why doesn't it detect anything? I checked again with a multimeter and the buttons are working. Any other idea? |