cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX - Slider jumps to zero

thatenergyguy
Associate

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.

10 REPLIES 10
SofLit
ST Employee

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.
PS:
1 - This is NOT an online support (https://ols.st.com) but a collaborative space.
2 - Please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help.

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.

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

JTP1
Lead

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.

 

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.

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.

Hello

Ok, you are probably right about touchpanel issue, that case it would act little bit differently.

I made some test with 4.18.0 and STM32F769I-Discovery board. It seems to work perfectly. I used interactions to call virtual fuctions and implemant all three possible callbacks: Initiated, changed and confimed. Then print out emitted value to three separate text area. Everything worked well also in target.

That makes me wonder what you do in callback- funtions, could it possibly cause some issues ? Could you probably share some code ?

Br JTP

PS. You may wonder why I didn't use 4.16.1. For some reason I cant see any TouchGFX Board Setups (TBSs) when creating new project, only simulator.  It gives some error like:

JTP1_0-1738596233102.png

 

Hi @JTP1 

Thank you so much for trying this from your end. We really appreciate the help. I have gone through the callback functions deeply and I could not find anything. Yes, I can probably share the callback functions but I am going to have to make some changes so that I can share it without revealing an IP.

No problem at all.

This might a silly question but have you test with 'empty' callback funtions ie dont do anything there ?

Br JTP