- * Keys manager function
- static void manage_keys( int key_event )
- char int_to_string;
- if( key_event == key_rotate_cw )
- else if( key_event == key_rotate_ccw )
- snprintf( int_to_string, sizeof(int_to_string), "%d", value_to_display );
- TEXT_SetText( h_Text, int_to_string );
- * Window callback
- static void callback_Window( WM_MESSAGE *pMsg )
- int sender_Id, notify_Code; // Do actions according to event message
- switch( pMsg->MsgId )
- case WM_PAINT:
- case WM_NOTIFY_PARENT:
- // Get id of the window/widget has sent the message
- sender_Id = WM_GetId( pMsg->hWinSrc );
- // Get notification code
- notify_Code = pMsg->Data.v; [...]
- case WM_KEY:
- // Key event received
- manage_keys( ((WM_KEY_INFO*)pMsg->Data.p)->Key );
- // Default event process
- WM_DefaultProc( pMsg );
- * Main
- // Create window
- h_Window = WM_CreateWindow( x, y, w, h, WM_CF_SHOW, NULL, 0 );
- WM_SetCallback( h_Window, callback_Window );
- // Create textbox to show value
- h_Text = TEXT_CreateEx( x_txt, y_txt, w_txt, h_txt, h_Window, WM_CF_SHOW, 0, txt_id, "" );
we've a user interface developed with the emWin library and now we'd like to "optimize" its appearance and its behaviour displayed data are refreshed.
In particular, we've a window with a textbox showing a value, which can be managed through an encoder: rotating this latter allows to increment (cw) or decrement (ccw) the value. When encoder is rotated relatively fast, application has to refresh value faster and this is reflected appearance, which is "degradated": old value and new value are overlapped for a short time, as you can see in attached pictures.
Above a brief snippet of the code.
What is the best way to fix it? Enabling memory device or something else?
he case Memory Device is the right choice, why enabling the support (#define GUI_SUPPORT_MEMDEV 1) and adding WM_CF_MEMDEV flag to window and textbox creation don't change anything, behaviour as in pictures still persist. Is there a way to undestand if memory device are used? Also at runtime while debugging.