1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-13 05:53:06 +01:00

add some memory diagnostics

This commit is contained in:
andreas
2021-10-30 12:01:50 +02:00
parent 56aaf595b4
commit e7b2c6e756
14 changed files with 54 additions and 20 deletions

View File

@@ -15,6 +15,7 @@ class SerialWriter : public GwBufferWriter{
};
GwSerial::GwSerial(GwLog *logger, uart_port_t num, int id,bool allowRead)
{
LOG_DEBUG(GwLog::DEBUG,"creating GwSerial %p port %d",this,(int)num);
this->id=id;
this->logger = logger;
this->num = num;
@@ -79,6 +80,7 @@ void GwSerial::sendToClients(const char *buf,int sourceId){
}
void GwSerial::loop(bool handleRead){
write();
if (! isInitialized()) return;
if (! handleRead) return;
char buffer[10];
int rt=uart_read_bytes(num,(uint8_t *)(&buffer),10,0);
@@ -87,6 +89,7 @@ void GwSerial::loop(bool handleRead){
}
}
bool GwSerial::readMessages(GwBufferWriter *writer){
if (! isInitialized()) return false;
if (! allowRead) return false;
return readBuffer->fetchMessage(writer,'\n',true) == GwBuffer::OK;
}