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

 

17 REPLIES 17

Hello @StefanoL 

 

1)
With the line 34 "hour = (hour + (minute / 60)) % 24;" you ensure to increment the hours already, no need to put 3600.

2)
You said it freeze after 18 minutes but in the video it is at 8 minutes 42 seconds.
Is the freeze time always different or is it always the same time?

3)
You said "I changed a data in the program because it counted minutes and seconds", what have you changed exactly?

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Hi Gaetan, I changed line 31. Originally in the tutorial it is written like this " if (tickCount == 60) " but the clock counts seconds and minutes .... changing from 60 to 3600 counts minutes and hours. What you see (08:42 are hours and minutes which I had set because I'm also looking at the accuracy of the watch over time.

Ok, makes sense.

I have made the same changes as you did. In screen 1 I set the time to 8:40 and run it. after 2 minutes I get to 8:42 and I did not get blocked.
I am trying to reproduce your problem.

1)
You said it freeze after 18 hours but in the video it is at 8 hours 42 minutes.
Did you actually wait 8h for the error to occur or do you set the time of the clock to be close to the problematic time?
Is the freeze time always different or is it always the same time?


2)
What is freezing exactly? The circle only or also the time?

3)
An  external clock (or even a RTC) would be more precise than the internal oscillator

 

EDIT :
I ran it for a while, when I came back the circle was full and not changing, after some more time it went back to normal then back to full. There is definitely an unexpected behavior there.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

 

hi, thank you very much for your availability . 08:42 is a coincidence..... I had set the time because as I told you I wanted to see how many seconds of difference there are between the displayed time and the real time. and in fact if in line 31 you set the value like this (tickCount >= 3557) the clock is precise. But this is not the problem because as you rightly said you have to use the internal oscillator. What I wanted to understand is why for me after 18 minutes of operation the circle stops and no longer turns and the watch continues to work well

 

 

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)

 

Thanks, I'll try it and let you know. You were very kind

 

 Hi, everything seems to be working. Now I want to modify it so that every x turns or x time the circle changes color. So I learn something new. Thanks so much and have a good day.

Hello @StefanoL ,

 

I am glad it is working!

It is usually good practice to ask a single question per thread.

If you want to ask a new question, I invite you to create a new thread specific to that question the next time.

Regarding your question, you can track time using the handleTickEvent function that is called every single tick. Knowing that there is 60 ticks per second you can track time and for instance increment a variable every tick and change the color every x tick like ever 120 ticks for 2 second delay.

You can also track the position of the circle with the functions getArcStart and getArcEnd. For instance, if you want to change the color every time the circle gets to 0° you could change the color within a condition of getArcStart()%360 == 0.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)