2024-12-01 08:57 PM
I have a hardware trigger that needs to change a scene (think a Home button but I cannot use a hardware key event).
I am trying to change the scene for days but I cannot find a working solution.
The best looking solution was this: https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/how-to-implement-quot-switchscreen-quot-in-touchgfx/m-p/384809
Using this method crashes the code. Well technically the code is stuck in this loop in syscalls.c:
void _exit (int status)
{
_kill(status, -1);
while (1) {} /* Make sure we hang here */
}
My code in the model is like this:
void Model::tick()
{
uint16_t buttonState = getButtonState(16);
if (buttonState != previousButtonState)
{
if (modelListener != 0)
{
modelListener->onButtonStateChange(buttonState);
}
if (static_cast<ButtonEnum>(buttonState) == ButtonEnum::MENU)
{
static_cast<FrontendApplication*>(Application::getInstance())->gotoSplashScreenScreenNoTransition();
}
previousButtonState = buttonState;
}
}
I also tried to increase the minimum heap size since I saw it may be the cause.
The gotoSplashScreenNoTransition() is automatically generated since it is may entrance point.