2024-10-21 10:58 AM
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
2024-10-22 03:15 AM
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
2024-10-22 03:39 AM - last edited on 2024-10-23 04:04 AM by SofLit
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?
2024-10-22 04:33 AM
Can you please share some example code of using touchgfx without RTOS? It will be helpful.
2024-10-23 03:19 AM
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
You can also try using handleTickEvent() instead of calling the update value function from the Model
2024-11-11 05:07 AM
Hello @k_c2024 ,
Have you been able to move forward on your project?
Regards,