Jump to content

Not able to get all widgets to appear on the lcd?


SJP

Recommended Posts

Hi all, I stumbled across uGFX recently and I am trying to get it working on the STM32F7 Discovery board without an RTOS. I have setup the project and have been able to get the widgets displayed on the LCD screen, but I am not seeing all the widgets. Its only showing first three out the six or seven widgets, and when I comment out the section of the code for one of the first three widgets, the next widget in line gets displayed along with the other two.

 

 I am using uGFX Studio application to make the sample GUI. The GUI has one container widget which is used as a parent for several widgets and there is one 'radiobutton' widget outside that container. Thank you for the help.

 

GUI.c

/******************************************************************************/
/* This file has been generated by the uGFX-Studio                            */
/*                                                                            */
/* http://ugfx.org                                                            */
/******************************************************************************/

#include "colors.h"
#include "widgetstyles.h"
#include "gui.h"

// GListeners
GListener gl;

// GHandles
GHandle ghContainerPage0;
GHandle ghContainer1;
GHandle ghCheckbox1;
GHandle ghButton2;
GHandle ghSlider1;
GHandle ghTextedit2;
GHandle ghRadiobutton1;
GHandle ghSlider2;

// Fonts
font_t dejavu_sans_16;

static void createPagePage0(void)
{
	GWidgetInit wi;
	gwinWidgetClearInit(&wi);


	// create container widget: ghContainerPage0
	wi.g.show = FALSE;
	wi.g.x = ;
	wi.g.y = ;
	wi.g.width = 480;
	wi.g.height = 272;
	wi.g.parent = ;
	wi.text = "Container";
	wi.customDraw = ;
	wi.customParam = ;
	wi.customStyle = ;
	ghContainerPage0 = gwinContainerCreate(, &wi, );

	// create container widget: ghContainer1
	wi.g.show = TRUE;
	wi.g.x = 10;
	wi.g.y = 110;
	wi.g.width = 450;
	wi.g.height = 130;
	wi.g.parent = ghContainerPage0;
	wi.text = "Container1";
	wi.customDraw = gwinContainerDraw_Std;
	wi.customParam = ;
	wi.customStyle = ;
	ghContainer1 = gwinContainerCreate(, &wi, GWIN_CONTAINER_BORDER);

	// create checkbox widget: ghCheckbox1
	wi.g.show = TRUE;
	wi.g.x = 20;
	wi.g.y = 40;
	wi.g.width = 120;
	wi.g.height = 20;
	wi.g.parent = ghContainer1;
	wi.text = "Checkbox1";
	wi.customDraw = gwinCheckboxDraw_CheckOnLeft;
	wi.customParam = ;
	wi.customStyle = ;
	ghCheckbox1 = gwinCheckboxCreate(, &wi);
	gwinCheckboxCheck(ghCheckbox1, FALSE);

	// create button widget: ghButton2
	wi.g.show = TRUE;
	wi.g.x = 40;
	wi.g.y = 70;
	wi.g.width = 120;
	wi.g.height = 20;
	wi.g.parent = ghContainer1;
	wi.text = "Button2";
	wi.customDraw = gwinButtonDraw_Normal;
	wi.customParam = ;
	wi.customStyle = ;
	ghButton2 = gwinButtonCreate(, &wi);

	// create button widget: ghSlider1
	wi.g.show = TRUE;
	wi.g.x = 180;
	wi.g.y = 20;
	wi.g.width = 200;
	wi.g.height = 20;
	wi.g.parent = ghContainer1;
	wi.text = "Slider1";
	wi.customDraw = gwinSliderDraw_Std;
	wi.customParam = ;
	wi.customStyle = ;
	ghSlider1 = gwinSliderCreate(, &wi);
	gwinSliderSetRange(ghSlider1, , 100);
	gwinSliderSetPosition(ghSlider1, 35);
	gwinSetColor(ghSlider1, black_studio);
	gwinSetBgColor(ghSlider1, white_studio);

	// Create textedit widget: ghTextedit2
	wi.g.show = TRUE;
	wi.g.x = 220;
	wi.g.y = 80;
	wi.g.width = 120;
	wi.g.height = 20;
	wi.g.parent = ghContainer1;
	wi.text = "TextEdit2";
	wi.customDraw = gwinTexteditDefaultDraw;
	wi.customParam = ;
	wi.customStyle = ;
	ghTextedit2 = gwinTexteditCreate(, &wi, );

	// create radiobutton widget: ghRadiobutton1
	wi.g.show = TRUE;
	wi.g.x = 80;
	wi.g.y = 40;
	wi.g.width = 120;
	wi.g.height = 20;
	wi.g.parent = ghContainerPage0;
	wi.text = "RadioButton1";
	wi.customDraw = gwinRadioDraw_Radio;
	wi.customParam = ;
	wi.customStyle = ;
	ghRadiobutton1 = gwinRadioCreate(, &wi, );
	gwinSetColor(ghRadiobutton1, black_studio);
	gwinSetBgColor(ghRadiobutton1, white_studio);
	gwinRadioPress(ghRadiobutton1);


	// create button widget: ghSlider2
	wi.g.show = TRUE;
	wi.g.x = ;
	wi.g.y = ;
	wi.g.width = 200;
	wi.g.height = 20;
	wi.g.parent = ghContainer1;
	wi.text = "Slider2";
	wi.customDraw = gwinSliderDraw_Std;
	wi.customParam = ;
	wi.customStyle = ;
	ghSlider2 = gwinSliderCreate(, &wi);
	gwinSliderSetRange(ghSlider2, , 100);
	gwinSliderSetPosition(ghSlider2, 35);
	gwinSetColor(ghSlider2, black_studio);
	gwinSetBgColor(ghSlider2, white_studio);
}

void guiShowPage(unsigned pageIndex)
{
	// Hide all pages
	gwinHide(ghContainerPage0);

	// Show page selected page
	switch (pageIndex) {
	case :
		gwinShow(ghContainerPage0);
		break;

	default:
		break;
	}
}

void guiCreate(void)
{
	GWidgetInit wi;

	// Prepare fonts
	dejavu_sans_16 = gdispOpenFont("DejaVuSans16");

	// Prepare images

	// GWIN settings
	gwinWidgetClearInit(&wi);
	gwinSetDefaultFont(dejavu_sans_16);
	gwinSetDefaultStyle(&white, FALSE);
	gwinSetDefaultColor(black_studio);
	gwinSetDefaultBgColor(white_studio);

	// Create all the display pages
	createPagePage0();

	// Select the default display page
	guiShowPage();

}

void guiEventLoop(void)
{
	GEvent* pe;

	while (1) {
		// Get an event
		pe = geventEventWait(&gl, );
		switch (pe->type) {
		}

	}
}

 

uGFX config file

/**
 * This file has a different license to the rest of the uGFX system.
 * You can copy, modify and distribute this file as you see fit.
 * You do not need to publish your source modifications to this file.
 * The only thing you are not permitted to do is to relicense it
 * under a different license.
 */

/**
 * Copy this file into your project directory and rename it as gfxconf.h
 * Edit your copy to turn on the uGFX features you want to use.
 * The values below are the defaults.
 *
 * Only remove the comments from lines where you want to change the
 * default value. This allows definitions to be included from
 * driver makefiles when required and provides the best future
 * compatibility for your project.
 *
 * Please use spaces instead of tabs in this file.
 */

#ifndef _GFXCONF_H
#define _GFXCONF_H


///////////////////////////////////////////////////////////////////////////
// GOS - One of these must be defined, preferably in your Makefile       //
///////////////////////////////////////////////////////////////////////////
//#define GFX_USE_OS_CHIBIOS                           FALSE
//#define GFX_USE_OS_FREERTOS                          FALSE
//    #define GFX_FREERTOS_USE_TRACE                   FALSE
//#define GFX_USE_OS_CMSIS                             FALSE
//#define GFX_USE_OS_KEIL                             TRUE
//#define GFX_USE_OS_WIN32                             FALSE
//#define GFX_USE_OS_LINUX                             FALSE
//#define GFX_USE_OS_OSX                               FALSE
//#define GFX_USE_OS_ECOS                              FALSE
//#define GFX_USE_OS_RAWRTOS                           TRUE
#define GFX_USE_OS_RAW32                             TRUE
//    #define INTERRUPTS_OFF()                         optional_code
//    #define INTERRUPTS_ON()                          optional_code

// Options that (should where relevant) apply to all operating systems
//    #define GFX_COMPILER                             GFX_COMPILER_KEIL
//    #define GFX_CPU                                  GFX_CPU_CORTEX_M7_FP
//	#define GFX_CPU_ENDIAN                           GFX_CPU_ENDIAN_LITTLE
//    #define GFX_OS_HEAP_SIZE                         20480
//    #define GFX_OS_NO_INIT                           TRUE
//    #define GFX_OS_INIT_NO_WARNING                   TRUE
//    #define GFX_OS_EXTRA_INIT_FUNCTION               myOSInitRoutine
//    #define GFX_OS_EXTRA_DEINIT_FUNCTION             myOSDeInitRoutine

/********************************************************/
/* GDISP stuff                                          */
/********************************************************/
#define GFX_USE_GDISP TRUE

#define GDISP_NEED_CONTROL TRUE
#define GDISP_NEED_VALIDATION TRUE
#define GDISP_NEED_CLIP TRUE
#define GDISP_NEED_ARC FALSE
#define GDISP_NEED_CONVEX_POLYGON FALSE
#define GDISP_NEED_IMAGE FALSE
#define GDISP_NEED_STARTUP_LOGO FALSE
#define GDISP_NEED_CIRCLE TRUE
#define GDISP_NEED_MULTITHREAD TRUE
#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_0
#define GDISP_STARTUP_COLOR White


/********************************************************/
/* Font stuff                                           */
/********************************************************/
#define GDISP_NEED_TEXT TRUE
#define GDISP_NEED_ANTIALIAS TRUE
#define GDISP_NEED_TEXT_KERNING FALSE
#define GDISP_NEED_UTF8 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS20_AA TRUE


/********************************************************/
/* GWIN stuff                                           */
/********************************************************/
#define GFX_USE_GWIN TRUE

#define GWIN_FOCUS_HIGHLIGHT_WIDTH 0

#define GWIN_NEED_WINDOWMANAGER TRUE
    #define GWIN_REDRAW_IMMEDIATE TRUE
    #define GWIN_REDRAW_SINGLEOP TRUE

#define GWIN_NEED_WIDGET TRUE
    #define GWIN_NEED_LABEL TRUE
    #define GWIN_NEED_CHECKBOX TRUE
    #define GWIN_NEED_BUTTON TRUE
        #define GWIN_BUTTON_LAZY_RELEASE FALSE
    #define GWIN_NEED_RADIO TRUE
    #define GWIN_NEED_SLIDER TRUE
    #define GWIN_NEED_LIST TRUE
        #define GWIN_NEED_LIST_IMAGES FALSE
    #define GWIN_FLAT_STYLING TRUE

    #define GWIN_NEED_KEYBOARD TRUE
    #define GWIN_NEED_TEXTEDIT TRUE
#define GWIN_NEED_CONTAINERS TRUE
    #define GWIN_NEED_CONTAINER TRUE
    #define GWIN_NEED_FRAME FALSE
    #define GWIN_NEED_TABSET FALSE


/********************************************************/
/* GTIMER stuff                                         */
/********************************************************/
#define GFX_USE_GTIMER TRUE

#define GTIMER_THREAD_PRIORITY NORMAL_PRIORITY
#define GTIMER_THREAD_WORKAREA_SIZE 2048


/********************************************************/
/* GINPUT stuff                                         */
/********************************************************/
#define GFX_USE_GINPUT TRUE

#define GINPUT_NEED_MOUSE TRUE
#define GINPUT_TOUCH_USER_CALIBRATION_LOAD FALSE


/********************************************************/
/* GEVENT stuff                                         */
/********************************************************/
#define GFX_USE_GEVENT TRUE

#define GEVENT_ASSERT_NO_RESOURCE FALSE
#define GEVENT_MAXIMUM_SIZE 32
#define GEVENT_MAX_SOURCE_LISTENERS 32



/********************************************************/
/* GEVENT stuff                                         */
/********************************************************/
#define GFX_USE_GQUEUE TRUE

#define GQUEUE_NEED_ASYNC TRUE


/********************************************************/
/* GFILE stuff                                          */
/********************************************************/
#define GFX_USE_GFILE FALSE

#define GFILE_NEED_NATIVEFS FALSE
#define GFILE_NEED_ROMFS TRUE


#endif /* _GFXCONF_H */

 

Link to comment
Share on other sites

Hello and welcome to the community!

We have discussed this and to be honest we have no idea how this could happen. We have never encountered any issue like that ever before. Of course we want to track it down and fix it as quickly as possible :)
For that matter, can you please provide us with a copy of your project (attach a ZIP file!) so we can try to reproduce the problem? It would also help if you could provide a copy of your µGFX-Studio project. Please make sure that you also include all the images and font files that you use so we can recreate the project. Future versions of the µGFX-Studio will come with an export tool that will automatically copy all the required files and generate an archive. Right now this has to happen manually. Sorry for the inconvenience.

Please do not hesitate to ask if you have any other questions. We are happy to help wherever we can!

Link to comment
Share on other sites

We checked your µGFX-Studio files and everything looks good there. I assume that you are able to see all widgets in the preview that you can generate by clicking the green arrow in the toolbar - is that correct?

Sadly we're not able to compile and test your project as we lack the required tools and hardware. We took a look at the project and we couldn't spot anything that's obviously wrong. Can you please check the values of the GHandles that are returned by all the gwinXxxCreate() functions in the guiCreate() function? If some of them are NULL this might indicate a lack of memory which would explain why you only see some of the widgets. You can find more information regarding the memory management on bare metal systems here: http://wiki.ugfx.org/index.php/BareMetal#Built-in_memory_manager
If that doesn't help I'd recommend you to start off a clean project that doesn't do anything but flashing an LED and then add the µGFX GUI. It seems like your project still contains unrelated code for manually handling the touchscreen and so on.

A couple of general remarks:

I'm sorry that we can't give you a guide to success. We have never encountered this problem before.
Please don't hesitate to ask if you have any other questions. We are happy to help wherever we can.

Link to comment
Share on other sites

  • 2 weeks later...

Hey Joel, sorry for the late reply. I worked on it for a bit yesterday and changing the ' GFX_OS_HEAP_SIZE ' property fixed it. I had been to the 'BareMetal' wiki page that you linked couple times, but for some reason, failed to notice the section on memory management. Moving on to getting the touch functionality working. Thank you.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...