Skip to content

Latest commit

 

History

History
85 lines (64 loc) · 2.4 KB

touch_panel.md

File metadata and controls

85 lines (64 loc) · 2.4 KB

Touch Panel overview

For Waveshare 9.7" 1200x825 panel bought a touch screen panel

https://pl.aliexpress.com/item/1005002861652878.html?spm=a2g0o.order_detail.order_detail_item.3.597b43ceroQsWS&gatewayAdapt=glo2pol

  • 10.4"
  • 225x174 mm as per auction

Calculate Coordinate Transformation Matrix

Display size (from spec):

  • screen_width = 202.8 mm
  • screen_height = 139.425 mm

Touch area measured:

  • touch_width = 213.0 mm
  • touch_height = 160.0 mm

Want to have 0 offset top and left:

  • touch_area_x_offset = 0 mm
  • touch_area_y_offset = 0 mm
c0 0 c1 0 c2 c3 0 0 1 = 1.050296 0 0 0 1.147570 0 0 0 1

c0 = touch_width / screen_width = 213.0 / 202.8 ~= 1.050296
c1 = touch_area_x_offset / screen_width = 0
c2 = touch_height / screen_height = 160.0 / 139.425 ~= 1.147570
c3 = touch_area_y_offset / screen_height = 0

Based on: https://unix.stackexchange.com/a/617223

Apply settings

pi@raspberrypi:~ $ DISPLAY=":0" xinput
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ UsbHID SingWon-CTP-V1.18B               	id=6	[slave  pointer  (2)]
⎜   ↳ MOSART Semi. Trust Keyboard & Mouse     	id=9	[slave  pointer  (2)]
⎜   ↳ MOSART Semi. Trust Keyboard & Mouse Consumer Control	id=10	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ UsbHID SingWon-CTP-V1.18B               	id=7	[slave  keyboard (3)]
    ↳ MOSART Semi. Trust Keyboard & Mouse     	id=8	[slave  keyboard (3)]
    ↳ MOSART Semi. Trust Keyboard & Mouse System Control	id=11	[slave  keyboard (3)]

Run once after startup or add to ~/.xinitrc ** c2 was fine-tuned manually**

pi@raspberrypi:~ $ DISPLAY=":0" xinput set-prop "pointer:UsbHID SingWon-CTP-V1.18B" "Coordinate Transformation Matrix" \
	1.050296 0 0 0 1.137570 0 0 0 1

Run all script

$ cat ~/bin/my-startx.sh
#!/bin/bash
set -eux

startx &
sleep 2

export DISPLAY=":0"

xinput set-prop "pointer:UsbHID SingWon-CTP-V1.18B" "Coordinate Transformation Matrix" \
        1.050296 0 0 0 1.137570 0 0 0 1

cd ~/projects/eink2_x11_1200x825_24bpp/
sudo ./eink_rpi_standalone 4 20 200 3 550 1200 825 0 0 0 300 1 0 0

.xsession / .xinitrc might be just

exec mate-session

Once ssh to Raspberry just execute my-startx.sh

Need auto-start!