Simple Ring Buffer

I wrote a simple ring buffer class to use in my Spark apps. I register it as a string variable, and then I can read it from the Spark Cloud. It makes it easy to log arbitrary messages from my Spark Cores.

In case it’s useful to anyone else I put it up on github:

3 Likes

This is nice. I wonder if the same ring buffer can also be used directly to handle Serial traffic.

In addition to using it for general logging I’m also using it for the replies from a TcpClient instance:

if (client.available())
{
    ringBuffer.log(client.read());
}

(because I’m using the TcpClient for an HTTP request where I don’t really care what comes back, other than for debugging).