Monday, May 21st 2018, 7:08am UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

himsha

Beginner

Date of registration: Feb 21st 2018

Posts: 12

1

Tuesday, February 27th 2018, 9:44am

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 ****************************/

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 584

2

Thursday, March 1st 2018, 3:01pm

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

himsha

Beginner

Date of registration: Feb 21st 2018

Posts: 12

3

Tuesday, March 6th 2018, 2:19pm

hi sven,

i had found the issue, it's with fsmc bus timing i had decrease it. increasing make my issue resolve.

thanks.