From 8dffe8747f5c06d959377a464e059057292e69d1 Mon Sep 17 00:00:00 2001 From: coolneng Date: Thu, 27 Nov 2025 13:23:58 +0100 Subject: [PATCH] Perform the MQTT connection during the setup --- src/main.cpp | 2 +- src/wlan.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index a4c5c2e..ea2dcb9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,7 +23,7 @@ void setup() { Serial.println("ERROR: The config file could not be loaded"); connect_wlan(config); - + connect_mqtt(mqtt_client, config); initialize_sensor(sensor, error_code, error_msg); } diff --git a/src/wlan.cpp b/src/wlan.cpp index bbd172f..4a7eaed 100644 --- a/src/wlan.cpp +++ b/src/wlan.cpp @@ -56,7 +56,6 @@ size_t construct_json(float *data, char *buffer, int buffer_size) { void mqtt_transfer(PubSubClient &client, Config *config, float *data) { char buffer[100]; - connect_mqtt(client, config); size_t payload_size = construct_json(data, buffer, 100); client.publish(config->topic, buffer, payload_size); Serial.println("Data transferred successfully");