From 37825c1711446463f91ddf9150b203be5158bb9b Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 21 Jun 2013 21:23:12 +0200 Subject: [PATCH] String: changed default to 2 decimal digits --- hardware/arduino/avr/cores/arduino/WString.cpp | 4 ++-- hardware/arduino/avr/cores/arduino/WString.h | 4 ++-- hardware/arduino/avr/cores/robot/WString.cpp | 4 ++-- hardware/arduino/avr/cores/robot/WString.h | 4 ++-- hardware/arduino/sam/cores/arduino/WString.cpp | 4 ++-- hardware/arduino/sam/cores/arduino/WString.h | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/hardware/arduino/avr/cores/arduino/WString.cpp b/hardware/arduino/avr/cores/arduino/WString.cpp index 8c85cc592..48c30df77 100644 --- a/hardware/arduino/avr/cores/arduino/WString.cpp +++ b/hardware/arduino/avr/cores/arduino/WString.cpp @@ -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)); } diff --git a/hardware/arduino/avr/cores/arduino/WString.h b/hardware/arduino/avr/cores/arduino/WString.h index 44a841930..b3b9f1427 100644 --- a/hardware/arduino/avr/cores/arduino/WString.h +++ b/hardware/arduino/avr/cores/arduino/WString.h @@ -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 diff --git a/hardware/arduino/avr/cores/robot/WString.cpp b/hardware/arduino/avr/cores/robot/WString.cpp index 8c85cc592..48c30df77 100644 --- a/hardware/arduino/avr/cores/robot/WString.cpp +++ b/hardware/arduino/avr/cores/robot/WString.cpp @@ -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)); } diff --git a/hardware/arduino/avr/cores/robot/WString.h b/hardware/arduino/avr/cores/robot/WString.h index 4b9e64e0b..0404f767a 100644 --- a/hardware/arduino/avr/cores/robot/WString.h +++ b/hardware/arduino/avr/cores/robot/WString.h @@ -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 diff --git a/hardware/arduino/sam/cores/arduino/WString.cpp b/hardware/arduino/sam/cores/arduino/WString.cpp index de1a2f1b2..d6b344c2a 100644 --- a/hardware/arduino/sam/cores/arduino/WString.cpp +++ b/hardware/arduino/sam/cores/arduino/WString.cpp @@ -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)); } diff --git a/hardware/arduino/sam/cores/arduino/WString.h b/hardware/arduino/sam/cores/arduino/WString.h index 4b9e64e0b..0404f767a 100644 --- a/hardware/arduino/sam/cores/arduino/WString.h +++ b/hardware/arduino/sam/cores/arduino/WString.h @@ -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