HUZZAH32 LVGL 3.5" TFT Feather Onscreen keyboard doubles up letters

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
JMellen
 
Posts: 18
Joined: Thu Oct 07, 2021 5:58 pm

HUZZAH32 LVGL 3.5" TFT Feather Onscreen keyboard doubles up letters

Post by JMellen »

I have a 3.5" TFT Feather attached to a HUZZAH32 and I have taken the Adafruit example "hello_featherwing" and added the LVGL example for an onscreen keyboard to the bottom of that code and I call "lv_example_keyboard_1()" for the setup instead of the "lvgl_setup()". This compiles etc just fine, but I have issues with characters doubling up when typing. This mimics an issue I have in my own project that is very problematic when a user has to enter a password or SSID.

Has anyone seen this behavior? Is there a setting that I am maybe missing?

Anyone from Adafruit --> you have a little video on the website showing flawless keyboard entry... is that code available for testing?

I have attached my code and the hardware is literally those two devices plugged into each other.

Thanks,
Jon
Attachments
hammerOutTouchIssues.zip
(2.16 KiB) Not downloaded yet

User avatar
JMellen
 
Posts: 18
Joined: Thu Oct 07, 2021 5:58 pm

Re: HUZZAH32 LVGL 3.5" TFT Feather Onscreen keyboard doubles up letters

Post by JMellen »

To be clear, the keyboard is not the only place I see this issue, just the easiest to demonstrate. Every LVGL object gets multiple "LV_EVENT_PRESSED" messages right in a row seemingly no matter how fast you press and the system very rarely recognizes a long press because it breaks them up into a bunch of short presses. This happens with both my finger as well as any type of stylus.

User avatar
JMellen
 
Posts: 18
Joined: Thu Oct 07, 2021 5:58 pm

Re: HUZZAH32 LVGL 3.5" TFT Feather Onscreen keyboard doubles up letters

Post by JMellen »

I found this to be a problem where the STPE610 was sending back multiple touches for a single touch and the glue library is not handling that. I changed the glue library to artificially debounce the input and it is now working. I have attached the revised Adafruit_LvGL_Glue.cpp file here in the hopes someone at Adafruit will make the necessary changes.

This is where the while loop was added:
if ((fifo = touch->bufferSize())) { // 1 or more points await
while ((fifo = touch->bufferSize())) { // loop with a wait at the end to make sure there are no more coming - JYM 3-17-23
data->state = LV_INDEV_STATE_PR; // Is PRESSED
TS_Point p = touch->getPoint();
// Serial.printf("%d %d %d\r\n", p.x, p.y, p.z);
// On big TFT FeatherWing, raw X axis is flipped??
if ((glue->display->width() == 480) || (glue->display->height() == 480)) {
p.x = (TS_MINX + TS_MAXX) - p.x;
}
switch (glue->display->getRotation()) {
case 0:
last_x = map(p.x, TS_MAXX, TS_MINX, 0, disp->width() - 1);
last_y = map(p.y, TS_MINY, TS_MAXY, 0, disp->height() - 1);
break;
case 1:
last_x = map(p.y, TS_MINY, TS_MAXY, 0, disp->width() - 1);
last_y = map(p.x, TS_MINX, TS_MAXX, 0, disp->height() - 1);
break;
case 2:
last_x = map(p.x, TS_MINX, TS_MAXX, 0, disp->width() - 1);
last_y = map(p.y, TS_MAXY, TS_MINY, 0, disp->height() - 1);
break;
case 3:
last_x = map(p.y, TS_MAXY, TS_MINY, 0, disp->width() - 1);
last_y = map(p.x, TS_MAXX, TS_MINX, 0, disp->height() - 1);
break;
}
more = (fifo > 1); // true if more in FIFO, false if last point
#if defined(NRF52_SERIES)
// Not sure what's up here, but nRF doesn't seem to always poll
// the FIFO size correctly, causing false release events. If it
// looks like we've read the last point from the FIFO, pause
// briefly to allow any more FIFO events to pile up. This
// doesn't seem to be necessary on SAMD or ESP32. ???
if (!more) {
delay(50);
}
#endif
delay(25); // Added to wait for possible "extra" touches - JYM - 3-17-23
} // End of added while loop - JYM - 3-17-23
} else { // FIFO empty
data->state = LV_INDEV_STATE_REL; // Is RELEASED
}
Attachments
Adafruit_LvGL_Glue.cpp
(16.66 KiB) Downloaded 1 time

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: HUZZAH32 LVGL 3.5" TFT Feather Onscreen keyboard doubles up letters

Post by adafruit_support_mike »

Oh yeah.. that's a long-known issue of the STMPE610.

The chip keeps a buffer of touches, so you need to make sure you've cleared the buffer before calling for new touch events.

User avatar
JMellen
 
Posts: 18
Joined: Thu Oct 07, 2021 5:58 pm

Re: HUZZAH32 LVGL 3.5" TFT Feather Onscreen keyboard doubles up letters

Post by JMellen »

You guys do a great job with all of your drivers / post customer support, so don't take this wrong, but is there anyway to get this long-known issue resolved in the current Adafruit LVGL-Glue library? As a developer its kinda tough to remember to go back in and implement my own fix every time I update the Glue library...

Love your products, love your service and support.

Thanks,

Jon

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: HUZZAH32 LVGL 3.5" TFT Feather Onscreen keyboard doubles up letters

Post by adafruit_support_mike »

I'll mention it to the folks who handle that library. At minimum, we can add something to the documentation.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”