2021-07-06 02:09 AM
Hi,
I have a project that has multiple screens. On the first screen, there is a zoom animation. Every 10 tick, it's getting larger. How ever, it looks like that it stucks towards the end of animation. So, I decided to use caching.
void TouchGFXHAL::initialize()
{
TouchGFXGeneratedHAL::initialize();
uint16_t* const cacheStartAddr = (uint16_t*)0x30025800;
const uint32_t cacheSize = 0x20000;
touchgfx::Bitmap::removeCache();
touchgfx::Bitmap::setCache(cacheStartAddr, cacheSize);
}
void IgnitionOnDemoScreenView::setupScreen()
{
IgnitionOnDemoScreenViewBase::setupScreen();
Bitmap::cache(BITMAP_LOGO_ORIG_60X60_ID);
LogoImage.setBitmap(BITMAP_LOGO_ORIG_60X60_ID);
LogoImage.setXY(90,130);
LogoImage.setScalingAlgorithm(touchgfx::ScalableImage::BILINEAR_INTERPOLATION);
add(LogoImage);
}
void IgnitionOnDemoScreenView::tearDownScreen()
{
IgnitionOnDemoScreenViewBase::tearDownScreen();
Bitmap::clearCache();
}
bool IgnitionOnDemoScreenView::IgnitionOnDemoScr_Animate() {
static uint8_t Tick = 0;
Tick++;
if (Tick % 10 == 0) {
if (LogoImage.getWidth() < 225 && LogoImage.getHeight() < 225) {
LogoImage.setPosition(LogoImage.getX() - 5, LogoImage.getY() - 5, LogoImage.getWidth() + 10, LogoImage.getHeight() + 10);
LogoImage.invalidate();
}
else {
return true;
}
}
return false;
}
But now, the quality of image is bad and it makes the other processes get stuck.
2021-07-06 11:51 PM
Hello Ezgi,
Do you have also the issue on the simulator or is it only on your board ? What board do you have ?
What do you mean by "looks like that it stucks towards the end of animation" ?
On another note, your tearDownScreen function should me modified as follows :
void IgnitionOnDemoScreenView::tearDownScreen()
{
Bitmap::clearCache();
IgnitionOnDemoScreenViewBase::tearDownScreen();
}
/Alexandre
2021-07-07 01:47 AM
Hi,
Thanks for your answer. I try it on my custom board that has STM32H743VGTX. The image disappears before the last step is left and then it comes out. Also, I have a pointer on the board. When the animation goes on, this pointer freezes sometimes and delays.