I got my Hyperpixel 4 (rectangular) with Touch out of a dusty drawer and put it on a Pi 3 B+ with a completely fresh copy of RaspiOS. I installed the software with “curl -sSL https://get.pimoroni.com/hyperpixel4 | bash”, option 0 for rectangular/Pi3 and after rebooting I rotated it to landscape with “hyperpixel4-rotate right”. That works, and a the cursor works fine with a mouse. But Touch is b0rked!
It seems to me like this Pi3+Rectangular+Touch is a long established configuration, and it is not cheap throw-away hardware. How is it possible that after all these years (ok, 2?) the touchscreen does not work out of the box even on a Pi3 and will not work after quite a bit of user-level tinkering?!
After a lot of googling I found some more or less undocumented options to the overlay: touchscreen-swapped-x-y=1, touchscreen-inverted-x=1, touchscreen-inverted-y=1. All THREE of these are necessary to correct the swapped & inverted touch coordinates, but the software only seems to accept TWO of them at a time. So I’m stuck. Can you help?
I may have found a work-around by just blindingly swapping rotations :(
First on the Pi itself!!!: “hyperpixel4-rotate left”. Note that this is not what I really want, I want the HDMI on top, which would be rotate right. This leaves certain settings in /etc/udev/rules.d/98-hyperpixel4-calibration.rules: ATTRS{name}==“Goodix Capacitive TouchScreen”, ENV{LIBINPUT_CALIBRATION_MATRIX}=“0 -1 1 1 0 0”. Then reboot.
Second: add touchscreen-swapped-x-y=1 to the dtoverlay setting in /boot/config.txt with a comma separator: “dtoverlay=hyperpixel4:rotate_3,touchscreen-swapped-x-y=1”. Does not work with a colon separator. The first colon may also be a comma, I think. Note that normally this would say rotate_1 for HDMI on top but step 1 made it rotate_3. So the screen is flipped (for me).
Third: edit another line in /boot/config.txt: “display_rotate=1”. Note that normally this would be the same number as in the dtoverlay setting. By rotating here, there is no need for inverting the Touch coordinates which would be impossible because this dtoverlay doesn’t accept 3 parameters.
Fourth, to be on the safe side, it may work without but I added it early and left it: add framebuffer_width=800
framebuffer_height=480
to /boot/config.txt, save and reboot.
I now have a screen the right way up with Touch and X mouse working properly. This was all very frustrating :(
First of, sorry you ended up trapped in this death spiral of HyperPixel frustration. I know how it feels. Intimately.
Second:
There’s an 80-character line-length limit in /boot/config.txt which is not widely known about. For parameters that exceed this line length, I guess they’re just dropped. The way to work around this is to add them as a dtparam underneath, such as:
Wondering about the best place to document this particular weirdness with HyperPixel4- I have a suspicion that sticking a comment in /boot/config.txt would be the most visible place. Perhaps along with including all the parameter default vales as dtparam lines.
There’s not much I can do on the installer side, because it would have to ask something like “Is your Pi 3B+ one of the ones that inverts touch for some reason?” though while typing this… that doesn’t seem like the worst idea. At least it gives visibility to the issue and hints at a way to fix it.