Background and font colors disorder in multitasking

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

  • Background and font colors disorder in multitasking

    I port Touch_Calibration sample with keil's RTX in my board and find the problem described above,so i rewrite the Touch_Calibration sample in the emwin simulator with multitasking.

    The problem is that one task initialize its Background and font colors,and they change if the task schedules out and
    schedules in once again. it is really so difficult to trace the issue because stemwin is a precompiled lib and no c code. i spent a week to find out the reason with some help.


    The attach file can demonstrate the problem and also be solved with adding a few code: add GUI_Clear(); after GUI_Init(); in the entry function MainTask.

    GUI_pContext and _CurrentTaskNo import the bug.
    Here GUITASK_SetMaxTask(n) in GUICONF.c, n must be lager than 2 in this sample however only 2 GUI_Context will be used because of debug assert.
    GUI_pContext will be valid after GUI_Init() however it becomes useless in multitasking because no task can use it.







    Files
  • Hello

    Keil's emwin lib is compiled with multitasking in default, stemwin seperate into 2 aspects. i do not have the wrong choice

    you can do some improvement in that issue and others would not fall down at the same place twice. :)


    Best regards,
    myxiaonia
  • Hello Adrian

    stemwin contains 2 libs differentiating with postfix -OS

    I port the official sample Touch_Calibtrate to my board ,it works well. After that i just want to watch the physical touch positon so i add GUI_DISP in the touch thread,then i found the issue.
    i rewrite the sample and port it to simulator and the issue is still here.

    you can add the attch file to the simulator with EMWIN524 and see that.
    If i add a GUI_Clear routine in the MainTask, it seems to be right... Here GUI_Clear can be replaced with GUI_LOCK(); GUI_UNLOCK();
    i am confused why it do So ???


    Best regards,
    myxiaonia


    [list][/list]

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

  • Hello Adrian


    If emwin is compatible with os, GUI_Init must be called in a task/thread because some os-dependent routines.
    GUI_pContext should point to one of the GUI_Context contained in _pSaved but not.
    GUI_Init calls GUITASK_CopyContext pretending it is independent of any tasks.




    Best regards,
    myxiaonia
  • Hello Adrian

    Here are 2 jpg files, 1.jpg is for GUI_Clear commented and 2.jpg is for GUI_Clear uncommented in function MainTask();
    They are different.

    Best regards,
    myxiaonia
    Images
    • 1.JPG

      3.23 kB, 319×240, viewed 752 times
    • 2.JPG

      7.22 kB, 320×240, viewed 771 times
  • Hello myxiaonia,

    The text in the middle of the screen is display using the transparent text mode (GUI_TM_TRANS). The text in the upper left corne is not. So, if the background is black and the foreground color is also black, there is no visible effect.

    Best regards,
    Adrian
  • Hello Adrian

    Excuse me for the improper sample. emwin api uses GUI_LOCK() to ensure its own GUI_Context, so the sample above is not credible.

    Here is a new test considering this situation.


    Best regards,
    myxiaonia
    Images
    • 1.JPG

      158 kB, 1,357×649, viewed 808 times
    • 2.JPG

      142.92 kB, 1,358×588, viewed 790 times