project-owner / Peppy

Peppy Player Repository
GNU General Public License v3.0
72 stars 14 forks source link

How to get a different display working? #16

Closed githubtobi closed 2 years ago

githubtobi commented 2 years ago

Hi there and thank you a lot for this amazing project. I love it!

I got Peppy working with the 2,8" Waveshare Display but I would love to use puppy in another project which has a different 2" Waveshare Screen installed.

I have installed the Monet Headless Edition and built the display driver from source from this fork. Then I added the following lines to the config.txt file:

hdmi_group=2 >> /boot/config.txt
hdmi_mode=87 >> /boot/config.txt
hdmi_cvt=320 240 60 1 0 0 0 >> /boot/config.txt
echo hdmi_force_hotplug=1 >> /boot/config.txt

and added a line in rc.local before peppy.py to autoload the driver on boot.

The display itself is working and showing the splash screen / Terminal View.

But how do I set this display as the main display for the Peppy UI?

project-owner commented 2 years ago

Hi,

Thank you for your interest in Peppy Player!

I'm not sure that you need that line in the rc.local for the driver. If you ran the driver installation script it should handle everything.

The display which you are connecting is not HDMI display. This is the SPI display. It connects to Pi through SPI interface. Therefore those changes in the config.txt are also not required as they are related to HDMI.

Usually after the display driver installation you don't need to make any changes on the Peppy side other than setting the resolution for UI: https://github.com/project-owner/Peppy/blob/9a52e0ebb0f6cdfdcce65806ac18c89faafdbd52/config.txt#L2 That's it.

Please let me know if it works or not.

Best regards!

githubtobi commented 2 years ago

Hi, thank you for your quick answer. Unfortunately it doesn't work.

I tried the display setup directly from here. Removed all the entries from config.txt & rc.local like they are not needed like you mentioned.

The display works and I can execute the demo scripts without a problem.

But Peppy is not starting up.

When I try to start peppy.py manually and directly from the pi, the peppy process starts for a very short time (I can see "welcome to the pygame community" in the display), but shortly after this the process ends and the screen turn black.

Can't see the process in "ps -aux" either. pi 563 55.0 8.4 74948 37416 tty2 Rs+ 14:08 0:07 python3 peppy.py

But after 10 seconds, this process disappears.

I can also not enter the webgui or webgui /config/ .

When I turned to "headless = True" everything is working fine, but of course no display output.

Do you have any idea, wha else I can do to debug and find out where the issue is? No error message appears in syslog or peppy.log

project-owner commented 2 years ago

Hi,

I have never used this kind of display myself. But there is one project in the Peppy Player Gallery which is using Waveshare 1.3 inch display. That display is also based on chip ST7789: https://github.com/project-owner/PeppyPlayers.doc/wiki/Gallery#nanopeppy-by-amala-indonesia

So I would say that theoretically your display should also work. Though I'm not sure what kind of changes should be done for that. Here is what the author of that project said about that display:

Waveshare 1.3 inch LCD HAT, https://www.waveshare.com/wiki/1.3inch_LCD_HAT. 
The screen has a ST7789V controller, so I modified this driver https://github.com/darrenliew96/gamepi20_drivers 
to work with it. I changed the init code to suit my HAT, the resolution to 240 x 240, and the rotation to 0. 
Note that the value for screen rotation can only be 0, other values like 90 or 270 caused a distortion artifact, 
so I don’t think it’s quite ready for release yet. The device tree overlay is installed on top of a Monet headless image. 
I included the dts file in case you want to check it out.

I asked the author of that project for help. Hopefully he will reply here.

Best regards

TheAmala commented 2 years ago

Hello there! Well it has been some time since I worked on my nanoPeppy. Regarding what @githubtobi said, I tried using fbcp with Peppy before, but fbcp just plain doesn't work with Peppy.

So I did some googling for a DT Overlay and found this https://github.com/darrenliew96/gamepi20_drivers. Did the driver installation instructions listed there (without installing fbcp), but the drivers doesn't work straight away. I need to change some parameters, namely the <width>, <height>, and <rotation> (has to be 0 in my case), but also the init code (I think this is some sort of address? Sorry, I'm not a programmer by trade). Now the problem becomes "where do I find the proper init codes for my particular display?" For my 1.3 inch display, I found them in https://www.waveshare.com/w/upload/6/6b/1.3inch_lcd_hat_user_manual_en.pdf, which is on the Waveshare wiki. I couldn't find a similar manual for your display though, I'm sorry I can't help in that regard.

Now, assuming you found the code and successfully compiled and loaded the drivers..... unfortunately I kinda forgot what happened next. If I remember correctly, Peppy just worked at that time. I remembered being happy and surprised :D. I only needed to change the <rotation> parameter to remove some garbage on the side of the screen.

Best of luck, Amala

githubtobi commented 2 years ago

Thaank you @TheAmala , the driver from https://github.com/darrenliew96/gamepi20_drivers just did the trick together with Touchscreen = true in Peppy config.txt

I did not have to modify the init section in the dts driver because it was made for exactly my waveshare 2 inch screen. Thank you for the hint with the init section even if everything was still there :+1:

Tutorial for this waveshare 2 Inch 320x240 Screen: git clone https://github.com/darrenliew96/gamepi20_drivers.git cd gamepi20_drivers sudo dtc -@ -I dts -O dtb -o /boot/overlays/gamepi20.dtbo gamepi20.dts enable SPI in raspi-config / interfaces add dtoverlay=gamepi20 to /boot/config.txt sudo reboot Without "Framebuffer Copy |fbcp"

Peppy/config.txt

[screen.info] width = 320 height = 240 depth = 32 frame.rate = 60 hdmi = False

[usage] touchscreen = True mouse = False headless = False web = True

touchscreen = True is very important, because only whentouchscreen = True Peppy will load os.environ["SDL_FBDEV"] = "/dev/fb1" from util/config.py and this is very important to display pygame on fb1 (= second display).

Very cool, I can now work on my project and send a few screenshots when it's ready @project-owner

project-owner commented 2 years ago

Great! Whenever you are ready to share your project you can do that on any forum and/or send it directly to my e-mail address.

Best regards