From 2e6cee3429d49b510d6e966ee59bc5aebd7aa3b7 Mon Sep 17 00:00:00 2001 From: proddy Date: Wed, 22 Jul 2020 16:10:12 +0200 Subject: [PATCH] remove passing mqtt client to function --- src/mqtt.cpp | 5 +++-- src/mqtt.h | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 1914009ca..a616ec4c8 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -284,8 +284,9 @@ char * Mqtt::make_topic(char * result, const std::string & topic) { return result; } -void Mqtt::start(AsyncMqttClient * mqttClient) { - mqttClient_ = mqttClient; // copy over from esp8266-react's MQTT service +void Mqtt::start() { + + mqttClient_ = EMSESP::esp8266React.getMqttClient(); // get the hostname, which we'll use to prefix to all topics EMSESP::esp8266React.getWiFiSettingsService()->read([&](WiFiSettings & wifiSettings) { hostname_ = wifiSettings.hostname.c_str(); }); diff --git a/src/mqtt.h b/src/mqtt.h index 06b9d3f8d..992286d12 100644 --- a/src/mqtt.h +++ b/src/mqtt.h @@ -59,8 +59,7 @@ struct MqttMessage { class Mqtt { public: void loop(); - - void start(AsyncMqttClient * mqttClient); + void start(); void set_publish_time(uint16_t publish_time); void set_qos(uint8_t mqtt_qos);