[gnoduino: 1/4] Squashed 'hardware/' changes from 0e2ddbe..f2271ed
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnoduino: 1/4] Squashed 'hardware/' changes from 0e2ddbe..f2271ed
- Date: Sun, 8 Jul 2012 13:21:47 +0000 (UTC)
commit f4febb8129b173599f8258c389bbc2ca10435b66
Author: Lucian Langa <lucilanga gnome org>
Date: Fri Jul 6 21:27:19 2012 +0200
Squashed 'hardware/' changes from 0e2ddbe..f2271ed
f2271ed Print "ovf" if float to be printed doesn't fit in a long.
32e8179 Print "inf" for infinite floating point numbers (using isinf()).
56c96d4 Adding write(str) and write(buf, size) for USB CDC.
git-subtree-dir: hardware
git-subtree-split: f2271edf13a96819a0f86497dafadf448d495610
arduino/cores/arduino/Print.cpp | 3 +++
arduino/cores/arduino/USBAPI.h | 1 +
2 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/arduino/cores/arduino/Print.cpp b/arduino/cores/arduino/Print.cpp
index 98969f5..53961ec 100755
--- a/arduino/cores/arduino/Print.cpp
+++ b/arduino/cores/arduino/Print.cpp
@@ -227,6 +227,9 @@ size_t Print::printFloat(double number, uint8_t digits)
size_t n = 0;
if (isnan(number)) return print("nan");
+ if (isinf(number)) return print("inf");
+ if (number > 4294967040.0) return print ("ovf"); // constant determined empirically
+ if (number <-4294967040.0) return print ("ovf"); // constant determined empirically
// Handle negative numbers
if (number < 0.0)
diff --git a/arduino/cores/arduino/USBAPI.h b/arduino/cores/arduino/USBAPI.h
index d5abdb6..eb2e593 100644
--- a/arduino/cores/arduino/USBAPI.h
+++ b/arduino/cores/arduino/USBAPI.h
@@ -39,6 +39,7 @@ public:
virtual int read(void);
virtual void flush(void);
virtual size_t write(uint8_t);
+ using Print::write; // pull in write(str) and write(buf, size) from Print
operator bool();
};
extern Serial_ Serial;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]