getTextWidth() function returns wrong values only on target PCB.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-26 4:52 AM
A simple screen with one TextArea and one wildcard:
Below is the code that updates the field in the wildcard and displays the total width of the text on the terminal.
The problem is that in the simulator the getTextWidth() function works correctly, while on the target PCB (STM32L4P5) the data is read incorrectly. Below is a screenshot from the terminal and the PCB.
void Screen1View::tick()
{
counter++;
if (counter > 10)
{
counter = 0;
param++;
Unicode::snprintf(textArea1Buffer, TEXTAREA1_SIZE, "%d", param);
#ifdef SIMULATOR
touchgfx_printf("param: %d, getTextWidth: %u\n", param, textArea1.getTextWidth());
#else
TRACE("param: %d, getTextWidth: %u\r", param, textArea1.getTextWidth());
#endif
textArea1.invalidate();
}
}
Anyone had a similar problem? What could be the reason for this behavior?
- Labels:
-
Flash
-
STM32L4 Series
-
TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-26 7:25 AM
Try place get print after invalidate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-26 8:53 AM
I try invalidate() before and after getTextWidth() and the result is the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-26 2:18 PM
I found the reason why the getTextWidth() function is not working properly.
If I put the FontFlashSection in the external SPI FLASH memory then the getTextWidth() function returns wrong values:
FontFlashSection :
{
*(FontFlashSection FontFlashSection.*)
*(.gnu.linkonce.r.*)
. = ALIGN(0x4);
} >NOR_FLASH
If I put the FontFlashSection in the internal FLASH memory then the getTextWidth() function works fine:
FontFlashSection :
{
*(FontFlashSection FontFlashSection.*)
*(.gnu.linkonce.r.*)
. = ALIGN(0x4);
} >FLASH
Images placed in the external SPI FLASH memory (ExtFlashSection section) work correctly.
What could be the cause of this behavior?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-27 10:56 AM
Simply bug, try write version used for ST Emp info.
