Limiting max. precision in dtostrf()

This commit is contained in:
tekka007
2015-12-28 18:56:43 +01:00
parent 372569acc0
commit 3d8fbdff66
+1 -1
View File
@@ -100,7 +100,7 @@ char* MyMessage::getString(char *buffer) const {
} else if (payloadType == P_ULONG32) {
ultoa(ulValue, buffer, 10);
} else if (payloadType == P_FLOAT32) {
dtostrf(fValue,2,fPrecision,buffer);
dtostrf(fValue,2,min(fPrecision, 8),buffer);
} else if (payloadType == P_CUSTOM) {
return getCustomString(buffer);
}