diff --git a/InfluxArduino.cpp b/InfluxArduino.cpp index 2b98231..f94f380 100644 --- a/InfluxArduino.cpp +++ b/InfluxArduino.cpp @@ -1,7 +1,7 @@ #include #include "InfluxArduino.hpp" -InfluxArduino::InfluxArduino() +InfluxArduino::InfluxArduino(bool debug) { } @@ -43,7 +43,7 @@ void InfluxArduino::authorize(const char username[], const char password[]) bool InfluxArduino::write(const char *measurement,const char *fieldString) { - write(measurement,"",fieldString); + return write(measurement,"",fieldString); } bool InfluxArduino::write(const char *measurement,const char *tagString,const char *fieldString) @@ -78,7 +78,7 @@ bool InfluxArduino::write(const char *measurement,const char *tagString,const ch //no tags sprintf(writeBuf,"%s %s",measurement,fieldString); //no comma between tags and fields } - Serial.println(writeBuf); + if(debug) Serial.println(writeBuf); _latestResponse = http.POST(writeBuf); http.end(); return _latestResponse == 204; @@ -92,4 +92,4 @@ int InfluxArduino::getResponse() bool InfluxArduino::isSecure() { return _isSecure; -} \ No newline at end of file +} diff --git a/InfluxArduino.hpp b/InfluxArduino.hpp index 98fc1a7..a2b96cc 100644 --- a/InfluxArduino.hpp +++ b/InfluxArduino.hpp @@ -4,7 +4,11 @@ class InfluxArduino { public: - InfluxArduino(); + + bool debug; + + InfluxArduino(bool debug=false); + ~InfluxArduino(); //specify the database, IP address and port (optional) for the database