cancel
Showing results for 
Search instead for 
Did you mean: 

ExtendedZoomAnimationImage motion ends prematurely

Du1
Senior

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;
	}
}

4 REPLIES 4
Martin KJELDSEN
Chief III

Hi @Du​,

Hmm, this is interesting. I will have to do some testing to better understand this, i think. This widget is from the Open Repository, and not a part of the TouchGFX framework. It hasn't been maintained since it was pushed to github, so there may be some compatibility issues.

Could you try this with just the ZoomAnimationImage to see if you get similar problems? By the way, the source for ZoomAnimationImage is inside touchgfx/containers so you can check whats happening inside ::handleTickEvent() - The last else statement calls "cancelZoomAnimation()" and also fires your callback if set.

You could print something out in your console inside cancelZoomAnimation() to see if you get a cancel when ending "prematurely".

Also, what's your definition of "ending prematurely" in this case?

Thanks!

Best regards,

Martin

Du1
Senior

Hi @Martin KJELDSEN​ ,

Thank you very much for the prompt reply! You are always so responsive and helpful.

I've tried using just the ZoomAnimationImage and it was acting the same way. I feel there is an interrupt somewhere causing the cancelZoomAnimation() to be called. I'll do some more digging and see where it leads me.

My definition of "ending prematurely" is in some obvious scenario, the image stops half way between its start point and end point. The less obvious one is when it gets very close to its end point, but stops just short, when the next animation event is called, then we can see the image snap into the correct endpoint, but the indexing is off by one because its previous end position was actually not achieved.

Hope that made sense, I'm not the best writer when trying to explain....

Thank you!

Du

Du1
Senior

@Martin KJELDSEN​ I narrowed it down to the way my interrupt handler is taking care of a quadrature decoder output.

It has nothing to do with the zoomAnimation library, thanks for your help!

Here is where I'm trying to figure out what I'm doing wrong with the interrupt for your reference.

https://community.st.com/s/question/0D50X0000APbAoKSQV/stm32l4r9-gpio13-14-15-exti-interrupt-problem

Martin KJELDSEN
Chief III

Hi @Du​,

Still trying to catch up, sorry for the delay in replying/helping you resolve the issue. Glad you found it yourself! Thanks for the reference 🙂

Best regards,

Martin