2023-02-15 07:41 AM
I have a complex GUI that has many custom containers displaying information. This information shall be updated at specific perios to avoid confusing the end user.
For example the voltage shall be updated every second while the frequency shall be updated every 200ms
Currently my custom containers have the following code which updates the values every 16ms and depends on the refresh rate of the screen.
void MyCustomContainer::initialize() {
MyCustomContainer::initialize();
/* Register tick functions */
Application::getInstance()->registerTimerWidget(this);
}
void MyCustomContainer::handleTickEvent(void) {
/* ... get value () */
/*... update text gui() */
}
I could add to every widged something in the lines of (pseudo code):
void MyCustomContainer::handleTickEvent(void) {
static uint8_t counter = 0;
if (counter >= SOME_VALUE {
/* ... get value () */
/*... update text gui() */
counter =0;
} else {
counter ++;
}
}
...or make the parent widget in charge of handling the update of the child custom containers. Both solution seem do not look the right path to go as:
Does touchGFX support registering the containers to configurable period calls? Am I missing something?
Solved! Go to Solution.
2023-03-28 06:09 AM
This has been solved as of touchgfx 4.21.3 as there is the trigger event that can trigger a custom container ever N ticks
2023-02-15 08:53 AM
Seems you miss. Your idea waste graphics power ,
In normal situation exist two ways
//get new value used in gui task tick only if is time efficient otherwise require other task
newVal = maincodestruct.voltage;
if(showed.voltage != newVal)
{
container.updatemethod(newVal);
}
In container registered tick is effective only for animate container.
2023-02-15 11:15 PM
@MM..1 My GUI basically shows sensor data. Each container shows different types of sensors and may be reused between multiple screens. The sensor data can be retrieved fast with getter function (no calculation necessary). The issue is that the sensor data is updated at a different rate that rate at which it needs to be displayed. For example:
What I want to avoid is that each view having to know which is the desired update rate of each type of container and calling it according to its rate.
But the fact that each container shall have its own tick event that can only be dependent on the refresh rate of the screen and not on a "time" seems a completely waste of uC power.
2023-03-28 06:09 AM
This has been solved as of touchgfx 4.21.3 as there is the trigger event that can trigger a custom container ever N ticks