mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-16 15:33:05 +01:00
intermediate: udp reader
This commit is contained in:
@@ -21,7 +21,7 @@ GwBuffer::~GwBuffer(){
|
||||
}
|
||||
void GwBuffer::reset(String reason)
|
||||
{
|
||||
LOG_DEBUG(GwLog::LOG,"reseting buffer %s, reason %s",this->name.c_str(),reason.c_str());
|
||||
if (! reason.isEmpty())LOG_DEBUG(GwLog::LOG,"reseting buffer %s, reason %s",this->name.c_str(),reason.c_str());
|
||||
writePointer = buffer;
|
||||
readPointer = buffer;
|
||||
lp("reset");
|
||||
@@ -33,6 +33,16 @@ size_t GwBuffer::freeSpace()
|
||||
}
|
||||
return readPointer - writePointer - 1;
|
||||
}
|
||||
size_t GwBuffer::continousSpace() const{
|
||||
if (readPointer <= writePointer){
|
||||
return bufferSize-offset(writePointer);
|
||||
}
|
||||
return readPointer-writePointer-1;
|
||||
}
|
||||
void GwBuffer::moveWp(size_t offset){
|
||||
if (offset > continousSpace()) return;
|
||||
writePointer+=offset;
|
||||
}
|
||||
size_t GwBuffer::usedSpace()
|
||||
{
|
||||
if (readPointer <= writePointer)
|
||||
|
||||
Reference in New Issue
Block a user