cancel
Showing results for 
Search instead for 
Did you mean: 

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?

AD�?b
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

7 REPLIES 7
Alexandre RENOUX
Principal

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
Senior

Hi Alexandre

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

best regards

Andrzej

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

best regards

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

Hi

Thank you. This is what I ment.

best regards

Andrzej

He Alexandre

Still tutorial 3 with the clock.

1. How to transfer the current time to main.c after pressing Save hours? I have a secondTask.

2. How to remember the variable after power off?

regards

Andrzej

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