mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-09-11 09:04:53 +00:00
[Log] Keep (serial)port active even when no logging is being produced & fetched
This commit is contained in:
@@ -34,7 +34,7 @@ bool LogBuffer::getNext(LogDestination logDestination, uint32_t& timestamp, Stri
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t LogBuffer::getNrMessages(LogDestination logDestination) const
|
||||
uint32_t LogBuffer::getNrMessages(LogDestination logDestination)
|
||||
{
|
||||
uint32_t res{};
|
||||
|
||||
@@ -47,6 +47,10 @@ uint32_t LogBuffer::getNrMessages(LogDestination logDestination) const
|
||||
++res;
|
||||
}
|
||||
}
|
||||
|
||||
if (!res) {
|
||||
lastReadTimeStamp[logDestination] = millis(); // Reset if we aren't going to fetch a next message
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ struct LogBuffer {
|
||||
uint8_t & loglevel);
|
||||
|
||||
// Return the number of messages left for given log destination.
|
||||
uint32_t getNrMessages(LogDestination logDestination) const;
|
||||
uint32_t getNrMessages(LogDestination logDestination);
|
||||
|
||||
bool logActiveRead(LogDestination logDestination);
|
||||
|
||||
|
||||
@@ -220,9 +220,9 @@ ESPEasySerialPort EspEasy_Console_Port::getPortType() const
|
||||
|
||||
bool EspEasy_Console_Port::process_serialWriteBuffer()
|
||||
{
|
||||
if (_serialWriteBuffer.getNrMessages() == 0) { return false; }
|
||||
|
||||
if (_serial == nullptr) { return false; }
|
||||
if ((_serial == nullptr) || (_serialWriteBuffer.getNrMessages() == 0)) {
|
||||
return false;
|
||||
}
|
||||
#ifdef ESP32
|
||||
|
||||
if (!xPortCanYield()) { return false; }
|
||||
|
||||
@@ -60,7 +60,7 @@ bool LogHelper::getNext(LogDestination logDestination, uint32_t& timestamp, Stri
|
||||
return _logBuffer.getNext(logDestination, timestamp, message, loglevel);
|
||||
}
|
||||
|
||||
uint32_t LogHelper::getNrMessages(LogDestination logDestination) const
|
||||
uint32_t LogHelper::getNrMessages(LogDestination logDestination)
|
||||
{
|
||||
return _logBuffer.getNrMessages(logDestination);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
String & message,
|
||||
uint8_t & loglevel);
|
||||
|
||||
uint32_t getNrMessages(LogDestination logDestination) const;
|
||||
uint32_t getNrMessages(LogDestination logDestination);
|
||||
|
||||
void loop(bool serialOnly);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user