cancel
Showing results for 
Search instead for 
Did you mean: 

Where is Code editor in TouchGFX also where is output window to know errors generated? Run failed for me, where to check for errors?

ABeck.1
Associate II

I am new to TouchGFX. I am working on STM32 controller based project. In that TFT LCD screen is one of the peripherals. I want to create screens using TouchGFX so that i can set value on screen and run timer according to the value entered on screen, during this complete duration my led will be ON

25 REPLIES 25
Martin KJELDSEN
Chief III

TouchGFX is a code generator only, it's not an ide/compiler, but can interact with iar/keil/gcc projects.

When you "run" the designer runs 'make' . The errors should be in the graphical log window in the designer or in %APPDATA%/TouchGFX-4.13.0/

/Martin

https://touchgfx.zendesk.com/hc/en-us/articles/360018667192-Step-1-Setting-up-the-two-Screens?mobile_site=true

I am trying example mentioned in above link. It says I have to edit some files, add line of codes, so where to do that? I edited using Notepad++, after that on generating code, I am getting error. How to check for errors and how to resolve it .. I havnt conncted any IDE with TouchGFX till now

Alexandre RENOUX
Principal

You can use editors like Visual Studio Code or Sublime Text that allows you to open entire folders, which can help you in your development.

Use these editors to edit files and add lines of code. Your generated project should be situated in C:/TouchGFXProjects/ if C: is your root and you left the default configuration during the TouchGFX installation. Open the corresponding folder in C:/TouchGFXProjetcs/ and edit the code.

Make sure you do not change files that are generated by TouchGFX Designer. These files should have some text at the beginning stating that this file is generated by TouchGFX Designer and therefore should not be edited by the programmer.

If you chose an Application Template in the Designer in order to download the code into a specific board, after generating code, you should find a .eww file in YouApplication/target/IAR8.x/ , this can be executed by IAR. Therefore, you will be able to build a hex file to be downloaded into the board.

When compiling using TouchGFX Designer, at the bottom right of the screen you should see a button called Detailed Log, this is where you will find the compiling errors.

/Alexandre

ABeck.1
Associate II

Thank you Martin and Alexandre..

It helped me, now I am able to create screens and run also...

One more query - In custom container can I add digital clock also, I want to display time on every screen. So for this, where shall I write logic for clock, on custom container file or respective screens file?

Anju

Alexandre RENOUX
Principal

Yes you can add a digital clock in a custom container to display time on every screen. The logic for clock should be in the custom container file, the respective screen files will only call the functions implemented in the custom container file if necessary.

/Alexandre

#include <gui/containers/CustomContainer.hpp>

CustomContainer::CustomContainer()

{

}

void CustomContainer::initialize()

{

   CustomContainerBase::initialize();

   digitalHours = digitalClock.getCurrentHour();

   digitalMinutes = digitalClock.getCurrentMinute();

   digitalSeconds = digitalClock.getCurrentSecond();

}

void CustomContainer::handleTickEvent()

{

 tickCounter++;

         if (tickCounter % 60 == 0)

         {

             if (++digitalSeconds >= 60)

             {

                 digitalSeconds = 0;

                 if (++digitalMinutes >= 60)

                 {

                     digitalMinutes = 0;

                     if (++digitalHours >= 24)

                     {

                         digitalHours = 0;

                     }

                 }

             }

         }

             digitalClock.setTime24Hour(digitalHours, digitalMinutes, digitalSeconds);

}

I have written like this,

Now shall I call this function from screen files or how it is?

Or this ;ogic I shall write on same function of other screens?

I think you need to call the initialize() function in the setupScreen() function in the screen files.

void Screen1View::setupScreen()
{
   myCustomContainer.initialize();
}

For the handleTickEvent() to work, you need to call the handleTickEvent of the base class of the screenView

void Screen1View::handleTickEvent()
{
  Screen1ViewBase::handleTickEvent();
}

Your custom container initialization will not do what you expect because it is not the same custom container for each screen. You instantiate one custom container object per screen, therefore, digitalClock.getCurrentHour() will not return the value of the previous digital clock but the current one which will be probably 00:00. You need to save the time in the Model everytime you switch to a new screen and retrieve the saved time when entering the new screen.

/Alexandre

"For the handleTickEvent() to work, you need to call the handleTickEvent of the base class of the screenView"

What I understood with this is I have to add timer logic in every screen's handleTickEvent().

And using model and presenter, current time will propagate between screens.

Is my understanding correct?

Implementing handleClickEvent() in every screenView is indeed necessary but apart from calling the base class handleClickEvent() function, you do not need to add more logic except if you need timing also more something else.

You are correct regarding use of Model Presenter.

/Alexandre