display hang

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

    • display hang

      hi, i had created one editbox as child window, and displaying some float value. after 5 minutes controller get hang what would be the issue?[/size]




      #include "main.h"

      #define EDIT_MAX_LEN 200
      #define EDIT_ALIGN (GUI_TA_HCENTER | GUI_TA_VCENTER)
      #define RADIUS 10
      #define BORDER 4


      /*********************************************************************
      *
      * _OnPaint
      */
      static void _OnPaint(EDIT_Handle hEdit) {
      GUI_RECT Rect = {0};
      char acText[EDIT_MAX_LEN + 1];
      GUI_COLOR Color;
      const GUI_FONT * pFont;
      GUI_COLOR BkColor;
      int MaxLen;

      Rect.x1 = WM_GetWindowSizeX(hEdit) - 1;
      Rect.y1 = WM_GetWindowSizeY(hEdit) - 1;
      BkColor = EDIT_GetBkColor(hEdit, 0);
      GUI_SetColor(BkColor);
      GUI_FillRoundedRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1, RADIUS);
      MaxLen = EDIT_GetNumChars(hEdit) + 1;
      if (MaxLen) {
      pFont = EDIT_GetFont(hEdit);
      EDIT_GetText(hEdit, acText, MaxLen);
      Color = EDIT_GetTextColor(hEdit, 0);
      GUI_SetColor(Color);
      GUI_SetBkColor(BkColor);
      Rect.x0 = BORDER;
      Rect.y0 = BORDER;
      Rect.x1 -= BORDER;
      Rect.y1 -= BORDER;
      GUI_SetFont(pFont);
      GUI_DispStringInRectWrap(acText, &Rect, EDIT_ALIGN, GUI_WRAPMODE_WORD);
      }
      }

      /*********************************************************************
      *
      * _cbEdit
      */
      static void _cbEdit(WM_MESSAGE * pMsg) {
      switch (pMsg->MsgId) {
      case WM_CREATE:
      EDIT_SetTextAlign(pMsg->hWin, EDIT_ALIGN);
      break;
      case WM_PAINT:
      _OnPaint(pMsg->hWin);
      break;
      default:
      EDIT_Callback(pMsg);
      break;
      }
      }


      /*********************************************************************
      *
      * MainTask
      */
      void vGeneralFunction_StartTest(void) {
      WM_HWIN hWin;
      GUI_Init();

      hWin = EDIT_CreateAsChild(10, 10, 400, 150, WM_HBKWIN, 2, WM_CF_SHOW, EDIT_MAX_LEN);
      WM_SetHasTrans(hWin);
      WM_SetCallback(hWin, _cbEdit);
      EDIT_SetFont (hWin, &GUI_FontArial100);
      EDIT_SetText (hWin, "Hello");

      while (1) {
      if (Flag500ms==SET){
      fValue = fValue + 0.5;
      vGeneralFunction_FloatToString(fValue, &strGen[0], 2);
      EDIT_SetText (hWin, strGen);
      Flag500ms = RESET;
      }
      GUI_Delay(25);
      }
      }

      /*************************** End of file ****************************/
    • Hi,

      I can't say what causes this issue. I gave it a try and let run your code (except vGeneralFunction_FloatToString()) but it is running without any problems.

      Did you implemented the functions GUI_X_Delay() and GUI_X_GetTime() properly?

      GUI_X_GetTime() should return a timer variable which gets incremented each millisecond. You can set up either a hardware timer (or SystickTimer on Cortex M) or use the timer API of an operating system.

      GUI_X_Delay() should wait for the given time in milliseconds.

      If GUI_X_GetTime() is not implemented correctly emWin can hang in GUI_Delay() waiting for ever...

      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.