This repository has been archived on 2025-02-01. You can view files and clone it, but cannot push or open issues or pull requests.
reprapfirmware-dc42/src/DuetNG/TransactionBufferReader.cpp
David Crocker 58a7aa11d8 Release 1.15 beta 3
Further optimisation of step generation ISR
Don't allow more than half the capacity of the DDA queue to be frozen
Duet WiFi: print additional info from WiFi module
2016-07-16 08:21:19 +01:00

31 lines
551 B
C++

/*
* TransactionBufferReader.cpp
*
* Created on: 7 Jul 2016
* Author: David
*/
#include "TransactionBufferReader.h"
TransactionBufferReader::TransactionBufferReader(TransactionBuffer& tb)
: buf(tb), offset(0), ok(true)
{
}
const char* TransactionBufferReader::GetString(size_t fieldWidth)
{
if (ok)
{
if (offset + fieldWidth <= buf.GetLength())
{
buf.EnsureNull(offset + fieldWidth - 1);
const char* rslt = buf.GetData() + offset;
offset += fieldWidth;
return rslt;
}
ok = false;
}
return "**ERROR**";
}
// End