Flickering Issue with TEXT_SetText()

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

  • Flickering Issue with TEXT_SetText()

    Hi,

    I have created a dialog with a text widget and used the following code to update the text constantly.
    However, I noticed some flickers occasionally on the text.
    In another word, at some point of the execution, the text is not being displayed at all.

    What might be causing the problem? Insufficient memory issue?


    C Source Code

    1. while(1)
    2. {
    3. TEXT_SetText(...);
    4. GUI_Delay(100);
    5. }

    Please assist, thank you.

    The post was edited 2 times, last by chiasyan ().

  • Hello,

    In your code the text is set every 100ms. It is sufficient to set the text once in case it does not change. In case there is a certain event which should cause the text to change, you might want to react to the according event (e.g. button click) from within a callback function.

    Anyhow the correction of your code in the first place should be the following:

    C Source Code

    1. TEXT_SetText(...);
    2. while(1) {
    3. GUI_Delay(100);
    4. }

    Best regards,
    Adrian
  • Hi Adrian,

    Thank you for your reply. Just to clarify some doubts,

    Source Code

    1. TEXT_SetText(...);
    2. while(1)
    3. {
    4. GUI_Delay(100);
    5. }

    1. Whenever a new event is raised after executing the above code, I should just call the "TEXT_SetText(...)" to update the display, right?

    2. Before your reply, I implemented the code as follow: (update text every 1 second, in my application, I need to display value from a variable very constantly)

    Source Code

    1. while(1)
    2. {
    3. TEXT_SetText(...);
    4. GUI_Delay(1000);
    5. }
    eg. displaying the text from "000000", "111111", ... to "999999" and repeat. However, sometimes the displayed text is incomplete (only 2 or 3 or 4 digits are shown, instead of 6).

    3. Should I use text widget in the first place for high frequency update application like this?

    4. I am using NXP emWIN pre-compiled library with FreeRTOS, is the library works under RTOS environment? (ST provide separate libraries for OS and Non-OS)

    Please assist, thank you.

    The post was edited 1 time, last by chiasyan ().

  • Hello,

    It is ok to do constant updates in the infinite loop in case it is intended to be done regularly. Nevertheless I would recommend using the timer functionality (WM_CreateTimer()) to update the TEXT widget for cleanliness.

    However, sometimes the displayed text is incomplete (only 2 or 3 or 4 digits are shown, instead of 6).

    This sounds like a problem caused by multitasking. There can't be any other reason for emWin to display an incomplete text. I would recommend to contact NXP support regarding this issue. Please note that we have an agreement with them that includes their right to provide our emWin software as library and their obligation to support their customers.

    However we can offer you a support contract or the sources of our software which entitles you to receive direct support from SEGGER. If this is of interest for you, please contact info@segger.com.

    Best regards,
    Adrian
  • Flickering Dialog After Running for a While

    Hi,

    I have created few Dialogs and displayed it in sequence every few seconds (dialog 1 -> dialog 2 -> .... -> repeat)

    I am using WM_ShowWindow() and WM_HideWindow() alternately to display respective dialog.

    I constantly update a TEXT widget in Dialog 1, but after running for a while, the TEXT flickering is noticeable (in fact, other widgets in Dialog 1 is flickering as well)

    Dialog 2 and the rest are displayed just fine (no update, just display).

    What might be causing this phenomenon? Insufficient memory?

    Please assist. Thank you.

    tag: flicker flickering dialog wm

    The post was edited 1 time, last by chiasyan ().

  • Hi Adrian,

    Yes, I tried using the timers but that is not the source of problem. (It is a good way for updating the display though, thank for the info)

    I traced it back to FreeRTOS task priority.

    Previously, I assigned the EMWIN task at lower priority in FreeRTOS and the situation as mentioned before, sequence as below:

    1. RUNNING (once in a while, updating text is incomplete OR entire updating text is not shown at all) ?(
    2. FLICKERING (all the widgets) 8|
    3. NO UPDATE (window/dialog and widgets are still displayed, but no longer updated) ;(

    Then, I tried with higher priority and the program is running so far with no flickering. (I will let it runs for some time and look for the outcome later)

    :( HOWEVER once in a while, the entire updating text is still not being shown. :(

    My doubts:
    1. why lower priority task is causing the problem?
    2. IF memory is the issue, could there be any operation in GUI main loop could not handle task switching under low priority circumstance? (therefore do not manage to update the text in time, leaving it empty??)
    3. might as well be caused by FreeRTOS configurations? (will look into it)

    Keep on digging. 8)

    Thank you.
  • Hi Chiasyan,

    for me it seems that the repainting is not performed in time.
    To force the control to repaint WM_Update() might help.

    For avoiding flickering in general you can use WM_EnableMemdev()
    on the dialog or on the control. This will use a memory device context
    for repainting.

    Hope this helps,
    Stefan.
  • Hi,

    Just some update.

    The WM_Update() may seems to reduce the occurrence of incomplete text but could not eliminate the issue.

    I need to assign emWin task at higher priority than the other tasks to avoid incomplete text issue.

    Even if there is a task created at the same priority level as emWin task, incomplete text would be noticed, at very very low probability.

    Thank you.