Touch research for IC FT6X36 - martinberlin/cale-idf GitHub Wiki

The touch component for FocalTech is fully implemented so this Wiki entry will be kind of a Backlog behind the thinking process that may help others to understand how touch is done.

I2C commands reference

FocalTech I2C command reference

This is what comes via I2C read when a touch event fires. When that happens INT pin goes LOW and there is a callback function that reads the Touch information. The important details so far is to gather:

0x01 GEST_ID Gesture ID. Not relevant in this model from Goodisplay (Comes always 0, no matter what is done)
0x02 TD_STATUS Number of touch points (Taping with two fingers sometimes returns a 2) Does not seem relevant
0x03 P1_XH 1st X (High part)
0x04 P1_XL 1st X (Low part)
0x05 P1_YH 1st Touch ID + First Y (High part)
0x06 P1_YL 1st Y (Low part)
0x07 P1_WEIGHT Touch weight. Does not interest me so far comes either 0x00 or 0xFF (When a strong press)
0x08 P1_MISC  Does not seem relevant in this model 
0x09 P2_XH 2nd X (High part)
0x0A P2_XL 2nd X (Low part)
0x0B P2_YH 2nd Touch ID + 2nd Y (High part)
0x0C P2_YL 2nd 2nd Y (Low part)
0x0D P2_WEIGHT Touch weight for point 2
0x0E P2_MISC

In total there are 13 interesting Bytes returning per I2C to analyze the touch information. The issue that needs analysis and cannot be used RAW. Because tapping fast delivers two events:

The Press down event and the Lift up event. So if we would react per event, on a single Tapping, we will press the Key twice. This should be analyzed by software and only if the Lift up event comes with a 300 ms difference then should fire a TAP event.

That explained this needs an analysis to bring Raw events into processed events.

How a typical TAP event looks like on the registers

Tr is Touch RAW.
REGISTERS: Press event
0:0 1:0 2:1 3:0 4:16 5:0 6:72 7:0 8:0 9:ff a:ff b:ff c:ff d:ff e:ff f:ff 
TOUCHES: 1  -> 1 single point touched
Tr[0]=0 1st -> PressDown
Tr[1]=3 2nd -> NoEvent (True since there is only 1 pressed point)

REGISTERS: Release event
0:0 1:0 2:0 3:40 4:16 5:0 6:72 7:0 8:0 9:ff a:ff b:ff c:ff d:ff e:ff f:ff 
TOUCHES: 0  -> We release hence there is no touches count
Tr[0]=1 1st -> LiftUp
Tr[1]=3 2nd -> NoEvent

RESULT AFTER PROCESSING:
X: 22, Y: 114, E: Tap  (Only if there are less than 300 milliseconds of difference between press/release)

NOTE: Not always comes PressDown (0) as the initial event. Sometimes comes Contact (2) as 1st. I really don't understand what is the difference between both except that contact seems to be fired when the touch panel is not pressed strongly. And PressDown only fired when it's more pressure. So ideally the Tap detection should happen if first event is 0 OR 2 (Measure timestamp), followed by a 1 LiftUp event. If the difference between the touch and lift up is less than 300 millis then it should fire a TAP event.

Since we are not having Gestures returned in this Model, we have to make them up, another interesting ones that are already in Strange-v FT6X36 esp32 library are this ones:

  • Tap
  • DragStart
  • TouchMove
  • DragEnd

It would be nice to have based on the double lecture of the X, Y & Event points:

  • Zoom IN
  • Zoom OUT

If the X & Y are expanding on the second lecture of the points then we have a Zoom in otherwise is a Zoom out event. This along with Dragging could be very useful when showing a map in the small epaper.