cancel
Showing results for 
Search instead for 
Did you mean: 

problem with float text

EEuge
Senior

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";

2 REPLIES 2
TDK
Guru

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".

@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.