Issue with GUI_MEMDEV_FadeInWindow

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

  • Issue with GUI_MEMDEV_FadeInWindow

    Hello.

    I need help, :
    I have two windows, that take all the screen , and I want to switch from one to the other one using the FadeInWindows. Unfortunately, It doesn't work.
    I tried the sample GUI_MEMDEV_FadeInWindow on my board, and it works.

    Here is my code :

    WM_SetCreateFlags(WM_CF_MEMDEV);
    hWin2 = CreateFenetre2();
    GUI_Delay(1000);
    hWin1 = CreateFenetre1();
    GUI_MEMDEV_FadeInWindow(hWin1, 500);
    GUI_Delay(1000);


    Each windows is composed with a Windows and a image.


    Thanks in advance.

    Regards.
  • Hello,

    try the code below:

    C Source Code

    1. #include "DIALOG.h"
    2. /*********************************************************************
    3. *
    4. * _cbWin
    5. */
    6. static void _cbWin(WM_MESSAGE * pMsg) {
    7. GUI_RECT Rect;
    8. switch (pMsg->MsgId) {
    9. case WM_PAINT:
    10. //
    11. // Handle the look of the window
    12. //
    13. GUI_SetBkColor(GUI_RED);
    14. GUI_Clear();
    15. break;
    16. default:
    17. //
    18. // Any other messages are getting handled by the default callback
    19. //
    20. WM_DefaultProc(pMsg);
    21. break;
    22. }
    23. }
    24. /*********************************************************************
    25. *
    26. * _cbBk
    27. */
    28. static void _cbBk(WM_MESSAGE * pMsg) {
    29. int xSize;
    30. int ySize;
    31. switch (pMsg->MsgId) {
    32. case WM_PAINT:
    33. //
    34. // Draw a gradient into the background
    35. //
    36. xSize = LCD_GetXSize();
    37. ySize = LCD_GetYSize();
    38. GUI_DrawGradientH(0, 0, xSize, ySize, GUI_BLACK, GUI_GRAY);
    39. break;
    40. default:
    41. WM_DefaultProc(pMsg);
    42. break;
    43. }
    44. }
    45. /*********************************************************************
    46. *
    47. * Public code
    48. *
    49. **********************************************************************
    50. */
    51. /*********************************************************************
    52. *
    53. * MainTask()
    54. */
    55. void MainTask(void);
    56. void MainTask(void) {
    57. WM_HWIN hWin;
    58. GUI_Init();
    59. WM_SetCallback(WM_HBKWIN, _cbBk); // Set a callback for the desktop window
    60. hWin = WM_CreateWindow(10, 10, 50 ,50, WM_CF_SHOW, _cbWin, 0); // Create the window
    61. while(1) {
    62. GUI_MEMDEV_FadeOutWindow(hWin, 500);
    63. GUI_Delay(500);
    64. GUI_MEMDEV_FadeInWindow(hWin, 500);
    65. GUI_Delay(500);
    66. }
    67. }
    Display All


    Regards,
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hello.
    Thanks for your answer,
    In fact I think I see the problem, if I reduce the size of my windows, it works.
    By default my two windows are 480x272 in 24bits colors.

    If I set my second windows to 100x100 it works.
    So I have a question, what is the RAM size necessary to be able to perform my Fade In for a size of 480x272 ?

    Thanks a lot for your support.
  • Hi,

    one more thing.
    What is the amount of memory you have spend emWin?

    If there is not memory available it won't work. This would explain why it works with a smaller window.

    Regards,
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi,

    This depends very much on your application. Take a look into the manual at chapter Chapter 37 'Performance and Resource Usage'. There is an explanation about how much resources the diffrent modules of emWin do require.

    2MB should be enough and most applications will work with this.

    EDIT: There are also functions to get the number of used bytes and the number of free bytes.
    GUI_ALLOC_GetNumFreeBytes() and GUI_ALLOC_GetNumUsedBytes()

    Regards,
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.