cancel
Showing results for 
Search instead for 
Did you mean: 

Circle that gets stck

StefanoL
Associate III

 Hi, I learned how to make the clock by following the 3 tutorials ( https://support.touchgfx.com/docs/tutorials/tutorial-03 ). I changed a data in the program because it counted minutes and seconds. Now I noticed that after 18 minutes the circle freezes and no longer runs, if you intervene manually by switching from one screen to another it clearly updates and starts again for another 18 minutes. can someone help me? Thank you

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @StefanoL ,

 

I think I found the issue.
The start and end position of the circle use int16 so after some time of incrementing 60 times per second they overflow which creates the unexpected behavior.

I fixed the issue by adding the following lines of code at line number 59 : 

 

// to fix the overflow of arc start and arc end.
if(circle.getArcStart()>360 && circle.getArcEnd()>360)
{
    circle.updateArc(circle.getArcStart()-360, circle.getArcEnd()-360);
}

 



I also added two text area to display the value of the start and end position :

 

//to debug and see what is happening
Unicode::snprintf(textAreaStartBuffer, 10, "%06d", circle.getArcStart());
Unicode::snprintf(textAreaEndBuffer, 10, "%06d", circle.getArcEnd());
textAreaEnd.invalidate();
textAreaStart.invalidate();



Hope this fix your problem!

 


I will escalate the issue to modify the tutorial.
 
Hope this helps.

Don’t hesitate to give us a feedback or give more precisions and tell us if the issue is solved! 😊

Gaetan Godart
Software engineer at ST (TouchGFX)

View solution in original post

17 REPLIES 17
JTP1
Lead

Hello

Are you using simulator or running it in the target board (eg some Discovery) ?

Br JTP

Hi , i'm using it on STM32F7 DISCOVERY.

GaetanGodart
ST Employee

Hello @StefanoL 

I am glad you are making progress on the tutorial 3! 😁

Knowing there is 60 ticks per second, 18minutes * 60 seconds per minutes * 60 ticks per second = 64800.
However, the maximum value of a int16 is 2^16 = 65536.
These two seems strangely close.

Are you sure you are resetting the tick counter with the line "tickCount = 0;" in void Screen2View::handleTickEvent()?

It works after 18 minutes for me without problem.

Tell me if that fix your problem!

 

Hope this helps.

Don’t hesitate to give us a feedback or give more precisions and tell us if the issue is solved! 😊

Gaetan Godart
Software engineer at ST (TouchGFX)

Hello

Sorry to bother you but i would try to change

void Screen2View::handleTickEvent()
{
    if (tickCount == 60)
    {
  

like this:

void Screen2View::handleTickEvent()
{
    if (tickCount >= 60)
    {

Just in case.

Br JTP

 Hi, Little by little I'm learning something 😉 Surely the error is there...... I changed the value from 60 to 3600 because the clock displays seconds and minutes by setting 3600 I display minutes and hours. Do I need to add a variable that only does the counting for the circle? Thank you.

Hi, Little by little I'm learning something. 😉

 Surely the error is there...... I changed the value from 60 to 3600 because the clock displays seconds and minutes by setting 3600 I display minutes and hours. Do I need to add a variable that only does the counting for the circle? Thank you.

I think no, the circles are updated at every tick.

Br JTP

After 18 minutes this happens.

Orologio.jpg