1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

String: changed default to 2 decimal digits

This commit is contained in:
Cristian Maglie 2013-06-21 21:23:12 +02:00 committed by Federico Fissore
parent 382fe3a080
commit 37825c1711
6 changed files with 12 additions and 12 deletions

View File

@ -325,14 +325,14 @@ unsigned char String::concat(unsigned long num)
unsigned char String::concat(float num)
{
char buf[20];
char* string = dtostrf(num, 8, 6, buf);
char* string = dtostrf(num, 8, 2, buf);
return concat(string, strlen(string));
}
unsigned char String::concat(double num)
{
char buf[20];
char* string = dtostrf(num, 8, 6, buf);
char* string = dtostrf(num, 8, 2, buf);
return concat(string, strlen(string));
}

View File

@ -69,8 +69,8 @@ public:
explicit String(unsigned int, unsigned char base=10);
explicit String(long, unsigned char base=10);
explicit String(unsigned long, unsigned char base=10);
explicit String(float, int decimalPlaces=6);
explicit String(double, int decimalPlaces=6);
explicit String(float, int decimalPlaces=2);
explicit String(double, int decimalPlaces=2);
~String(void);
// memory management

View File

@ -325,14 +325,14 @@ unsigned char String::concat(unsigned long num)
unsigned char String::concat(float num)
{
char buf[20];
char* string = dtostrf(num, 8, 6, buf);
char* string = dtostrf(num, 8, 2, buf);
return concat(string, strlen(string));
}
unsigned char String::concat(double num)
{
char buf[20];
char* string = dtostrf(num, 8, 6, buf);
char* string = dtostrf(num, 8, 2, buf);
return concat(string, strlen(string));
}

View File

@ -69,8 +69,8 @@ public:
explicit String(unsigned int, unsigned char base=10);
explicit String(long, unsigned char base=10);
explicit String(unsigned long, unsigned char base=10);
explicit String(float, int decimalPlaces=6);
explicit String(double, int decimalPlaces=6);
explicit String(float, int decimalPlaces=2);
explicit String(double, int decimalPlaces=2);
~String(void);
// memory management

View File

@ -326,14 +326,14 @@ unsigned char String::concat(unsigned long num)
unsigned char String::concat(float num)
{
char buf[20];
char* string = dtostrf(num, 8, 6, buf);
char* string = dtostrf(num, 8, 2, buf);
return concat(string, strlen(string));
}
unsigned char String::concat(double num)
{
char buf[20];
char* string = dtostrf(num, 8, 6, buf);
char* string = dtostrf(num, 8, 2, buf);
return concat(string, strlen(string));
}

View File

@ -69,8 +69,8 @@ public:
explicit String(unsigned int, unsigned char base=10);
explicit String(long, unsigned char base=10);
explicit String(unsigned long, unsigned char base=10);
explicit String(float, int decimalPlaces=6);
explicit String(double, int decimalPlaces=6);
explicit String(float, int decimalPlaces=2);
explicit String(double, int decimalPlaces=2);
~String(void);
// memory management