Skip to main content
scottSD
Senior III
December 6, 2019
Solved

Issues with Portrait Orientation on STM32F746G-Discovery Kit

  • December 6, 2019
  • 1 reply
  • 1295 views

I have followed the instructions in the following link:

https://touchgfx.zendesk.com/hc/en-us/articles/203563972-Display-Orientation

It gives instructions for portrait orientation for the target (via editing BoardConfiguration.cpp) , Simulator (via via editing the simulator's main.cpp file), and the TouchGFX Designer (via editing the project file).

I believe the instructions are not up-to-date (especially for the Designer).

TouchGFX Designer:

Swapping the Width and Height values in touchgfx project file did not put the Designer in portrait mode. I also needed to change the "DisplayOrientation" to "Portrait" (in the touchgfx project file) :

"LandscapeSkinX": 0,
 "LandscapeSkinY": 0,
 "PortraitSkinX": 0,
 "PortraitSkinY": 0,
 "DisplayOrientation": "Portrait"

TouchGFX Simulator

The simulator did function correctly in portrait when adding the following to its main.cpp file:

HAL::getInstance()->setDisplayOrientation(ORIENTATION_PORTRAIT);

However, items are distorted on the simulator:

0690X00000AtPEwQAN.pngThis is what it looks like in the Designer: 

0690X00000AtPF1QAN.png

The "R" is an Image widget I added.

The target shows the same thing as the image above (after editing the BoardConfiguration.cpp file).

Is there anything I can do to fix the distortion of the widgets?

This topic has been closed for replies.
Best answer by scottSD

Further experimenting helped me find an answer to this. Hopefully it will help anyone else that is having issues with Display Orientation.

Go to the Images tab in the Designer:

0690X00000AtPG4QAN.png

In the right margin set the Layout Rotation to 90:

0690X00000AtPG9QAN.png

And it fixes my issue:

0690X00000AtPGEQA3.png

1 reply

scottSD
scottSDAuthor
Senior III
December 6, 2019

I was able to fix the "R" image by appending ".90" to the image file name prior to adding to the Designer. The article says in the "Switching Dynamically at Runtime" section that this can be done so that the image will be rotated 90 automatically.

scottSD
scottSDAuthorBest answer
Senior III
December 6, 2019

Further experimenting helped me find an answer to this. Hopefully it will help anyone else that is having issues with Display Orientation.

Go to the Images tab in the Designer:

0690X00000AtPG4QAN.png

In the right margin set the Layout Rotation to 90:

0690X00000AtPG9QAN.png

And it fixes my issue:

0690X00000AtPGEQA3.png

HP_it
Senior II
December 10, 2019

Nice walkthrough :)

With this, do you think it would be possible to switch between landscape and portrait during runtime - using an accelerometer data? This would be interesting to test!