Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 7 months ago.
Touch Screen Calibration
The PUB_RA8875_TouchColors is working fine on the 8" screen.
However the touch screen calibrate will often do a auto insert of the value on the 3rd "cross" or user input. It uses the value fron the second input. Will need some debouncing
Kim
1 Answer
9 years, 7 months ago.
Hi Kim,
Here's the code, and you see a simple 20 ms delays. I'll suggest you make changes to this and rebuild the library - see if it then meets your needs. As you see, there is not a reason the 3rd target should behave different than the 2nd.
for (int i=0; i<3; i++) { foreground(Blue); printf(" (%3d,%3d) => ", pTest[i].x, pTest[i].y); line(pTest[i].x-10, pTest[i].y, pTest[i].x+10, pTest[i].y, White); line(pTest[i].x, pTest[i].y-10, pTest[i].x, pTest[i].y+10, White); while (!TouchPanelA2DFiltered(&x, &y) && timeout.read() < maxwait_s) wait_ms(20); pSample[i].x = x; pSample[i].y = y; line(pTest[i].x-10, pTest[i].y, pTest[i].x+10, pTest[i].y, Black); line(pTest[i].x, pTest[i].y-10, pTest[i].x, pTest[i].y+10, Black); foreground(Blue); printf(" (%4d,%4d)\r\n", x,y); while (TouchPanelA2DFiltered(&x, &y) && timeout.read() < maxwait_s) wait_ms(20); wait(2); }
Hi David
In RA8875_Touch.cpp I have changed the above loop to the following:
for (int i=0; i<3; i++) { //set text colour foreground(Blue); //Print test co-ordinates to tft screen printf("Test Co-ordinates (%3d,%3d) => ", pTest[i].x, pTest[i].y); //draw cross on screen in white line(pTest[i].x-10, pTest[i].y, pTest[i].x+10, pTest[i].y, White); line(pTest[i].x, pTest[i].y-10, pTest[i].x, pTest[i].y+10, White); //wait for filtering or timeout while (!TouchPanelA2DFiltered(&x, &y) && timeout.read() < maxwait_s) { wait_ms(20); //time to allow screen to process touch screen data } //save captured touch screen numbers. pSample[3] is an array of 3 pSample[i].x = x; pSample[i].y = y; //erase cross on screen by drawing it again using back ground color line(pTest[i].x-10, pTest[i].y, pTest[i].x+10, pTest[i].y, Black); line(pTest[i].x, pTest[i].y-10, pTest[i].x, pTest[i].y+10, Black); //reset text color foreground(Blue); //Print touch result data to tft screen printf("Touch Result (%4d,%4d)\r\n", x,y); //wait for user to move finger of screen wait(1); }
As I'm not much of a C programmer, it's likely that the above is incorrect. But it seems to be working just fine. It seems that all the touch screen debounce filtering is done in TouchPanelA2DFiltered.
Thanks
Kim
posted by 30 May 2015