Skip to main content
May 23, 2021
Question

problem with float text

  • May 23, 2021
  • 1 reply
  • 1003 views

Hello

void MovingStep_Container::SetStep(uint16_t data)
{
 
 Unicode::snprintf(MovingStepTextBuffer, 20, "%d", data);
 MovingStepText.setWildcard(MovingStepTextBuffer);
 MovingStepText.invalidate();
		
}

Unicode::snprintf(MovingStepTextBuffer, 20, "%d", data); works without problem/

But if I write

Unicode::snprintf(MovingStepTextBuffer, 20, "%.1f", 0.1);

I get text "%.1f";

This topic has been closed for replies.

1 reply

TDK
Super User
May 23, 2021

Often, float support within printf is disabled by default in order to reduce code size. Look for a way to configure it within your build settings.

0693W00000APL94QAH.png

"If you feel a post has answered your question, please click ""Accept as Solution""."
MM..1
Chief III
May 23, 2021

@TDK​  this isnt settings for touchgfx

TouchGFX have special func for float read Unicode | TouchGFX Documentation

snprintfFloat(UnicodeChardst, uint16_t dstSize, const char format, const float value)Variant of snprintfFloats() for exactly one float only.