Skip to content

Commit da552d7

Browse files
bugfix mqtt
1 parent cdaf07c commit da552d7

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

EmbUI/EmbUI.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010
#include "MemoryInfo.h"
1111
#endif
1212

13+
#ifndef MAX_WS_CLIENTS
1314
#define MAX_WS_CLIENTS 4
15+
#endif
16+
#ifndef PUB_PERIOD
1417
#define PUB_PERIOD 10000 // Publication period, ms
18+
#endif
1519
#define SECONDARY_PERIOD 300U // second handler timer, ms
1620

1721
EmbUI embui;
@@ -392,8 +396,8 @@ void EmbUI::handle(){
392396
MDNS.update();
393397
#endif
394398
//_connected();
395-
//mqtt_handle();
396-
//udpLoop();
399+
mqtt_handle();
400+
udpLoop();
397401

398402
static unsigned long timer = 0;
399403
if (timer + SECONDARY_PERIOD > millis()) return;

EmbUI/mqtt.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ void emptyFunction(const String &, const String &){}
3939

4040
void EmbUI::mqtt(const String &pref, const String &host, int port, const String &user, const String &pass, void (*mqttFunction) (const String &topic, const String &payload), bool remotecontrol){
4141
if (host.length()==0){
42-
Serial.println(F("MQTT host is empty - disabled!"));
43-
return; // выходим если host не задан
42+
LOG(println, PSTR("UI: MQTT host is empty - disabled!"));
43+
return; // выходим если host не задан
4444
}
4545
String m_pref=param(FPSTR(P_m_pref));
4646
String m_host=param(FPSTR(P_m_host));
@@ -56,7 +56,7 @@ void EmbUI::mqtt(const String &pref, const String &host, int port, const String
5656
if(m_user == FPSTR(P_null)) var(FPSTR(P_m_user), user);
5757
if(m_pass == FPSTR(P_null)) var(FPSTR(P_m_pass), pass);
5858

59-
//Serial.println(F("MQTT Init completed"));
59+
LOG(println, PSTR("UI: MQTT Init completed"));
6060

6161
if (remotecontrol) embui.sysData.mqtt_remotecontrol = true;
6262
mqt = mqttFunction;

0 commit comments

Comments
 (0)