Skip to content

Commit 1f699b9

Browse files
committed
Making UserAgent string constant in progmem
1 parent 24015cc commit 1f699b9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/InfluxDbClient.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
#define STRHELPER(x) #x
3131
#define STR(x) STRHELPER(x) // stringifier
3232

33-
#define INFLUXDB_CLIENT_USER_AGENT "influxdb-client-arduino/" INFLUXDB_CLIENT_VERSION
34-
3533
#if defined(ESP8266)
3634
# define INFLUXDB_CLIENT_PLATFORM "ESP8266"
3735
# define INFLUXDB_CLIENT_PLATFORM_VERSION STR(ARDUINO_ESP8266_GIT_DESC)
@@ -40,6 +38,7 @@
4038
# define INFLUXDB_CLIENT_PLATFORM_VERSION STR(ARDUINO_ESP32_GIT_DESC)
4139
#endif
4240

41+
static const char UserAgent[] PROGMEM = "influxdb-client-arduino/" INFLUXDB_CLIENT_VERSION " (" INFLUXDB_CLIENT_PLATFORM " " INFLUXDB_CLIENT_PLATFORM_VERSION ")";
4342

4443
// Uncomment bellow in case of a problem and rebuild sketch
4544
//#define INFLUXDB_CLIENT_DEBUG
@@ -222,8 +221,7 @@ bool InfluxDBClient::init() {
222221
}
223222
_httpClient.setReuse(false);
224223

225-
String userAgent(INFLUXDB_CLIENT_USER_AGENT " (" INFLUXDB_CLIENT_PLATFORM " " INFLUXDB_CLIENT_PLATFORM_VERSION ")");
226-
_httpClient.setUserAgent(userAgent);
224+
_httpClient.setUserAgent(UserAgent);
227225
return true;
228226
}
229227

0 commit comments

Comments
 (0)