Adding clearFileBuffer and clearMaxFileBufferAvail

This commit is contained in:
PaulZC
2021-03-30 10:51:28 +01:00
parent fb76790842
commit 2ec3077fa6
3 changed files with 20 additions and 2 deletions
+2
View File
@@ -84,6 +84,8 @@ setFileBufferSize KEYWORD2
extractFileBufferData KEYWORD2
fileBufferAvailable KEYWORD2
getMaxFileBufferAvail KEYWORD2
clearFileBuffer KEYWORD2
clearMaxFileBufferAvail KEYWORD2
getPortSettings KEYWORD2
setPortOutput KEYWORD2
@@ -3055,6 +3055,20 @@ uint16_t SFE_UBLOX_GNSS::getMaxFileBufferAvail(void)
return (fileBufferMaxAvail);
}
// Clear the file buffer - discard all contents
void SFE_UBLOX_GNSS::clearFileBuffer(void)
{
if (fileBufferSize == 0) // Bail if the user has not called setFileBufferSize (probably redundant)
return;
fileBufferTail = fileBufferHead;
}
// Reset fileBufferMaxAvail
void SFE_UBLOX_GNSS::clearMaxFileBufferAvail(void)
{
fileBufferMaxAvail = 0;
}
// PRIVATE: Create the file buffer. Called by .begin
boolean SFE_UBLOX_GNSS::createFileBuffer(void)
{
+4 -2
View File
@@ -557,8 +557,10 @@ public:
// Support for data logging
void setFileBufferSize(uint16_t bufferSize); // Set the size of the file buffer. This must be called _before_ .begin.
uint16_t extractFileBufferData(uint8_t *destination, uint16_t numBytes); // Extract numBytes of data from the file buffer. Copy it to destination. It is the user's responsibility to ensure destination is large enough.
uint16_t fileBufferAvailable(void); // Returns the number of bytes available in file buffer which are waiting to be read
uint16_t getMaxFileBufferAvail(void); // Returns the maximum number of bytes which the file buffer has contained. Handy for checking the buffer is large enough to handle all the incoming data.
uint16_t fileBufferAvailable(void); // Returns the number of bytes available in file buffer which are waiting to be read
uint16_t getMaxFileBufferAvail(void); // Returns the maximum number of bytes which the file buffer has contained. Handy for checking the buffer is large enough to handle all the incoming data.
void clearFileBuffer(void); // Empty the file buffer - discard all contents
void clearMaxFileBufferAvail(void); // Reset fileBufferMaxAvail
// Specific commands