Wednesday, April 25th 2018, 12:35am 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.

ermeneuta

Beginner

Date of registration: May 6th 2015

Posts: 2

1

Wednesday, May 6th 2015, 12:01pm

WM_NOTIFICATION_RELEASED for a button wrongly called

Good morning,

I am developing a prototype application on the STM32F429 Discovery board, using the Keil uVision IDE.
I designed a GUI with GUIBuilder, and everything works as it should, except for an annoying behavior.
I have a button on the screen, whose clicking (touching) I intercept in the DLG callback routine :

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
23
24
25
26
27
28
29
30
....................................
/*********************************************************************
*
*   	Static code
*
**********************************************************************
*/
// USER START (Optionally insert additional static code)
static int guard = 0;
// USER END
....................................


	case ID_BUTTON_0: // Notifications sent by 'Freq'
  	switch(NCode) {
  	case WM_NOTIFICATION_CLICKED:
    	// USER START (Optionally insert code for reacting on notification message)
     	if(!guard)
   	{
      	guard = 1;					 
      	hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_0);
     	MULTIEDIT_AddText(hItem, "Clicked ! "); 
   	}		
    	// USER END
    	break;
  	case WM_NOTIFICATION_RELEASED:
    	// USER START (Optionally insert code for reacting on notification message)
    	guard = 0; 
    	// USER END
    	break;


The problem is that the case WM_NOTIFICATION_RELEASED is executed even if I press on the button and do not lift my finger from it...
It is called continuously, following the call to WM_NOTIFICATION_CLICKED.... this is quite annoying...
Is there a workaround for this, or its me who haven't completely understood how the logic behind that is ?

Thanks for any help

Alberto

Date of registration: May 26th 2009

Posts: 1,022

2

Thursday, May 7th 2015, 11:33am

Hello Alberto,

Please note that emWin does not manipulate touch data aside from recalculating the coordinates according to the touched window.

It seems your touch screen needs to be debounced in terms of its pressed state.

Best regards,
Adrian

ermeneuta

Beginner

Date of registration: May 6th 2015

Posts: 2

3

Thursday, May 7th 2015, 4:09pm

Adrian, thanks.

well, I thought the debouncing would have done inside the driver... apparently that is not the case.
Can you (or somebody else) suggest some example of a debouncing routine for the touch screen ?

TNX

Alberto

Date of registration: May 26th 2009

Posts: 1,022

4

Friday, May 8th 2015, 10:51am

Hello Alberto,

Unfortunately there is no general solution for debouncing. You will have to analyze the touch values from your controller in order to know how many "unpressed" events are recognized by it although the touch is continuously pressed.

Best regards,
Adrian