Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Idea: Pirate Audio 240x240 cover display
#11
(02-27-2020, 10:33 AM)maartin Wrote: Hi Russ,

next level is calling:


PHP Code:
pi@moode-pim:~/tft-cover python3 cover_7789.py
Traceback 
(most recent call last):
 
 File "cover_7789.py"line 24in <module>
 
   spi_speed_hz=80 1000 1000
  File 
"/usr/local/lib/python3.7/dist-packages/ST7789/__init__.py"line 124in __init__
    self
._spi spidev.SpiDev(portcs)
FileNotFoundError: [Errno 2No such file or directory 


We are getting closer!  Go go go!

AtB
Maartin

I think SPI is not enabled on your pi. Apologies, as I should have put that in the readme.


Code:
SSH into pi
sudo raspi-config
then...
Select “Interfacing Options”
choose “SPI” option and activate
then Select
then Yes
then OK
and the Yes to reboot

And then i hope were real close

Russ
Reply
#12
(02-27-2020, 11:51 AM)maartin Wrote: That did the trick. Now I have the MoOde Logo on the TFT (very nice!). I had to reboot twice before I was able to listen to Webradio again, but there a no images of the stations, only "moOde".

apologies again. Something else for the readme.

The metadata file must be turned on in moode as the python script uses a combination of data from this file and mpd itself to know where to get the images.

Open the moode web page
then go to...
Configure -> System
Scroll to Local Services
click the Metadata file switch to on and click "set"

can't remember if a reboot is required.

That should help.

The buttons...
The Mopidy setuo won't work for moode.

Moode has some shell scripts that should do what you want for volume. pc cappands can do the rest.
check out this forum thread on using Moode's gpio config feature.

Code:
For:
play_pause,active_low,150      use mpc toggle
volume_down,active_low,150     use /var/www/vol.sh dn 1
next,active_low,150            use mpc next
volume_up,active_low,150       use /var/www/vol.sh up 1


Hope this all works
 
[url=http://moodeaudio.org/forum/showthread.php?tid=1381&highlight=gpio+config][/url]
Russ
Reply
#13
Quote:Where to tweak to have it loaded at booting?

Easiest is to add a line to the rc.local file


Code:
SSH into the pi

sudo nano /etc/rc.local
 then add


Code:
/usr/bin/python3 /home/pi/tft-covercover_7789.py > /dev/null 2>&1


betweenthese lines

Code:
/var/www/command/worker.php > /dev/null 2>&1

exit 0

Then reboot, of course.

Try this, but if there are issues with images not displaying correctly on the pirateaudio, let me know.

I need to tidy the code a bit to prevent some issues anyway, but it may be a couple of days.

I will also add files to allow you torun the script as a systemd service if you wish, which I find works well for other python scripts.




Quote:It is so nice to have that Logo visible.  Thanks so much!

Glad to help.
Do you only use the pirateaudio for radio stations?
I am adding some extra functionality that will display cover art that is embedded in files.
So far it works for mp3, flac, m4a and ogg files.
So if you play songs from your own collection, embedded cover art will display.

Cheers

Russ
Reply
#14
Ok

I have made some updates.

  1. It can now be run as a systemd service
  2. The MediaFile library is now used as a wrapper for mutagen - this makes embedded art easy to access.
@maartin 
If you want to try this update:

Remove the line you added to rc.local if it's still there
install mediafile

Code:
sudo pip3 install mediafile
or
python3 -m pip install mediafile

install tft-cover again

Code:
git clone https://github.com/rusconi/tft-cover.git

then cd into tft-cover

Code:
chmod u+x install.sh
chmod u+x tft-cover_start

install the service


Code:
./install.sh
and follow the prompts
reboot required

I have tested the service and it runs on my rpi zero w fine.
I just cant see if the display works Big Grin 

but the st7735 version works fine for me


If nothing shows on the display, check the service status


Code:
sudo systemctl status tft-cover


There is a 30 second delay built into the service start to ensure the mpd service starts fully at boot
Reply
#15
@maartin

Glad to see that it's working as intended for you.

I have tidied the readme on github, so hopefully if anybody else wants to install, all of our trial and error will have been invaluable.

Happy listening

Russ
Reply
#16
(03-01-2020, 12:04 PM)maartin Wrote: Hi there Russ,
strange new problem here.
Because of not having any sound anymore I installed all from scratch.
All as expected. But when starting the Station first time the sound stops just after parts of a second, but the clock in the GUI is still running.
When rebooting after this happens, strangely my playlist is gone. Adding a station and start play leads to the having no sound at all, while the clock in GUI is turning.

Any ideas anybody??


Quote:Audio information
Input / Output
Source: http://direct.francemusique.fr/live/fran...z-hifi.mp3
Encoded at: VBR compression
Decoded to: 24 bit, 48 kHz, Stereo, 128 kbps
Destination: Local
Output rate: 24 bit, 48 kHz, Stereo, 2.304 Mbps
DSP operations
Volume ctl: Software (MPD 32-bit float with dither)
Resampling: off
Polarity inv: off
Crossfade: off
Crossfeed: off
Parametric EQ: off
Graphic EQ: off
Replaygain: off
Normalize vol: off
Chip options: , Gain=-6dB, Boost=0dB
Audio Device
Device: Pimoroni pHAT DAC
Chip: Burr Brown PCM5102A
Interface: I2S
Formats: S16_LE, S24_LE, S32_LE
Platform: Pi-3B+ 1GB v1.3
Any other output needed to find the problem?


All the Best
Maartin

I have no issues with the script on my pi zero, albeit with the ST7735 driver


Can we test to see if the cover script with the ST7789 driver is causing this?

Can you try this?

Disable the tft-cover service and reboot the rpi without the cover script

SSH into the rpi, then..

Code:
sudo systemctl stop tft-cover
sudo systemctl disable tft-cover
sudo reboot

Then start the radio station again and see if the problem persists without the cover display.

Thanks

Russ
Reply
#17
[quote pid='17092' dateline='1583164826']
Quote:SSH into the rpi, then..

Code:
Code:
sudo systemctl stop tft-cover
sudo systemctl disable tft-cover
sudo reboot

Then start the radio station again and see if the problem persists without the cover display.

This helps to have the sound back, of course no more TFT.

On the MoOd- GUI I have this error message if the ST7789-Script is active:

MPD error
JSON.parse: unexpected end of data at line 1 column 1 of the JSON data


Hope this is a hint to the error which seems to be found in the ST7789-Script.

If there are any other test to do I am glad to help.


All the Best
Maartin
[/quote]

I may have found the issue.



Some of the Pimoroni documentation appears to have errors, and pirateaudio owners were having the same problem with players other than moode

I have updated github with a correction to cover_7789.py that removes the problem on my RPI zero with Pimorone Phat Dac.
As I don't have an ST7789 display I cannot be sure if the covers will still display.

Please reinstall the script from github.
Code:
cd /home/pi
git clone https://github.com/rusconi/tft-cover.git
and make bash scripts executable
Code:
cd /home/pi/tft-cover
chmod u+x install.sh
chmod u+x tft-cover_start.sh

The update was to the backlight control pin, so I hope the display still works

Regards

Russ
Reply
#18
thanks Ross, Maartin & Kent for this feature.
Happily using my Pirate Audio headphone HAT

Have successfully setup the GPIO button handler.
found in
Local Services section of System Config.

Button 1, PIN 5   CMD /var/www/vol.sh up 1
Button 2, PIN 6   CMD /var/www/vol.sh dn 1
Button 3, PIN 16  CMD /var/www/vol.sh mute
Button 4, PIN 20  CMD mpc next

(don't forget to then turn GPIO button handler to ON and then SET)

gleaned from http://moodeaudio.org/forum/showthread.p...pio+config
further information at http://moodeaudio.org/forum/showthread.p...198&page=3

regards
Ken


Attached Files Thumbnail(s)
   
Reply
#19
@maartin  and @kenling

Glad it's all working for you both Smile
Reply
#20
Music 
Thanks all for the good information about the Pirate Audio. Is it possible to display the artist and trackname on the tiny display like on the added image ? Can`t find any information about it.

   
Reply


Forum Jump: