2024-02-15 08:59 AM
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
Solved! Go to Solution.
2024-02-20 06:35 AM - edited 2024-02-22 03:23 AM
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);
}
//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!
Don’t hesitate to give us a feedback or give more precisions and tell us if the issue is solved! :smiling_face_with_smiling_eyes:
2024-02-16 10:04 AM
Hello
Are you using simulator or running it in the target board (eg some Discovery) ?
Br JTP
2024-02-19 01:59 AM
Hi , i'm using it on STM32F7 DISCOVERY.
2024-02-19 07:34 AM - edited 2024-02-19 08:38 AM
Hello @StefanoL
I am glad you are making progress on the tutorial 3! :beaming_face_with_smiling_eyes:
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! :smiling_face_with_smiling_eyes:
2024-02-19 07:55 AM
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
2024-02-19 08:43 AM
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.
2024-02-19 08:44 AM
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.
2024-02-19 09:04 AM
I think no, the circles are updated at every tick.
Br JTP
2024-02-20 12:38 AM
2024-02-20 12:39 AM