cancel
Showing results for 
Search instead for 
Did you mean: 

[Solved] How can screen saver be implemented within TouchGFX?

KShim.1738
Associate III

I would like to implement a screen saver for an app with multiple TouchGFX screens. AnimatedImage widget is perfect for screen saver function I reckon. My question how it can be used across the whole TouchGFX screens.

The simplest solution might be that every screen shares the same AnimagedImage widget thru a custom container. In this case, I'm worrying that the size of TouchGFX resource might increase dramatically(But I think the TouchGFX designer will do its job smart, so it would not increase the resource size for the external flash no more than necessary.).

There is an answer to the same question as mine already, where a screen ID was recommended by Martin.

https://community.st.com/s/question/0D50X0000AaYMwM/how-to-implement-switchscreen-in-touchgfx

I think it's a good idea. One problem is that I have to define screen ID for every screen manually. It seems that TouchGFX don't support the screen ID or something like that. So I have to add a new ID for a new screen to be added. Or I have to remove the ID for a screen to be removed.

With screen IDs, I can implement a custom screen transition function for the screen saver. When screen saver touched, I can go back to the previous screen before the screen saver working. And the screen ID's of normal screens except for the screen saver must be recorded when screen is setup. I think I can store the variable for the screen ID in Model.

I don't know if two methods I mentioned above will work or not. Before implementation I would like to hear other's opinion who are hopefully familiar with TouchGFX.

I'm new to TouchGFX app. Please enlighten me with my problem.

Best regards,

Kyle

1 ACCEPTED SOLUTION

Accepted Solutions
Alexandre RENOUX
Principal

Hi Kyle,

If I understand and I'm not mistaken, you want to change screen to the screen saver and come back to the previous screen when the screen saver is touched.

For the screen transition, have a look at this post.

And yes you are correct, saving the Screen ID in the model to come back to the previous screen is the right way.

/Alexandre

View solution in original post

6 REPLIES 6
Alexandre RENOUX
Principal

Hi Kyle,

If I understand and I'm not mistaken, you want to change screen to the screen saver and come back to the previous screen when the screen saver is touched.

For the screen transition, have a look at this post.

And yes you are correct, saving the Screen ID in the model to come back to the previous screen is the right way.

/Alexandre

Yes, I want to go back to the previous screen when the screen saver is destroyed. Thank you for your answer.

///////////////////

Can I ask you one more question?​

I'v found an API of TouchGFX, whose argument is a screenid.

virtual void appSwitchScreen(uint8_t screenId)An application specific function for switching screen.

Does this imply that the screen TouchGFX generates has a unique ID?

Otherwise I have to declare a member variable(maybe inside basepresenter or something), and then assign proper enum value in Constructor, I guess. And I need a public function, which can be called from Model or FrontApplication to find out the ID of current screen.

If the screens has some kind of intrinsic unique ID already then I don't have to do the above job myself.

Would you please clarify the meaning of screenid in the above API, appSwitchScreen()? Do I have to assign an ID(enum or macro constant) to each screen myself or TouchGFX does that job automatically?

Best regards,

Kyle

Hi Kyle,

This function is empty, you would need to implement it yourself and I don't recommend it. You can see for yourself by looking at Application.hpp.

The easy and best way is to simply create a variable in Model.

In tearDownScreen() of each screen you save the corresponding value to the Model (e.g Screen1 = 1, Screen2 = 2, etc.)

Then after touching your display you execute a function that will look like

void wakeUpToPreviousScreen()
{
   switch(presenter->getPreviousScreen())
   {
         case 1 :
               goToScreen1();
               break;
         case 2:
               goToScreen2()
            .....
   }
}

/Alexandre

I understand how I can achieve my goal only if I have the unique ID for each scree class.

My question is how I can find the ID of current screen so that I can store the current screen ID to a certain variable of Model.

Would you please clarify this?

Kyle

Hi Kyle,

You give yourself any ID you want.

/Alexandre

Understood.

I appreciate your help.

Kyle