This commit is contained in:
iranl
2024-08-31 22:13:59 +02:00
parent 119ecf2983
commit 18c56de16d
13 changed files with 288 additions and 207 deletions

View File

@@ -76,9 +76,9 @@ void MqttLogger::sendBuffer()
bool doSerial = this->mode==MqttLoggerMode::SerialOnly || this->mode==MqttLoggerMode::MqttAndSerial || this->mode==MqttLoggerMode::MqttAndSerialAndWeb || this->mode==MqttLoggerMode::SerialAndWeb;
bool doWebSerial = this->mode==MqttLoggerMode::MqttAndSerialAndWeb || this->mode==MqttLoggerMode::SerialAndWeb;
if (this->mode!=MqttLoggerMode::SerialOnly && this->mode!=MqttLoggerMode::SerialAndWeb && this->client != NULL)
if (this->mode!=MqttLoggerMode::SerialOnly && this->mode!=MqttLoggerMode::SerialAndWeb)
{
esp_mqtt_client_publish(this->client, topic, (const char*)this->buffer, this->bufferCnt, 0, 1);
esp_mqtt_client_publish(this->client, topic, (const char*)this->buffer, this->bufferCnt, 1, 1);
}
else if (this->mode == MqttLoggerMode::MqttAndSerialFallback)
{

View File

@@ -31,7 +31,8 @@ private:
const char* topic;
uint8_t* buffer;
uint8_t* bufferEnd;
uint16_t bufferCnt = 0, bufferSize = 0;
uint16_t bufferCnt = 0;
uint16_t bufferSize = 0;
esp_mqtt_client_handle_t client;
MqttLoggerMode mode;
void sendBuffer();