Touchscreen events...

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Touchscreen events...

    Hello,
    I hope this is the right place for my topic.


    We are evaluating the use of emWIN (precompiled library version downloaded from LPCWARE) on our target (NXP LPC1788 with 7 inches LCD and resistive touchscreen).
    The custom configuration of our display and touch screen went ok (we use builtin analog touch screen driver), but we have troubles with touchscreen events... I mean sometimes, not ever, when there is a new touch event on the screen it seems that the emWIN windows manager recognize a touch event in the last place when there has been the last touch before the current one.
    For example, let's suppose there are 2 buttons on the screen, when I permanently touch button 1 it is correctly drawn pushed by windows manager. After the button 1 is released, and I push button 2, there is at first a "glitch" that before pressing as expected button 2, hits again button 1 for only a small period of time.
    I suppose that I miss some update of the event related to the touchscreen...


    Below there is an extract of our LCDConf.c where function ExecTouch() is called every 10ms as suggested on documentation.

    [b]

    TP_GetTouchData(&pos), as name explains, return 1 if there is a touch event on the screen. In this case _TouchX and _TouchY are updated
    by new values returned by TP_GetTouchData(&pos). _TouchX and _TouchY are in turn the global values retuned by GUI_TOUCH_X_MeasureX and
    GUI_TOUCH_X_MeasureY functions.

    ...
    void ExecTouch(void)
    {
    GUI_PID_STATE State;
    st_TP_Coordinates pos;

    if (_IsInited == 0) {
    return;
    }


    if ( 1 == TP_GetTouchData(&pos) )
    {
    _PenIsDown = 1;

    _TouchX = pos.x;
    _TouchY = pos.y;

    GUI_TOUCH_Exec();

    }
    else if (_PenIsDown)
    {
    //
    // No further touch event after at least one touch event means we have
    // lift the pen from the touchscreen.
    //

    _PenIsDown = 0;

    GUI_PID_GetState(&State);
    State.x = 0;
    State.y = 0;
    State.Pressed = 0;
    GUI_PID_StoreState(&State);
    }

    }[/b]
    ...


    We have debugged the code and every touch recognized by low level touchscreen driver has correct x and y position... maybe some wrong issue about FIFO events pushed by our driver and processed by window manager?


    Have you any hints about this behavior?


    Than you in advance.





  • Hello,

    I would recommend calling the function GUI_PID_StoreState() when the touch is released, but also when the touch is pressed. Beyond the call to the function GUI_TOUCH_Exec() should be done regardless the pressed state of the touch screen.

    Best regards,
    Adrian
  • Thank you Mr. Adrian for your reply.

    As you suggested, I tried to add a call to GUI_PID_StoreState() also when touchscreen is pressed.


    C Source Code

    1. ...if ( 1 == TP_GetTouchData(&pos) )
    2. {
    3. _PenIsDown = 1;
    4. _TouchX = pos.x;
    5. _TouchY = pos.y;
    6. GUI_PID_GetCurrentState(&State);State.x = pos.x;State.y = pos.y;State.Pressed = 1;
    7. GUI_PID_StoreState(&State);
    8. GUI_TOUCH_Exec();
    9. }
    10. ...
    Display All



    In order to exclude weird errors on application level, I tried the "WIDGET_ButtonSimple" application code. With the above additions I can't hold the button pressed when touch is pressed, but in this case there is a quick sequence of button pressed-unpressed-pressed-unpressed... In addition, sometimes there is still the false capture of the last place when there has been the last touch before the current one.

    On the other hand, if I try the Widget_ButtonSimple.exe file for PC downloadable from Segger website, the button marked as "Click me..." is held pressed while left mouse button on PC is held pressed over the button itself... and the button disappears when left button of mouse is released.

    Please consider that the behavior of simple PC demo is exactly the same as the behavior of my original version (apart from the random last touch event...).

    What else could I check/consider to solve my problem?

    Thank you again.

    rayf15

    The post was edited 1 time, last by rayf15 ().

  • Hello,
    just an update about my issue...I could not get the emWin builtin analog touch screen driver work, so I decided to write my custom version of driver using Generic touch screen APIs... and now everything work as expected.
    I still have no idea about the incorrect behavior of my first version, but now, at least, I have a working touchscreen!


    rayf15