Wednesday, April 25th 2018, 6:43am UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

baev_al

Beginner

Date of registration: Dec 25th 2014

Posts: 16

1

Sunday, December 25th 2016, 2:46pm

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]
baev_al has attached the following image:
  • Spinbox.jpeg

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 562

2

Monday, January 2nd 2017, 1:20pm

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
SEGGER - Schoenen has attached the following file:
  • Test.zip (411 Byte - 101 times downloaded - Last download: Apr 23rd 2018, 5:11pm)

baev_al

Beginner

Date of registration: Dec 25th 2014

Posts: 16

3

Friday, January 13th 2017, 8:08am

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!

baev_al

Beginner

Date of registration: Dec 25th 2014

Posts: 16

4

Friday, January 13th 2017, 11:25am

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!

This post has been edited 2 times, last edit by "baev_al" (Jan 13th 2017, 11:29am)


SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 562

5

Friday, January 13th 2017, 2:05pm

Hi,

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

C/C++ Source code

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


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

Regards,
Sven

Similar threads