kopia lustrzana https://github.com/dl9rdz/rdz_ttgo_sonde
mqtt clientid done right
rodzic
23fa620aa6
commit
1d4f406dbb
|
@ -16,6 +16,7 @@ void mqttCallback(char* topic, byte* payload, unsigned int length) {
|
|||
Serial.println();
|
||||
}
|
||||
|
||||
static char buffer[21];
|
||||
void MQTT::init(const char* host, uint16_t port, const char* id, const char *username, const char *password, const char *prefix)
|
||||
{
|
||||
WiFi.hostByName(host, this->ip);
|
||||
|
@ -26,8 +27,8 @@ void MQTT::init(const char* host, uint16_t port, const char* id, const char *use
|
|||
|
||||
Serial.println("[MQTT] pubsub client");
|
||||
mqttClient.setServer(ip, port);
|
||||
char buffer[20];
|
||||
snprintf(buffer, 20, "%s%6ld", id, random(0, 1000));
|
||||
buffer[20] = 0;
|
||||
mqttClient.setClientId(buffer);
|
||||
if (strlen(password) > 0) {
|
||||
mqttClient.setCredentials(username, password);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const char *version_name = "rdzTTGOsonde";
|
||||
const char *version_id = "devel20211002";
|
||||
const char *version_id = "devel20211003";
|
||||
const int SPIFFS_MAJOR=2;
|
||||
const int SPIFFS_MINOR=16;
|
||||
|
|
Ładowanie…
Reference in New Issue