STemWin problem with GUI_Exec function

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

  • STemWin problem with GUI_Exec function

    Hello,

    I'm facing with very strange problem using STemWin library.
    I don't know if this is problem on my side, on STemWin (ST) side or directly from Segger, so I'm asking here also. I've also make the same post on ST forum, but no success for now.

    What's my idea.
    I have a graph with (for now) one curve on it and I'm trying to update it every 100ms.
    On STM32F429-Discovery using driver provided from ST I see flickering and my idea is that LCD shows LTDC layer 2, but EMWIN draws everything on layer1 on LCD which is hidden.
    Then, after each emwin operation is done, I would copy content from layer1 (EMWIN drawing layer) to layer2 (user visible layer) to avoid flickering.

    It works what I wanna do, but no in a way I wanna do.
    My idea is, to copy layers only if there were pending tasks done with emwin using GUI_Exec function.

    According to the emWin documentation, GUI_Exec returns 1 if there were tasks to do.
    So when GUI_Exec() returns non-zero value, I would then also copy layer1 to layer2.

    But here is problem with GUI_Exec function. This function returns non-zero value only FIRST time when I call it. I call it first time after I set my graph.
    Each next time, function successfully does its job with updating everything, but it does not return non-zero value anymore so I can't know if there were pending tasks done to copy layers.

    Has this something to do with ST's implementation or is this Segger related problem?

    PS: STemWin 5.26 is in use without any Cube software. On version 5.22 I got the same behavior.

    Below is my example how I use this (comments included where I had problem):
    pastebin.com/FFrEnHK0

    For some reason C code was not properly shown on this site, so I used pastebin.


    Thanks for any help you can provide here.

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

  • I'm responding to myself.

    Unlike other commands, in my situation GRAPH_DATA_YT_AddValue function also redraws my graph so GUI_Exec() has nothing to do.

    Can we avoid somehow to this behavior?

    I would like to do changes ONLY by calling GUI_Exec.

    Another question I have. Is it possible to force all window redraw? Is there any function which can do that so GUI will redraw everything again?

    Thanks for answer.
  • Hello,

    What I would like to know is, when stepping through the code. Does the function GUI_DATA_YT_AddValue() immediately draw on the screen? So, did the content of the frame buffer change after just stepping over this function?

    Your also calls functions which are not defined in emWin. Please verify those function do not call GUI_Delay(), GUI_Exec() or WM_Exec().

    Best regards,
    Adrian
  • Ok, it was my mistake about the fact that AddData function updates graph. It does not it, I've tested again.

    But, function which I have TM_EMWIN_Exec() currently does "return GUI_Exec()" and it does never return non-zero value, but graph is actually updated using GUI_Exec function.

    Why it does not return non-zero? Is this EMWIN bug?

    I can send you entire project for Keil uVision in private email if you want to test this. If you have F429-Discovery board you can try it. Drivers are written for this board.

    Edit: Project is available for download here: stm32f4-discovery.com/wp-conte…MWIN_GUI_Exec_Problem.rar

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

  • I understand you,

    but the problem is that it never returns non-zero. Only first time when I call it first time after I create graph widget.
    When I add new points to graph using AddData function for graph, GUI_Exec redraws everything, but non-zero value is not returned when it should be, at least documentation says that.

    Have a nice day,
    Tilen
  • Hello Tilen,

    I understand. Thank you. This makes sense to me. In your code I see the following function call:

    hData = GRAPH_DATA_YT_Create(GUI_DARKGREEN, 500, 0, 20);

    Please note that the parameter "NumItems" is related to the data pointer. In your case 0 is passed as pData, so there is actually no data to add to the data object. Therefor 0 can be passed as NumItems, too.

    Further the MaxNumItems are set to 500. This is not a problem, but the GRAPH widget has a width of 320, only. The first values which are added to the data object, might not become visible at once. I would recommend you to try setting MaxNumItems to 200. The data should be displayed immediately. Please note that adding data will not make the Window Manager redraw the GRAPH widget as the data is added to the part of the data object which lies outside the borders of the GRAPH widget.

    For detailed information, please refer to the function descriptions of the GRAPH widget API functions in the section "Widgets" -> "GRAPH: Graph widget" in the emWin user manual.

    Best regards,
    Adrian