2021-09-05 10:11 PM
As per the tutorial 5: https://support.touchgfx.com/docs/tutorials/tutorial-05, I have implemented a custom trigger as per part 1. Its work perfectly on simulator but it did not run on discovery board.
When I debug this application, control went to buttonCallback handler but never hit to setBackGroundColor function.
Please let me know what I am missing.
void Screen1ViewBase::setBackGroundColor(colortype value)
{
//Interaction1
//When setBackGroundColor is called execute C++ code
//Execute C++ code
backGround.setColor(value);
backGround.invalidate();
}
void Screen1ViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)
{
if (&src == &button)
{
//Interaction2
//When button clicked call setBackGroundColor on Screen1
//Call setBackGroundColor
setBackGroundColor(touchgfx::Color::getColorFrom24BitRGB(rand()%256, rand()%256, rand()%256));
}
}
2021-09-05 11:41 PM
Hi,
Are you working with a custom board or from a TouchGFX Board Setup for one of ST's development kits ? What is the color depth ? Maybe also try this function instead
touchgfx::Color::getColorFromRGB(rand()%256, rand()%256, rand()%256)
I tried the tutorial with the STM32H7B3-dk and it works fine. There is nothing wrong with the piece of code you shared. Could you share your project so that I can have a look at the settings within Designer ?
/Romain
2021-09-06 12:22 AM
I tried on both a 24bpp board (the STM32H7B3-dk board), where it works, and a 16bpp board (STM32F429-dk) where it does not work. It seems like the rand is the issue.
/Romain
2021-09-06 01:15 AM
I am working on 16bpp board(STM32H747-Disco), So I will try getColorFromRGB instead of getColorFrom24BitRGB.
Thank you for your support!
2021-09-06 01:30 AM
I checked for getColorFromRGB function but there is no such function in color.hpp file
2021-09-06 01:32 AM
2021-09-06 01:58 AM
What version of TouchGFX Designer are you using ?
/Romain
2021-09-06 02:11 AM
I cannot run on my board from this. The project is based on TouchGFX 4.16.1 which is why you do not have the getColorFromRGB() function but it is not an issue. The online application template for the STM32H747 disco board has a color depth of 24bpp, so I suppose you created a project from scratch and set it to 16bpp ?
/Romain
2021-09-06 02:29 AM
Okay.Thank you!