2020-08-24 11:35 AM
Hello!
I have a swipe container with 3 pages in my TouchGFX app, running on an STM32F469 Discovery Kit. Everything is working fine, but I need to carry out certain actions when a swipe is started / ended. The docs state there are no built-in triggers for touchgfx::SwipeContainter, so I decided to add my code to it.
But as soon as I add a field (GenericCallback) and this field's setter method to this class and invoke this method from my code, the UI becomes unresponsive. I guess the app just crashes.
What am I doing wrong?
Thanks.
Solved! Go to Solution.
2020-08-27 01:40 AM
Hello,
After investigating, I found that the fact that you declare and implement the function in the header file is the issue.
If you just declare in the SwipeContainer.hpp
void setAaa();
uint8_t aaa;
And then in the SwipeContainer.cpp, you initialize the aaa variable in the constructor
And finally you implement the setAaa() function
void SwipeContainer::setAaa()
{
aaa = 10;
}
Also, as you changed the SwipeContainer.cpp, you should include it in your project to make sure the compiler refers to the modified file and not the one in the library.
The reason of this hardfault is still not completely clear but this is how the compilers compile the code and having this setter implemented in the header file is not something he likes even though it doesn't tell you so.
/Alexandre
2020-08-25 04:31 AM
Hello,
Could you enclose your UI in this thread ? I will try to have a look.
/Alexandre
2020-08-25 07:12 AM
Alexandre,
Thanks for your response.
Unfortunately I can't post the exact UI, as it's a commercial project, so I created a new project in TouchGFXDesigner and deleted
.\Middlewares\ST\touchgfx\framework\tools\
.\Middlewares\ST\touchgfx\lib\
to keep the archive small. The app consists of a single screen with a swipe container, allowing to switch between two pages. I added a dummy variable and its setter to .\Middlewares\ST\touchgfx\framework\include\touchgfx\containers\SwipeContainer.hpp. The setter is invoked from .\TouchGFX\gui\src\main_screen\MainView.cpp line 12. The app crashes when you swipe to page two.
Thanks a lot for your help.
2020-08-27 01:40 AM
Hello,
After investigating, I found that the fact that you declare and implement the function in the header file is the issue.
If you just declare in the SwipeContainer.hpp
void setAaa();
uint8_t aaa;
And then in the SwipeContainer.cpp, you initialize the aaa variable in the constructor
And finally you implement the setAaa() function
void SwipeContainer::setAaa()
{
aaa = 10;
}
Also, as you changed the SwipeContainer.cpp, you should include it in your project to make sure the compiler refers to the modified file and not the one in the library.
The reason of this hardfault is still not completely clear but this is how the compilers compile the code and having this setter implemented in the header file is not something he likes even though it doesn't tell you so.
/Alexandre
2020-08-27 09:03 AM
Hello, Alexandre.
It worked like a charm, thanks a lot!