ExtendedZoomAnimationImage motion ends prematurely
I have a few images moving and zooming across the screen, however every once in a while the animation ends before it reaches its destination and throws off my indexing.
Initially I thought it was a GPIO interrupt that was causing this, so I make sure to disable the GPIO interrupts before starting an animation and then re-enable it after the AnimationEnded Callback. However I notice that sometime the callback code doesn't get executed when the animation ends prematurely.
Is there a way to handle cases where the animation ends prematurely?
void HomeScreenView::animationEndedCallbackHandler(const touchgfx::ZoomAnimationImage& src)
{
// if (&src == &MenuImg)
// {
callbck();
// }
}
void HomeScreenView::callbck()
{
highlightCircle.setAlpha(255);
highlightCircle.invalidate();
currentScreen = nextScreen;
HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
}void HomeScreenView::handleKeyEvent(uint8_t key)
{
HAL_NVIC_DisableIRQ(EXTI15_10_IRQn);
// debounceCounter++;
// if(debounceCounter >= 0)
// {
switch(key){
case 1:
if(currentScreen != MENUSCREEN){
highlightCircle.setAlpha(0);
highlightCircle.invalidate();
moveright = false;
ScrollLeftFnc();
}else{
HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
}
break;
case 2:
if(currentScreen != ROAMSCREEN){
highlightCircle.setAlpha(0);
highlightCircle.invalidate();
moveright = true;
ScrollRightFnc();
}else{
HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
}
break;
case 5:
BtnSelFnc();
break;
default:
// HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
break;
}
// debounceCounter = 0;
// }
// HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
}void HomeScreenView::ScrollRightFnc()
{
switch(currentScreen){
case MENUSCREEN:
MenuImg.startZoomAndMoveAnimation(LeftMidX, LeftMidY, widthOfMediumElements, heightOfMediumElements, SCROLLSPEED);
SignInImg.startZoomAndMoveAnimation(topCenterX, topCenterY, widthOfLargeElements, heightOfLargeElements, SCROLLSPEED);
CloudImg.startZoomAndMoveAnimation(RightMidX, RightMidY, widthOfMediumElements, heightOfMediumElements, SCROLLSPEED);
USBImg.startZoomAndMoveAnimation(RightSmX, RightSmY, widthOfSmallElements, heightOfSmallElements, SCROLLSPEED);
previousScreen = MENUSCREEN;
nextScreen = SIGNINSCREEN;
Unicode::strncpy(txtlvl1Buf,"Sign In",7);
txtlvl1Buf[7]=0;
Level1txt.invalidate();
break;
.....
default:
break;
}
}