2022-10-26 04: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?
2022-10-26 07:25 AM
Try place get print after invalidate.
2022-10-26 08:53 AM
I try invalidate() before and after getTextWidth() and the result is the same.
2022-10-26 02: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?
2022-10-27 10:56 AM
Simply bug, try write version used for ST Emp info.