From 79968b727a72586104f1ad6ef82e4873c1ca8e42 Mon Sep 17 00:00:00 2001 From: Arne van Iterson Date: Sun, 10 Mar 2024 17:43:20 +0100 Subject: [PATCH] Get IP address out of class files --- src/global.h | 4 ++++ src/helpers/mqtt.cpp | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/global.h b/src/global.h index 65c9151..9f8ce4f 100644 --- a/src/global.h +++ b/src/global.h @@ -7,6 +7,10 @@ #include #include +// MQTT +#define MQTT_ADDR "192.168.2.196" +#define MQTT_PORT 1883 + // DAC #define DAC1 25 diff --git a/src/helpers/mqtt.cpp b/src/helpers/mqtt.cpp index ff6d609..2d6bf9c 100644 --- a/src/helpers/mqtt.cpp +++ b/src/helpers/mqtt.cpp @@ -2,9 +2,10 @@ MqttTopic::MqttTopic(WiFiClient* espClient): wifiClient(espClient), client(PubSubClient(*espClient)) { - IPAddress server(192, 168, 2, 196); + IPAddress server; + server.fromString(MQTT_ADDR); - this->client.setServer(server, 1883); + this->client.setServer(server, MQTT_PORT); this->client.setCallback(this->callback); }