Skip to main content
Associate II
January 31, 2025
Question

TouchGFX - Slider jumps to zero

  • January 31, 2025
  • 3 replies
  • 3577 views

Hi all,

TouchGFX version: 4.16.1

I have a slider that allows user to change the timer values. I have registered two callbacks (1) setNewValueCallback and (2) setStopValueCallback.

When using simulator, when I simply click(no release yet) on some value on a slider that is different than the current value, I get a new value callback once. When I release the mouse button, I get another new value callback(which is expected based on the code I see in Slider.cpp), followed by stop value callback - total of three callbacks happen. This works without any issues in the simulator.

On target, it works for the most part but every now and then I run into issues where when I click on a slider value, the slider jumps to zero position. I have also seen it jump to max position. I added some events in the both of those callback handlers to debug this further. When this issue is not happening, I see three debug events as expected as explained earlier in simulator case(two new value callback events and one Stop callback event). The events also prints out the correct slider value that came from the callback function's argument. But when this issue happens(slider jumping to zero case) - my slider touch on a slider triggers 4 events (i.e. 4 callbacks) in total. The first callback is new value callback with the correct slider value(verified by event data). The second callback is new value callback with slider value set to 0 which does not make any sense.(I do not call setValue() on this slider anywhere in my code at all). The 3rd callback is new value callback again with the slider value set to 0 and the 4th callback is Stop value callback with the slider value of 0 as well.

Any help would be appreciated to point me to where things could be going wrong.

Edit 1: In touchgfx right panel, Slider->Values, I updated the slider range value from [0, 100] to [5, 100] (which makes the indicator to start at 5  as expected). When the issue happens, I see that the first new value callback gets called with the correct slider value but the 3 subsequent callbacks(new Value, new Value and Stop) - they get called with slider value of 5 i.e. slider value falls back to Minimum value.

3 replies

mƎALLEm
Technical Moderator
January 31, 2025

Hello @thatenergyguy and welcome to the community,

I'm wondering if it's a new development or an old application developed since awhile because TouchGFX V4.16.1 is a relatively old version. So if it's a new development, I invite you to use the latest version of TouchGFX. The latest 4.24.2.

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
Associate II
January 31, 2025

Thank you for your reply. This is an old development. This issue is seen in multiple production devices in the field and is important for us to fix as soon as possible without spending significant amount of time. We have plans to move to latest version later this year.

Associate II
January 31, 2025

I updated the description with more information. Check Edit 1 section.

Graduate II
January 31, 2025

Hello Energyguy

Could it be that the touchscreen handler is sometimes giving discontinuous coordinates or even interruptions in the touch position ? This would explain why your slider works in the simulator but not on the target board.

Maybe you could verify this for example registering callback to some button and observe does it also give release or cancel events when it kept pressed and maybe move finger a bit.

This type of issues are quite common in this kind of problems.

Hope this helps.

Br JTP

PS. you can also compare slider.h/.c files under Middlewares folder between 4.16.1 and some of latest versions. I did compare 4.18 and 4.23.2 files...as far as I see there are some changes but nothing major. Also Changelog doesn't show critical bug fixes after 4.16.1 concerning to slider container.

 

Associate II
January 31, 2025

It is possible. We will look in that direction as well.

Meanwhile, I have been debugging this further and this time, I added a callback for the start Value. When this issue happens, my debug event log shows that the start Value callback was called with the correct slider value (the value that slider was set to before my touch i.e. start value) and following callbacks are observed to be exact same as before i.e. got 4 callbacks. First new Value callback with the correct slider value followed by all those three callbacks with zero slider value. Thinking out loud - this may not be necessarily true but it makes me think that the very least, it is not a brand new click event that is being triggered in the middle of the current click event processing as if it was a brand new touch event, I would expect it to trigger a start Value callback(total of two start Value callbacks) with a different start value.

Associate II
January 31, 2025

I quickly compared Sliper.cpp between 4.16.1 and 4.24.1. I do not see any major logic changes that could introduce this issue. There have been some cleanups and some type changes also. Not sure if that would create an trouble but from the surface, it does not look like it would.

Billy OWEN
ST Employee
February 5, 2025

Hi @thatenergyguy 

 

This post has been escalated to the ST Online Support Team for additional assistance.  We'll contact you directly.

 

Regards,

Billy

Associate II
June 23, 2025

Hello,

I have potentially the same issue.

I use 5inch Riverdi board. I sample the slider value every 25 ticks. I can not see the value 0 here (breakpoint does not hit). However i can see the slider jump to 0 and back from time to time when dragging the finger across the slider.

Thank you

regards Jeronym