Skip to main content
Associate II
October 21, 2024
Question

Touchgfx display refresh issues

  • October 21, 2024
  • 1 reply
  • 1917 views

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 

 

1 reply

ST Employee
October 22, 2024

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

k_c2024Author
Associate II
October 22, 2024

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?

k_c2024Author
Associate II
October 22, 2024

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