Skip to content

Commit

Permalink
Merge pull request tobiasschuerg#27 from amfasis/patch-1
Browse files Browse the repository at this point in the history
Add the ability to specify decimal places for float values
  • Loading branch information
tobiasschuerg authored Jan 12, 2020
2 parents 93ab86a + dd35c5f commit 5ad7f2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions InfluxData.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class InfluxData {
InfluxData(String measurement) : _measurement(measurement) {}

void addTag(String key, String value) { _tags += "," + key + "=" + value; }
void addValue(String key, float value) {
void addValue(String key, float value, int decimals = 2) {
_values = (_values == "") ? (" ") : (_values += ",");
_values += key + "=" + String(value);
_values += key + "=" + String(value, decimals);
}
void addValueString(String key, String value) {
_values = (_values == "") ? (" ") : (_values += ",");
Expand Down

0 comments on commit 5ad7f2a

Please sign in to comment.