cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F746G-DISCO, GFX, STM32CubeIDE

ADębs.1
Senior

Hi

I have a counter in main.c. I have two screens A and B. The meter reading is sent to screen B and displayed. When the counter reaches 0 I want screen B to switch to A. How to set it up in GFX? greetings

Andrzej

1 ACCEPTED SOLUTION

Accepted Solutions

Are you sure the if(!min_current && !sec_current) condition is ever met ? The application().gotoScreenSetScreenNoTransition() function works.

/Romain

View solution in original post

14 REPLIES 14
Romain DIELEMAN
ST Employee

Hi,

I would advise to create an Interaction within TouchGFX Designer where you set as Trigger "Hardware button is clicked" (a dummy button that you will not set) and as Action "Change screen". With this will be generated in <nameOfScreen>ViewBase.cpp a function called application().gotoScreen2ScreenNoTransition(). It will have a different name if you use another transition or have another name for screens. You can then call this function in your <nameOfScreen>View.cpp when the counter reaches 0.

0693W00000AMqARQA1.png/Romain

ADębs.1
Senior

Thank you. I will check and let you know.

Andrzej

Hi

I tried but it doesn't work.

I'm sending files. if (! sec_current && ! min_curren) is to go to ScreenSet

How to do it?

greetings

 
 

I'm a bit confused by what you tried to do and the flex button.

What I had in mind was just to have a fake hardware button and interaction, and then add in screenCurrentView.cpp the following function where you check all the time if the conditions are met or not to then call the changing screen function

void ScreenCurrentView::handleTickEvent()
{
	if(!min_current && !sec_current)
	{
		application().gotoScreenSetScreenNoTransition();
	}
}

I'm sending files. Did not work.

I'm sending

1. screen shot

2. cpp

3. hpp

4. Base.cpp

5. error: Description Resource Path Location Type no declaration matches 'void ScreenCurrentView :: handleTickEvent ()' ScreenCurrentView.cpp / Ver1 / TouchGFX / gui / src / screencurrent_screen line 35 C / C ++ Problem

Andrzej

You forgot to add it to ScreenCurrentView.hpp

#ifndef SCREENCURRENTVIEW_HPP
#define SCREENCURRENTVIEW_HPP
 
#include <gui_generated/screencurrent_screen/ScreenCurrentViewBase.hpp>
#include <gui/screencurrent_screen/ScreenCurrentPresenter.hpp>
 
class ScreenCurrentView : public ScreenCurrentViewBase
{
public:
    ScreenCurrentView();
    virtual ~ScreenCurrentView() {}
    virtual void setupScreen();
    virtual void tearDownScreen();
 
	virtual void updateMinCurrent(uint8_t min_current);
	virtual void updateSecCurrent(uint8_t sec_current);
 
    virtual void handleTickEvent();
 
protected:
 
 
};
 
#endif // SCREENCURRENTVIEW_HPP

I have added in ScreenCurrentView.hpp virtual void handleTickEvent (); and uint8_t sec_current; uint8_t min_current; I send the corrected files and the entire program

Does not switch screen.

Andrzej