-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
VID_20210708_145542.mp4
I was working on improving the touch handling and found some potential big improvements.
By adjusting registers on the touchscreen controller, we can get an interrupt on touch state change. I believe currently we only get interrupts from gestures. The single tap gesture has a long delay, which is why currently the watch responds sluggishly.
/*
[7] EnTest - Interrupt pin to test, enable automatic periodic issued after a low pulse.
[6] EnTouch - When a touch is detected, a periodic pulsed Low.
[5] EnChange - Upon detecting a touch state changes, pulsed Low.
[4] EnMotion - When the detected gesture is pulsed Low.
[0] OnceWLP - Press gesture only issue a pulse signal is low.
*/
static constexpr uint8_t irqCtl = 0b00110000;
twiMaster.Write(twiAddress, 0xFA, &irqCtl, 1);
Here's where I'm at currently.
https://github.com/Riksu9000/InfiniTime/tree/improved_touch_handling
Most things work fine, but with some apps touch seems inconsistent. Sometimes taps will "buffer", when a tap seems to get ignored, but tapping elsewhere will apply the missing tap. The first touch is more consistent than subsequent touches. Arc in metronome might flicker between max and min positions.
I'm starting to run out of ideas, so any help would be appreciated.
This potential can easily be tapped into in some cases by simply enabling TouchModes::Polling. This works on Timer on develop branch and it improves usability greatly.
EDIT: I was studying FreeRTOS and I thought that touch events should really be handled in a separate task. Then we could also enable EnTouch, and the handling could be really simple. I'll look into this more.