mirror of
https://github.com/wled/WLED.git
synced 2025-07-17 07:46:32 +00:00
Minor MQTT optimisation.
This commit is contained in:
parent
2ff49cf657
commit
6504fb68b6
@ -103,11 +103,7 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties
|
|||||||
colorFromDecOrHexString(col, payloadStr);
|
colorFromDecOrHexString(col, payloadStr);
|
||||||
colorUpdated(CALL_MODE_DIRECT_CHANGE);
|
colorUpdated(CALL_MODE_DIRECT_CHANGE);
|
||||||
} else if (strcmp_P(topic, PSTR("/api")) == 0) {
|
} else if (strcmp_P(topic, PSTR("/api")) == 0) {
|
||||||
if (!requestJSONBufferLock(15)) {
|
if (requestJSONBufferLock(15)) {
|
||||||
delete[] payloadStr;
|
|
||||||
payloadStr = nullptr;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (payloadStr[0] == '{') { //JSON API
|
if (payloadStr[0] == '{') { //JSON API
|
||||||
deserializeJson(*pDoc, payloadStr);
|
deserializeJson(*pDoc, payloadStr);
|
||||||
deserializeState(pDoc->as<JsonObject>());
|
deserializeState(pDoc->as<JsonObject>());
|
||||||
@ -117,6 +113,7 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties
|
|||||||
handleSet(nullptr, apireq);
|
handleSet(nullptr, apireq);
|
||||||
}
|
}
|
||||||
releaseJSONBufferLock();
|
releaseJSONBufferLock();
|
||||||
|
}
|
||||||
} else if (strlen(topic) != 0) {
|
} else if (strlen(topic) != 0) {
|
||||||
// non standard topic, check with usermods
|
// non standard topic, check with usermods
|
||||||
usermods.onMqttMessage(topic, payloadStr);
|
usermods.onMqttMessage(topic, payloadStr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user