How can I make my custom containers to update with specific frequency?
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:
- In the first case a change in the refresh rate would have an impact on when the GUI update values
- In the second scenario each parent container needs to call the child containers with the correct periodicity.
Does touchGFX support registering the containers to configurable period calls? Am I missing something?
