UnchartedBull / OctoDash

OctoDash is a simple, but beautiful dashboard for OctoPrint.
https://unchartedbull.github.io/OctoDash/index.html
Apache License 2.0
1.02k stars 225 forks source link

Screen rotation with: RaspberryPi 4 & OctoDash & Waveshare 5inch DSI Display & PiCam v3 #4101

Open maximweb opened 7 months ago

maximweb commented 7 months ago

What doesn't work? I am currently setting up OctoPi & OctoDash for the first time. It took me some hours to figure out how to rotate my screen and simultaneously use my camera. So this is more of a small guide rather than an issue. Maybe this would be relevant information for the Wiki?

General Information:

What did you already try? Out of the box, the camera was found and OctoDash started without any issues. But due to my setup, I wanted to rotate the screen and obviously touch by 180 degrees.

There are so many different information out there, some official, some on reddit or other interesting forums. So my initial solution consisted of the dislay's wiki information using

# in /boot/config.txt
dtoverlay=vc4-kms-v3d
dtoverlay=vc4-kms-dsi-7inch

But then display_lcd_rotate does not work anymore. So I could go down the rabbit hole of changing the X-Server configuration.

Another option that (partially) worked, was NOT using above commands, but rather:

# in /boot/config.txt
display_auto_detect=1
display_lcd_rotate=2
dtoverlay=rpi-ft5406,touchscreen-inverted-x=1,touchscreen-inverted-y=1
#dtoverlay=vc4-kms-v3d
#dtoverlay=vc4-kms-dsi-7inch

This worked well for the screen and touch rotation, but then my camera stopped working. (It was detected by libcamera-hello --list-cameras, but the camera streamer logged: [0:03:06.873025556] [1566] ERROR V4L2 v4l2_videodevice.cpp:1906 /dev/video1[25:cap]: Failed to start streaming: Input/output error

So i finally got it to work following the official Pi documentation (which unfortunately was not in the top Google search results):

# in /boot/config.txt
#display_auto_detect=1
#display_lcd_rotate=2
dtoverlay=vc4-kms-v3d
dtoverlay=vc4-kms-dsi-7inch,invx,invy

The options for vc4-kms-dsi-7inch (invx,invy) rotate the touch, NOT the screen.

Rotating the screen itself: Add video=DSI-1:800x480@60,rotate=180 to /boot/cmdline.txt at the end of the line, separated by space.

This is nice, because I do not need to fiddle with X-server settings. Maybe this is helpful for others.

PS: Can anybody point me to a comprehensive and reliable documentation of Pi video settings, including

I set up a Pi every other years or so. And every single time it turns out to be a pain to get everything just right.

quattroerik commented 1 month ago

Having since 2 years the same issue, my printer was running with dtoverlay=rpi-ft5406,touchscreen-inverted-x=1,touchscreen-inverted-y=1 -> but no camera. Now i decided to change that and found your post.

I have changed everything, but following happens: With dtoverlay=vc4-kms-v3d the touch screen stops working, but then the campera works. If i disable it, camera dissapears and the screen can not be roatated.

maximweb commented 1 month ago

Hi @quattroerik ,

it's been a while since I wrote my initial findings. I am not sure why or at what point I made more changes, but my current configuration (rotated screen and touch + camera working) looks like this:

These are all uncommented entries in my /boot/config.txt. Only the first block should be related to screen and camera.

dtoverlay=imx708
dtoverlay=vc4-kms-v3d-pi4,cma-256
dtoverlay=vc4-kms-dsi-7inch,invx,invy
max_framebuffers=2
disable_overscan=1
[pi4]
arm_boost=1
[all]
start_x=1
gpu_mem=256
dtoverlay=gpio-fan,gpiopin=14,temp=60000

And my /boot/cmdline.txt:

console=serial0,115200 console=tty1 root=PARTUUID=5cb012f8-02 rootfstype=ext4 fsck.repair=yes rootwait cfg80211.ieee80211_regdom=DE video=DSI-1:800x480@60,rotate=180

But I still have no clue what most of it means :/

I hope this helps.