cancel
Showing results for 
Search instead for 
Did you mean: 

Get error when add line in custom container

Natali
Associate III

hi

when i add yellow line in custom container TouchGFX 4.10.0 Designer report error and when i remove the yellow line simulator run successfully

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

Hi @Natali​,

If you notice the assert it says that no canvas buffer is allocated. For "shapes", a buffer is required in order to render them. For application templates this is defined in main.cpp (Both simulator and target main.cpp) but you can make this more general by configuring the buffer in e.g. setupScreen() for your view if you have different memory requirements per view.

#define CANVAS_BUFFER_SIZE 3600
...
static uint8_t canvasBuffer[CANVAS_BUFFER_SIZE];
CanvasWidgetRenderer::setupBuffer(canvasBuffer, CANVAS_BUFFER_SIZE);

You can use small buffers, but at the cost of performance, or large buffers at the cost of memory, naturally. You can call the following method on CanvasWidgetRenderer to have it output to the console the amount of memory it requires for best performance.

void setWriteMemoryUsageReport(bool)

And enable output in the simulator by calling:

touchgfx_enable_stdio();

/Martin

View solution in original post

2 REPLIES 2
Martin KJELDSEN
Chief III

Hi @Natali​,

If you notice the assert it says that no canvas buffer is allocated. For "shapes", a buffer is required in order to render them. For application templates this is defined in main.cpp (Both simulator and target main.cpp) but you can make this more general by configuring the buffer in e.g. setupScreen() for your view if you have different memory requirements per view.

#define CANVAS_BUFFER_SIZE 3600
...
static uint8_t canvasBuffer[CANVAS_BUFFER_SIZE];
CanvasWidgetRenderer::setupBuffer(canvasBuffer, CANVAS_BUFFER_SIZE);

You can use small buffers, but at the cost of performance, or large buffers at the cost of memory, naturally. You can call the following method on CanvasWidgetRenderer to have it output to the console the amount of memory it requires for best performance.

void setWriteMemoryUsageReport(bool)

And enable output in the simulator by calling:

touchgfx_enable_stdio();

/Martin

Martin KJELDSEN
Chief III

That being said - Do not read the memory usage report as the "required" amount of memory. The wording is actually a bit vague in this respect and could be improved.

You can still make do with less memory, but at the cost of performance. However, the performance you're experiencing may be perfectly acceptable to you, so there may not be any point to paying additional memory.

/Martin