Basic Information:
MCU / Printerboard: BTT OcotopusMaxEZ
Host / SBC: PI4 Model B
Screen: BTT hdmi 5
Context: I was setting up a new pi 4 with klipper and klipper screen to run a custom printer. I used the pi image flasher and installed debian os with mainsail already installed. I then went to install klipperScreen following there docs - Installation - KlipperScreen . I tried using Kiuah to install and got some issues around a package so I eventually after some custom install packages I got klipper screen up and running.
Problem: Did some work on the printer and restarted it and Klipper Screen was starting correctly but not connecting to the printer on restart and would have to manually restart KlipperScreen to get it to connect so I want to get to the bottom of this issue. I found this thread which was a similar issue on fluidd KlipperScreen not completing connection on boot · Issue #328 · KlipperScreen/KlipperScreen · GitHub . I also noticed that the screen would flicker randomly. Tried switching the hdmi port and also different power sources with still no luck.
Solutions: After sshing into the pi and using nano to edit
/home/USER_HERE/KlipperScreen/scripts/KlipperScreen.service
Under [Service] I changed this:
WorkingDirectory=KS_DIR
Environment=“KS_XCLIENT=KS_ENV/bin/python KS_DIR/screen.py” BACKEND=KS_BACKEND
ExecStart=“KS_DIR/scripts/KlipperScreen-start.sh”
to
Type=simple
Restart=always
RestartSec=10
User=pi
WorkingDirectory=/home/pi/KlipperScreen
ExecStart=/usr/bin/xinit /home/pi/.KlipperScreen-env/bin/python /home/pi/Klippe$
And now the screen would connect properly to mainsail on start
As for the flicker I used nano to edit
/boot/cmdline.txt
I added video=800x480
To the end of the line making sure to keep the file all one line and the screen flickering stop and now the screen works great in all aspects.
This seems like quite the workaround to get it to work properly, if you know of a better way or something else please free feel to let me know.