1 parent 36c3197 commit 089597aCopy full SHA for 089597a
2 files changed
lib/MQTT/MqttClient.cpp
@@ -77,10 +77,9 @@ void MqttClient::begin() {
77
mqttClient.setKeepAlive(60);
78
79
// Configure client
80
- char nameBuffer[30];
81
- sprintf_P(nameBuffer, PSTR("epaper-display-%u"), ESP_CHIP_ID());
+ sprintf_P(this->clientName, PSTR("epaper-display-%u"), ESP_CHIP_ID());
+ mqttClient.setClientId(this->clientName);
82
83
- mqttClient.setClientId(nameBuffer);
84
if (this->username.length() > 0) {
85
mqttClient.setCredentials(this->username.c_str(), this->password.c_str());
86
}
lib/MQTT/MqttClient.h
@@ -42,6 +42,7 @@ class MqttClient {
42
String domain;
43
String username;
44
String password;
45
+ char clientName[30];
46
47
unsigned long lastConnectAttempt;
48
TVariableUpdateFn variableUpdateCallback;
0 commit comments