Open kieppie opened 4 years ago
Not sure if this will help to resolve your issues, I'm using the PiTFT 2.8" 2423 Capacitive Screen. Here are the steps I took, after installing OctoPrint on Raspberry Pi using the OctoPi OS image.
wget https://github.com/Z-Bolt/OctoScreen/releases/download/v2.5.1/octoscreen_2.5-1_armhf.deb
sudo dpkg -i octoscreen_2.5-1_armhf.deb
/etc/octoscreen/config
and add 320x240 to the resolution configuration parameter as,
OCTOSCREEN_RESOLUTION=320x240
/boot/config.txt
, and edit the framebuffer_width
, framebuffer_height
and hdmi_cvt
lines to,
framebuffer_width=660
framebuffer_height=390
hdmi_cvt=660 390 60 1 0 0
touch-swapxy
and touch-invy
or touch-invx
field under dtoverlay
in /boot/config.txt
(See the next two comments for further details'sudo reboot
systemctl start octoscreen &
to the file /etc/rc.local
right before the line exit 0
. Note the &
seems to be crucial to make it work, I tried without it and it failed to start OctoScreen. See Issue #34 for more infor on this.Remaining issue [Solved, see the following two comments for solution]: After rotating the PiTFT 90 or 270 degree to be landscape, the OctoScreen show that all the features are displayed properly, but when I touch them, the buttons seem to still think the screen is in the portrait 0 degree orientation. So far, this article is what I found regarding to how HDMI and the touch screen rotations are two different things. I don't know if this is the PiTFT driver issue or a configuration in OctoScreen. Any insight or able to duplicate my problem will be helpful. Thanks.
Remaining issue: After rotating the PiTFT 90 or 270 degree to be landscape, the OctoScreen show that all the features are displayed properly, but when I touch them, the buttons seem to still think the screen is in the portrait 0 degree orientation. So far, this article is what I found regarding to how HDMI and the touch screen rotations are two different things. I don't know if this is the PiTFT driver issue or a configuration in OctoScreen. Any insight or able to duplicate my problem will be helpful. Thanks.
OK, from the link posted in the quotation here, I found the parameters that help to flip the PiTFT around. For the 2.8" Capacitive, they are
/boot/overlays/pitft28-capacitive-overlay.dtb
Name: pitft28-capacitive Info: Adafruit PiTFT 2.8" capacitive touch screen Load: dtoverlay=pitft28-capacitive,= Params: speed Display SPI bus speed rotate Display rotation {0,90,180,270} fps Delay between frame updates debug Debug output level {0-7} touch-sizex Touchscreen size x (default 240) touch-sizey Touchscreen size y (default 320) touch-invx Touchscreen inverted x axis touch-invy Touchscreen inverted y axis touch-swapxy Touchscreen swapped x y axis
To make the update, add these two lines in /boot/config.txt
and reboot. You may need to play around to get the X/Y flipping correct to the screen orientation you set.
dtoverlay=pitft28-capacitive,rotate=90,speed=32000000,fps=20
dtoverlay=pitft28-capacitive,touch-swapxy=true,touch-invy=true
Could be similar to the resistive one.
To make the update, add these two lines in
/boot/config.txt
and reboot. You may need to play around to get the X/Y flipping correct to the screen orientation you set.dtoverlay=pitft28-capacitive,rotate=90,speed=32000000,fps=20
dtoverlay=pitft28-capacitive,touch-swapxy=true,touch-invy=true
Apparently the instruction in that link is not accurate. I have to rotate 270 degree and by separating the dtoverlay
into two separate line actually mess things up. I have to comment out the default dtoverlay
lines and add the following (and ignore the speed and fps setting since there is 79 character max for the dtoverlay
line apparently) and Voila, it works!
#dtoverlay=pitft28-capacitive,rotate=270,speed=64000000,fps=30
dtoverlay=pitft28-capacitive,rotate=270,touch-swapxy=true,touch-invy=true
In case you want to control the backlight of the PiTFT after shutting down (it stays on after RPi is shutdown), check this document out from Adafruit
I'm making use of an old but quite common "XC9022" - aka. Adafruit PiTFT - 320x240 2.8" TFT + Resistive Touchscreen with the 4 GPIO buttons (#'s 23, 22, 27 & 18 - tested OK) populated.
Managed to get the screen firing up well & touchscreen calibrated using the Adafruit scripts/guides:
Unfortunately OctoScreen does not play/scale nice, and I've tried resorting to the
fbcp
"hack", but not getting great results:from what I can tell, fbcp also adversely affects the use of the touchscreen interface, so that's a no-go
Is there a possible (simple) solution to this, and/or would it be possible to support this common piece of hardware in a future build?
(related request - would it be possible to support the 4 GPIO buttons in some manner?)