cancel
Showing results for 
Search instead for 
Did you mean: 

Touchgfx display refresh issues

k_c2024
Associate II

I am using STM32H757 board which MIPI DSI LCD onboard
Created touchgfx project and disabled RTOS (as I don’t want to use RTOS in my project). Tim6 is used for SYS
I am incrementing a value by 1 (variable is declared as global static) on gui from model:tick function using wildcard text area. From model, i passed the value to presenter and then finally to view.cpp
Application is working but there are some issues.
When i debug the code, values are ok as expected but don’t reflect on LCD screen.
When i reset board sometimes it shows incremented (but more than 1) or the old value
Also the widget is sometimes seen is cut. I m not if sure if it is a display refresh issue and how to resolve??

FYI: please check attached video.


@Osman SOYKURT @Romain DIELEMAN 

 

5 REPLIES 5

Hello @k_c2024,

It is difficult to figure out the issue without seeing the source code. However, a solution can be to use handleTickEvent() in your screen to read the value from your model instead of sending the value from Model::tick() to your screen. 
Use Model::tick() to update the value, create a getter function for it, and use the getter function in your screen.

If you already have tried this solution or it does not work, please share the logic of your code. 

Best regards,
Mohammad

Mohammad MORADI
ST Software Developer | TouchGFX

I have to update a sensor value on screen.

In model.cpp: I am updating NewTextValue variable

--------------------------------------------------------------------------------------------------

/*model.cpp*/

static uint16_t count = 0;

static uint16_t NewTextValue = 0;

void Model::tick()

{

count++;

if(count >= 5000)

{

count = 0;

NewTextValue++;

if(NewTextValue>= 9)

{

NewTextValue = 0;

}

if (modelListener != 0)

{

modelListener->notifyValChangedtoPresenter(NewTextValue);

}

}

}

--------------------------------------------------------------------------------------------------

In presenter.cpp, calling below function to update in respective view:

void Screen1Presenter::notifyValChangedtoPresenter(int newValue)
{
view.updateTextArea(newValue);
}

--------------------------------------------------------------------------------------------------

In view.cpp, getting required value and invalidating the text area.

 void Screen1View::updateTextArea(int newValue)
{
textArea1.invalidate();
Unicode::snprintf(textArea1Buffer, TEXTAREA1_SIZE, "%d", newValue); 
textArea1.invalidate();
}

--------------------------------------------------------------------------------------------------

Issues:

1. On LCD screen, after 5000 count (1 sec), value should increment on screen automatically, but it is not. However value is sometimes seen changed after i reset board.

2. Sometimes the text widget is seen as cut, as you see in attached video.

Buffer size for wildcard text area is enough,10 bytes. 

Text Widget should refresh every time textArea1.invalidate(); is called, right?

Can you please share some example code of using touchgfx without RTOS? It will be helpful.

Your code logic is correct. And as you mentioned, whenever invalidate() is called, the TextArea should be redrawn; therefore, one invalidate() after updating the value should suffices. 

There are a couple of TouchGFX Board Setups (TBS) available in the TouchGFX Designer that use no operating systems like NUCLEO_C071RB

NUCLEO_C071RB TBSNUCLEO_C071RB TBS

You can also try using handleTickEvent() instead of calling the update value function from the Model

Mohammad MORADI
ST Software Developer | TouchGFX

Hello @k_c2024 ,

Have you been able to move forward on your project?

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)