Skip to main content
DElli.1
Associate III
June 4, 2020
Question

How to write decimal figures to TouchGFX Text Box

  • June 4, 2020
  • 1 reply
  • 4025 views

Hello!

Sorry I am new to stm32 and TouchGfx.

I am currently reading from SPI and want to relay that data to the screen using:

Unicode::snprintf(textCounterBuffer, 10, "%d", finalData);

textCounter.invalidate();

my problem is that the finalData is a decimal figure and the decimal gets cut off.

When I try to display the raw data number from my spi it displays fine and is a uint8_t variable. I need to adjust this number using:

finalData = (spiRxBuf/4096)*100;

but as I said before the screen does not display the number properly.

This topic has been closed for replies.

1 reply

Tesla DeLorean
Guru
June 4, 2020

%d is integer, for a floating point double use %lf

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
DElli.1
DElli.1Author
Associate III
June 4, 2020

Wow, thanks, I feel stupid for missing that.

Thank you! ​