sawtooth issue

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

    • sawtooth issue

      Hi,
      I am new for emwin. My platform is RT1052, I encounter an issue when using GUI_DrawCircle and GUI_DrawLine, Attached is the pic, sawtooth can be seen. It is normal when I display string or rect, and also display Widgets very well. What kind of problem can cause this kind of issue? I supposed the problem is likely to be in the hardware driver, but I do not know how to address it. Thanks a lot for your support.
      Following is the code.

      void MainTask(void)
      {
      GUI_Init();
      WM_MULTIBUF_Enable(1);
      GUI_SetBkColor(GUI_BLUE);
      GUI_Clear();
      GUI_SetPenSize(10);
      GUI_FillCircle (100, 60, 50);
      GUI_DrawCircle (250, 100, 50);
      GUI_DrawLine(200,200,300,350);
      GUI_DrawLine(400,200,200,350);
      GUI_FillRect(100,400,300,450);
      GUI_SetFont(GUI_FONT_32_1);
      GUI_DispStringHCenterAt("ABCDEFG", 100, 320);
      while (1);
      }
      Images
      • EMWIN_ISSUE.jpg

        167.82 kB, 1,443×1,080, viewed 280 times
    • Hi,

      this is probably a cache problem. The attached LCDConf.c should fix your problem. The relevant function calls that clear the cache are SCB_CleanInvalidateDCache() and GUI_DCACHE_SetClearCacheHook(_ClearCache).

      Also, note that WM_MULTIBUF_Enable() only enables automatic multi-buffering when using the Window Manager. For 2D graphic operations (such as drawing circles etc.) GUI_MULTIBUF_Begin() and GUI_MULTIBUF_End() have to be used to switch between the buffers.

      Best regards,

      Florian
      Files
      • LCDConf.zip

        (4.36 kB, downloaded 185 times, last: )
      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, Florian
      Thanks a lot for your fast response. This issue can be solved by 2 method. your reminder about GUI_MULTIBUF_Begin() use is really help. Could you please help to explain why the following ways can work?

      The first solution is add GUI_MULTIBUF_Begin() and GUI_MULTIBUF_End();
      void MainTask(void)
      {
      GUI_Init();
      GUI_SetBkColor(GUI_BLUE);
      GUI_Clear();
      GUI_MULTIBUF_Begin();
      GUI_SetPenSize(10);
      GUI_FillCircle (100, 60, 50);
      GUI_DrawCircle (250, 100, 50);
      GUI_DrawLine(200,200,300,350);
      GUI_DrawLine(400,200,200,350);
      GUI_FillRect(100,400,300,450);
      GUI_SetFont(GUI_FONT_32_1);
      GUI_DispStringHCenterAt("ABCDEFG", 100, 320);
      GUI_MULTIBUF_End();
      while (1);
      }

      The second methold is add GUI_Exec() in the while loop;
      void MainTask(void)
      {
      GUI_Init();
      GUI_SetBkColor(GUI_BLUE);
      GUI_Clear();
      GUI_SetPenSize(10);
      GUI_FillCircle (100, 60, 50);
      GUI_DrawCircle (250, 100, 50);
      GUI_DrawLine(200,200,300,350);
      GUI_DrawLine(400,200,200,350);
      GUI_FillRect(100,400,300,450);
      GUI_SetFont(GUI_FONT_32_1);
      GUI_DispStringHCenterAt("ABCDEFG", 100, 320);
      while (1){
      GUI_Exec();
      }
      }