Memory device seem not working

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Memory device seem not working

      Source Code

      1. /**
      2. * Keys manager function
      3. */
      4. static void manage_keys( int key_event )
      5. {
      6. char int_to_string[32];
      7. if( key_event == key_rotate_cw )
      8. {
      9. value_to_display++;
      10. }
      11. else if( key_event == key_rotate_ccw )
      12. {
      13. value_to_display--;
      14. }
      15. snprintf( int_to_string, sizeof(int_to_string), "%d", value_to_display );
      16. TEXT_SetText( h_Text, int_to_string );
      17. }
      18. /**
      19. * Window callback
      20. */
      21. static void callback_Window( WM_MESSAGE *pMsg )
      22. {
      23. int sender_Id, notify_Code; // Do actions according to event message
      24. switch( pMsg->MsgId )
      25. {
      26. case WM_PAINT:
      27. GUI_Clear();
      28. break;
      29. case WM_NOTIFY_PARENT:
      30. // Get id of the window/widget has sent the message
      31. sender_Id = WM_GetId( pMsg->hWinSrc );
      32. // Get notification code
      33. notify_Code = pMsg->Data.v; [...]
      34. break;
      35. case WM_KEY:
      36. // Key event received
      37. manage_keys( ((WM_KEY_INFO*)pMsg->Data.p)->Key );
      38. break;
      39. default:
      40. // Default event process
      41. WM_DefaultProc( pMsg );
      42. break;
      43. }
      44. }
      45. /**
      46. * Main
      47. */
      48. // Create window
      49. h_Window = WM_CreateWindow( x, y, w, h, WM_CF_SHOW, NULL, 0 );
      50. WM_SetCallback( h_Window, callback_Window );
      51. // Create textbox to show value
      52. h_Text = TEXT_CreateEx( x_txt, y_txt, w_txt, h_txt, h_Window, WM_CF_SHOW, 0, txt_id, "" );
      Display All
      Hello everybody,

      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.
      Thanks
      Andrea