Spinbox buttons don't react

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

  • Spinbox buttons don't react

    Hi.
    Can you please help me to solve the problem: spinbox buttons behave strangely. Below is an explanation.
    I use STM32F429I-Discovery.
    I tried two precompiled libraries 5.28 and 5.32 (the result is the same).
    The items I used maybe seen on the picture.
    When I reset the board and the first touch I make is the spinbox button (either up or down) value begins to change continuously (even when I release the button)) until it reaches its max or min value. After that, neither item can get focus (however, the software is running - checked it with a debugger).
    If my first touch is radio or any button - radio and buttons work ok, but spinbox can only get focus - the buttons of the spinbox do not react...
    Is there something I can change or check?
    Thanks!
    [img]http://forum.segger.com/index.php?page=Attachment&attachmentID=1399&h=3436f04955d4e3be19b3fdd03bd58274a9df0676[/img]
    Images
    • Spinbox.jpeg

      70.92 kB, 389×519, viewed 879 times
  • Hi,

    I checked it with the STemWin_SampleDemo project comming with STM32Cube FW F4 V1.13.0.

    For this I have created a single spinbox. Everything is working as expected. Attached is the application I used for this (it's pretty simple).
    Does it work on your side?

    Are you handling the touch input on your own?
    If that is the case, please make sure the release events are generated properly.

    EDIT:
    Added attachment ;)

    Regards,
    Sven
    Files
    • Test.zip

      (411 Byte, downloaded 361 times, last: )
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi.
    I tried your example - in my case, it works wrong (as I described above). Can you please check the touch input function (it is from ST example), the function is called periodically by timer interrupt:


    void BSP_Pointer_Update(void)
    {
    GUI_PID_STATE TS_State;
    static TS_StateTypeDef prev_state;
    TS_StateTypeDef ts;
    uint16_t xDiff, yDiff;

    BSP_TS_GetState(&ts);

    TS_State.Pressed = ts.TouchDetected;

    xDiff = (prev_state.X > ts.X) ? (prev_state.X - ts.X) : (ts.X - prev_state.X);
    yDiff = (prev_state.Y > ts.Y) ? (prev_state.Y - ts.Y) : (ts.Y - prev_state.Y);

    if(ts.TouchDetected)
    {
    if((prev_state.TouchDetected != ts.TouchDetected )||
    (xDiff > 3 )||
    (yDiff > 3))
    {
    prev_state = ts;

    TS_State.Layer = 0;
    TS_State.x = ts.X;
    TS_State.y = ts.Y;

    GUI_TOUCH_StoreStateEx(&TS_State);
    }
    }
    }

    Thanks!
  • I changed the touch function so it will store the data (GUI_TOUCH_StoreStateEx(&TS_State);) not only when touch is detected
    I changed:

    if(ts.TouchDetected)...

    to
    if(1)...

    and now everything works.
    Sven, thank you for the help!

    The post was edited 2 times, last by baev_al ().

  • Hi,

    Your solution is kind of similar to the way we do it in most cases:

    C Source Code

    1. static void PID_X_Exec(void) {
    2. TS_STATE * pStateTS;
    3. static GUI_PID_STATE StatePID;
    4. static int IsTouched;
    5. pStateTS = IOE_TS_GetState();
    6. StatePID.Layer = _LayerIndex;
    7. if (pStateTS->TouchDetected) {
    8. IsTouched = 1; // Remember that we had a touch event
    9. StatePID.Pressed = 1;
    10. StatePID.x = pStateTS->X; // Store x
    11. StatePID.y = pStateTS->Y; // and y coordinates
    12. GUI_PID_StoreState(&StatePID);
    13. } else {
    14. if (IsTouched == 1) { // If we had a touch event
    15. IsTouched = 0;
    16. StatePID.Pressed = 0; // Set pressed state to 0
    17. GUI_PID_StoreState(&StatePID); // Send pressed state 0 with the same coordinates as the last touch event.
    18. // since it is a static variable it has the same x/y coordinates as the last pressed event.
    19. }
    20. }
    21. }
    Display All


    The function PID_X_Exec() gets called periodically (like every 25 ms).

    Regards,
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.