compile options affects snprintf()--and in a bad way

Status
Not open for further replies.

KrisKasprzak

Well-known member
All,

I wrote a very helpful library that will let you print numbers but mask only the digits that have changed. My need was to update a number and not have the flicker problem with painting a box before drawing the text. It works with ints and floats.

However....I'm using he snprintf to do the formatting but works only if I compile with fastest options. Have a try...

// compile with fastest snprintf will return "0.1234"
// compile with smallest snprintf will return ""

float Data = 0.1234;

Serial.print("S"); // just so you can see start
snprintf(buf, sizeof buf, "%.4f", Data);
Serial.print(buf);
Serial.print("E"); // just so you can see end


Anyone know a remedy?

I hate have to resort back to dissecting a number to get individual digits and such.
 
Strip the line numbers, #define NO_CONFIG_H and include it in your program. It worked when I tried it.
 
Status
Not open for further replies.
Back
Top