mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 12:46:34 +00:00
Update xdrv_02_9_mqtt.ino
This commit is contained in:
parent
753f4bee31
commit
100e95f2cf
@ -522,11 +522,30 @@ bool MqttPublishLib(const char* topic, const uint8_t* payload, unsigned int plen
|
|||||||
// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT "Connection lost or message too large"));
|
// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT "Connection lost or message too large"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t written = MqttClient.write(payload, plength);
|
uint32_t written = MqttClient.write(payload, plength);
|
||||||
if (written != plength) {
|
if (written != plength) {
|
||||||
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT "Message too large"));
|
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT "Message too large"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
// Solves #6525??
|
||||||
|
const uint8_t* write_buf = payload;
|
||||||
|
uint32_t bytes_remaining = plength;
|
||||||
|
uint32_t bytes_to_write;
|
||||||
|
uint32_t written;
|
||||||
|
while (bytes_remaining > 0) {
|
||||||
|
bytes_to_write = (bytes_remaining > 256) ? 256 : bytes_remaining;
|
||||||
|
written = MqttClient.write(write_buf, bytes_to_write);
|
||||||
|
if (written != bytes_to_write) {
|
||||||
|
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT "Message too large"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
write_buf += written;
|
||||||
|
bytes_remaining -= written;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
MqttClient.endPublish();
|
MqttClient.endPublish();
|
||||||
|
|
||||||
yield(); // #3313
|
yield(); // #3313
|
||||||
|
Loading…
x
Reference in New Issue
Block a user