2021-12-14 06:36 AM
I have previously used V4.12 for projects and have been able to set Resouce Text to any colour. After upgrading to V4.18 the text colours can be set in Designer but on the target they seem to be limited to the primary colours and their combinations (three colour bits per pixel). How to I get the full range of RGB565 colours to be used with resource text on 4.18? I tried 4.18.1 and it made no difference. I am using the IAR IDE.
Solved! Go to Solution.
2021-12-20 03:03 AM
I was hoping that somebody else could confirm that this is an issue.
As a work around I have set up a macro to convert the RGB colour values into 565, to replace the use of setColorFromRGB():
#define M_TextColour(x, y, z) (uint32_t)( ( (x << 8) & 0xF800) + ( (y << 3) & 0x07E0) + ( (z >> 3) & 0x003F) ) /* Convert RGB to the colour value used by text resources */
This makes the text display correctly.
2021-12-16 09:19 PM
Hello Water123,
How did you figure out that on target only primary colors are possible for the text color ?
Are you sure it is not a problem on display side ?
With your current hardware, you see a certain text color with 4.12 but with 4.18 the text color is different even though the color set in the code is the same, is that right ?
/Alexandre
2021-12-17 03:06 AM
If I use a colour code in TouchGFX for a shape or line the colour displays correctly; if I use resource text, the same colour code does not display correctly. After some investigation it appears that setColor for text has to have the colour setting in RGB565 to work correctly with my 565 hardware.
2021-12-19 04:34 PM
Hello Water123,
So if I understand correctly you found a workaround to your issue right ?
If that's the case, could you add the code you modified/added to fix your issue ?
Also, if your problem is solved, please close this topic by choosing Select as Best on your answer ^^
/Alexandre
2021-12-20 03:03 AM
I was hoping that somebody else could confirm that this is an issue.
As a work around I have set up a macro to convert the RGB colour values into 565, to replace the use of setColorFromRGB():
#define M_TextColour(x, y, z) (uint32_t)( ( (x << 8) & 0xF800) + ( (y << 3) & 0x07E0) + ( (z >> 3) & 0x003F) ) /* Convert RGB to the colour value used by text resources */
This makes the text display correctly.
2021-12-20 11:44 PM
Hi
my textcolor doent show the true color too. HW is 565. would you tell me where to add the micro you ve written (#define M_TextColour(x, y, z) (uint32_t)( ( (x << 8) & 0xF800) + ( (y << 3) & 0x07E0) + ( (z >> 3) & 0x003F) ) /* Convert RGB to the colour value used by text resources */)
how to replace it with setColorFromRGB().?
2021-12-21 01:14 AM
Hi Water123,
In order to reproduce and get it fixed, could you provide the steps needed to see the issue ? Otherwise an example project would be also very useful :D
What is your target board ?
Thank you very much for your feedback ~
/Alexandre
2021-12-21 01:32 AM
Zakba. 1
Add this macro definition somewhere in the same file as the call to set the colour or in an include file that is used by the file:
#define TextColourConvert(x, y, z) (uint32_t)( ( (x << 8) & 0xF800) + ( (y << 3) & 0x07E0) + ( (z >> 3) & 0x003F) )
I use a global include file containing a variety of system-wide definitions that is included in every .c and .cpp file.
Where you would normally define the text colour with:
Text.setColor(touchgfx::Color::getColorFromRGB(ColourR, ColourG, ColourB) );
Use this instead:
Text.setColor(TextColourConvert(ColourR, ColourG, ColourB) );
Replacing ColourR, ColourG and ColourB with the colour co-ordinates you want to use.
This should make your test display in the correct colour.
2021-12-21 01:50 AM
Alexandre RENOUX
The hardware used is a custom system using an STM32L4R7 driving the LCD through the on-board controller and graphics accellerator, connected using the 565 implementation of the RGB bus; the graphics controller was set up using MX-Cube. We originally used the 429 disco board to develop ideas so I expect the issue will show up using this board also.
In TouchGFX designer (V4.18) create a screen that inclues some resource text in a colour that is not white; I found the issue using 121, 227, 255. In the generated code the colour is set using:
Text.setColor(touchgfx::Color::getColorFromRGB(121, 227, 255) );
In designer the text displays as the correct colour. but on the hardware when the code is run, the text displays as a purple colour. Other screen elements such as lines and shapes display in the correct colour, I have only found the problem with resource text.
As explained above getColorFromRGB() returns a 24-bit colour value while setColor() for the text appears to require a 16-bit (565) colour value, for 565 systems. Replacing the call to getColorFromRGB() with the macro above solves the problem.
I can share more detail on this if you require it.
2022-01-03 10:50 PM
Hello Water123,
I managed to reproduce the issue on the F429-DISCO Rev C01.
I will report to the dev team and let you know when it's fixed.
It's probably a board specific issue since on the F746-DISCO the problem does not occur.
Sorry for the inconvenience,
/Alexandre