mirror of
https://github.com/wled/WLED.git
synced 2025-07-24 19:26:40 +00:00
MQTT cleanup & reduction
This commit is contained in:
parent
7b366d49d2
commit
52a1b0453c
@ -172,7 +172,9 @@ void updateInterfaces(uint8_t callMode)
|
||||
espalexaDevice->setColor(col[0], col[1], col[2]);
|
||||
}
|
||||
#endif
|
||||
doPublishMqtt = true;
|
||||
#ifndef WLED_DISABLE_MQTT
|
||||
publishMqtt();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -180,9 +182,6 @@ void handleTransitions()
|
||||
{
|
||||
//handle still pending interface update
|
||||
updateInterfaces(interfaceUpdateCallMode);
|
||||
#ifndef WLED_DISABLE_MQTT
|
||||
if (doPublishMqtt) publishMqtt();
|
||||
#endif
|
||||
|
||||
if (transitionActive && strip.getTransition() > 0) {
|
||||
float tper = (millis() - transitionStartTime)/(float)strip.getTransition();
|
||||
|
@ -47,8 +47,8 @@ void onMqttConnect(bool sessionPresent)
|
||||
|
||||
usermods.onMqttConnect(sessionPresent);
|
||||
|
||||
doPublishMqtt = true;
|
||||
DEBUG_PRINTLN(F("MQTT ready"));
|
||||
publishMqtt();
|
||||
}
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties
|
||||
if (index + len >= total) { // at end
|
||||
payloadStr[total] = '\0'; // terminate c style string
|
||||
} else {
|
||||
DEBUG_PRINTLN(F("Partial packet received."));
|
||||
DEBUG_PRINTLN(F("MQTT partial packet received."));
|
||||
return; // process next packet
|
||||
}
|
||||
DEBUG_PRINTLN(payloadStr);
|
||||
@ -131,13 +131,12 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties
|
||||
|
||||
void publishMqtt()
|
||||
{
|
||||
doPublishMqtt = false;
|
||||
if (!WLED_MQTT_CONNECTED) return;
|
||||
DEBUG_PRINTLN(F("Publish MQTT"));
|
||||
|
||||
#ifndef USERMOD_SMARTNEST
|
||||
char s[10];
|
||||
char subuf[38];
|
||||
char subuf[48];
|
||||
|
||||
sprintf_P(s, PSTR("%u"), bri);
|
||||
strlcpy(subuf, mqttDeviceTopic, 33);
|
||||
|
1
wled00/wled.h
Executable file → Normal file
1
wled00/wled.h
Executable file → Normal file
@ -705,7 +705,6 @@ WLED_GLOBAL byte optionType;
|
||||
|
||||
WLED_GLOBAL bool doSerializeConfig _INIT(false); // flag to initiate saving of config
|
||||
WLED_GLOBAL bool doReboot _INIT(false); // flag to initiate reboot from async handlers
|
||||
WLED_GLOBAL bool doPublishMqtt _INIT(false);
|
||||
|
||||
// status led
|
||||
#if defined(STATUSLED)
|
||||
|
Loading…
x
Reference in New Issue
Block a user