This issue has plagued many of us. There are a bunch of forum posts about it https://discourse.zynthian.org/search?q=x%20axis
And there doesn’t appear to be a single solution. Best advice I can offer is to read through these posts. Perhaps one post may help you solve your issue.
The issue appears to be related to the fact that the tft xy axis is on a different layer than the display. Rotating the display (that’s the easy part) only will not work. The tft layer also has to be rotated. That’s where the TransformMatrix option in the 99-calibration.conf file needs to be set correctly. I’ve seen several different settings, depending on the given setup. I know I’m a few days early, but May the Fourth be with you!
My working notes Joy It 3.2 (Waveshare clone) display not working its messy and I tend to do it with command line parameters.
But since that mess I get it up and going ( admittedly with an inverted left/right
It’s about the default settings for X but I’ve never got that fully understood.
Presumably the .99 files are read in order and this is just a sneaky way of installing a default, but presumably the zynths cut that off at the path somewhere back down the pipeline.
Is this showing an offset of coordinates? I’m having the same problem with official PiScreen 3.5 V2 and just replied to another (old) post asking for advice.
Certainly for the new step sequencer the scale mismatch / offset is a bit annoying when setting or removing notes on a small grid with the stylus. It helps to have the cursor displayed though.
Alright, I’ll fiddle around with the values later and come back with a result.
Edit: I think I first need to understand what’s going on under the hood, X11, 99-calibration.conf etc. Simply changing the numbers in the matrix in /zynthian/zynthian-sys/custom/display/PiScreen 3.5 (v2)/config/zynthian_custom_config.sh didn’t have any effect (not even flipping the axes) so need to look elsewhere.
Hi @Tubbritt, thanks for the reference to this second zynthian_custom_config.sh. Making changes there do actually affect the touch behaviour, as opposed to the file with the same name in /zynthian/zynthian-sys/custom/display/PiScreen 3.5 (v2)/config/.
At least now we know where to attack .
For me, the matrix to start with is -1 0 1 0 -1 1 0 0 1. (x and y axes have correct orientation). When I do 1 0 0 0 -1 1 0 0 1 it results in a flipped x axis.
It’s just about picking the right values. As @wyleu pointed out these values are floats. According to my gut feeling the result should look something like -a1 0 a3 0 -b2 b3 0 0 1 with the constants around 1 ± something.
BTW, reboot is actually not necessary. systemctl restart zynthian is quicker and keeps you logged in via ssh. For all who want to give it a try.
it is no so easy to see what is binary structure (exponent, significant field, sign, …) within these matrix values. So, it is not so intuitive to understand that these value are close to 1 ± something.
Hi, well, it’s just my gut feeling that comes from being a physicist
Let me just briefly explain. It’s about so called affine projections (you can google it) which are used to map a point or rather a vector (which defines that point by two coordinate numbers in space, i.e. in x-y-plane) to a new position.
Now, these 9 numbers which are written in a single row in the config file, actually make up a matrix which connects the output vector (new point, the point where we want the touch point to be) with the input vector (original point, the point where touch is recorded now) by means of matrix multiplication which in turn is composed of matrices for offset (translation), rotation and scaling. We need scaling and offset here.
which is equivalent to c0 0 c1 0 c2 c3 0 0 1 in our config file
where
c0 defines scale factor along x (horizontal) axis,
c2 defines scale factor along y (vertical) axis,
c1 defines x offset
c3 defines y offset.
All these numbers are defined relative to total width and total height according to the above link and this is why the new numbers should be close to 1. For example, introducing an offset to the right by 10 % of the total width (and c1 = 1) would result in the new c1 being 1.1. The nice thing about these matrix operations is that they do not only affect a single point in the x-y plane but all points that are thrown at it. You have to imagine it like pushing a sheet of paper around on a table (i.e. offset, translation), or like pulling on a stretchy piece of cloth on one end while the other end is fixed (i.e. scaling).
Just one remark about the minus signs - they come from the matrix operations for flipping and rotating the axes. As they appear in steps of 90 degrees these numbers are 1 or -1 or 0. It comes from the sin or cos function of the angle of rotation which yields 1, 0, -1 at multiples of 90 degrees but could also give any number inbetween at other angles. Which we don’t want
Now the only thing I’m uncertain about is, where is actually the corner (0,0).
Is it centered at (screen_witdh / 2, screen_height/2) or is it at screen pixel (0,0) (would that be upper left corner?) or does it have it’s own reference frame…
“bash zynthian_custom_config.sh” allows testing values without restarting the UI.
Then trial and error can be done in the " * 5.7.1 XY-Controller" mode.
My only concern now is that zynthian_custom_config.sh doesn’t seem to be executed during boot sequence. Any clue ? Edit : If I go to webconf/hw-display and save then the change becomes permanent.
hi guys…
After several tryouts and possible solutions, today misteriously worked this combination, mixing some random solutions here reported:
choosing waveshare 4A GPIO only and using this string:
dtoverlay=waveshare35a:rotate=90
display_rotate=1
My chinese display finally got right touch coordinates
For those who ask for lcd type:
actually could be one of thousands clone lcd of whatever kind or type
it’s really a weird condition
Maybe someone still stuck with issues can check if this is really a possible solution (even changing dtoverlay. Honestly i continue to doubt i really succeded with a so simple solution… after hours of struggling (before writing this topic…)