Skip to main content
AD�?b
Senior
November 5, 2020
Solved

STM32F746G-DISCO I am studying 3 tutorial with clock. When I select buttonSaveHour and buttonClock, times are not transferred to screen 2. When I return to screen 1, the hour is 00. Why?

  • November 5, 2020
  • 7 replies
  • 1191 views

Hi

I am studying 3 tutorial with clock.

When I select buttonSaveHour and buttonClock, times are not transferred to screen 2. When I return to screen 1, the hour is 00. Why?

Yours sincerely

This topic has been closed for replies.
Best answer by Alexandre RENOUX

Please create a new thread for this since it's not directly related to the topic of this thread.

This is for others to be able to find it more easily.

/Alexandre

7 replies

Alexandre RENOUX
Visitor II
November 9, 2020

Hello,

Two possible reasons :

  • You haven't saved the values in the model
  • You haven't retrieved in your ScreenView the values saved in the model. In this case you need to call a getter (you previously created) inside the setupScreen() function.

If you are following https://support.touchgfx.com/docs/tutorials/tutorial-03 and it does not work, you definitely did something wrong. Please carefully check what is mentioned in the tutorial.

/Alexandre

AD�?b
AD�?bAuthor
Senior
November 9, 2020

One more question. Where to change so that the minutes do not change every second and the analog clock changes?

best regards

Alexandre RENOUX
Visitor II
November 10, 2020

I'm not sure I got your question right, but I'll try an answer.

If you do not want the minutes to change every seconds, then you need to change the condition with the tickCount.

Here is the code in the tutorial :

void Screen2View::handleTickEvent()
{
 if (tickCount == 60)
 {
 minute++;
 hour = (hour + (minute / 60)) % 24;
 minute %= 60;
 
 Unicode::snprintf(textClockBuffer1, TEXTCLOCKBUFFER1_SIZE, "%02d", hour);
 Unicode::snprintf(textClockBuffer2, TEXTCLOCKBUFFER2_SIZE, "%02d", minute);
 
 textClock.invalidate();
 
 tickCount = 0;
 }

One tick is 16 ms so if you reach tickCount = 60 then one second has passed.

If you want to have the minute value really change every minute, then you just write :

if (tickCount == 3600 /* 60x60 */)

I don't understand what you are trying to say regarding analog clock. Please be more precise.

When your question is answered, please close this topic by choosing Select as Best.

/Alexandre

AD�?b
AD�?bAuthor
Senior
November 9, 2020

Hi Alexandre

Thank you. I had a mistake in the name of the Save hour button function in TouchGFX Designer.

best regards

Andrzej