cancel
Showing results for 
Search instead for 
Did you mean: 

snprintf on wildcard only once

Msolinas
Senior

Hi friends, I have this problem:

static uint16_t txt[10];

Unicode::snprintfFloat(txt,6U,"%0.2f",functionGetFloat());
Unicode::snprintf( TextIndicatorBuffer,TEXTINDICATOR_SIZE,"%s %s",TypedText(T_STATEPRODUCTMANAGERWC5).getText(),txt);
TextIndicator.setWildcard(TextIndicatorBuffer);
TextIndicator.invalidate();
 
this work only once, after calling this function the second once, nothing change... some hint? thanks..
 
 
16 REPLIES 16
JTP1
Lead

Okey,i think you must have

TextIndicator.setWildcard(TextIndicatorBuffer);

since in some machine states use setTypedText funtion. Place this setWildcard in the states you use wildcard buffer.

I tried, but not work, if you see, was in the first comment in the start. Everyting seems work in first attempt I call the machine, but from the second one not work... 

this work very well..

Msolinas_1-1689589853338.png

 

I considering to open a touchgfx ticket... really strange issue.

JTP1
Lead

Sorry my brains are in holiday:grinning_face_with_sweat:

If you use setTypedText()- function in some machine state, you must return it also to the original single use id. Like this:

 

TextIndicator.setTypedText(touchgfx::TypedText(T___SINGLEUSE_IGD9));

 

Open your view-base.cpp and check singleuse ID there.

Maybe easier is to not use setTypedText, but do like this

 

Unicode::snprintf( TextIndicatorBuffer,TEXTINDICATOR_SIZE,"%s",TypedText(T_STATEPRODUCTMANAGERWC1).getText());

 

in the TIMING_ANSWER_HOLD, then the correct single-use ID stays.

Dear JTP1, I tried to change all lines in snprintf not using TextIndicator.setTypedText(blabla)... not work nothing at all! seems that if I use for this wildcard snprintf, after work once, it not will work over on this buffer.

if you look at the TIMING_ANSWER_HOLD, you can see the same for productSelectorCounter... and this work... 

Msolinas_0-1689593223800.png

 

It work onli the first called routine in this sequence... after stop .

 

I think it should work just fine. Here is my working example:

float f=0.21;

float  Screen1View::functionGetFloat()
{
	f+=.15;
	return(f);
}

void Screen1View::testButtonClicked()
{

	static uint16_t txt[10];
	Unicode::snprintfFloat(txt,6U,"%0.2f",functionGetFloat());
	//TextIndicator.setWildcard(TextIndicatorBuffer);
	TextIndicator.invalidate();
	Unicode::snprintf( TextIndicatorBuffer,TEXTINDICATOR_SIZE,"%s %s",TypedText(T_STATEPRODUCTMANAGERWC5).getText(),txt);

	TextIndicator.setTypedText(touchgfx::TypedText(T___SINGLEUSE_IGD9));
	TextIndicator.resizeToCurrentText();
	TextIndicator.invalidate();
}
void Screen1View::testbutton2Clicked()
{
	TextIndicator.invalidate();
	TextIndicator.setTypedText(TypedText(T_TEST));
	TextIndicator.resizeToCurrentText();
	TextIndicator.invalidate();
}

Texts:

JTP1_0-1689594323891.png

textarea settings:

JTP1_1-1689594708901.png

Depending on your text lenghts, you might need to invalidate text area also before change content. (if new is shorter than old, and you are changing the ID from typed ID to wildcard ID).

Check all your instances of 'TextIndicator'. If you share your code as code, not picture, and more code, somebody might find your problem :thumbs_up:

 

Msolinas
Senior

hi JTP1, I not solved the problem, I don't know why but this not work in my code. for time restrict in the work, by now I changed all in a simple retTypedText