Add memory debugging functions

This code was taken from
http://andybrown.me.uk/wk/2011/01/01/debugging-avr-dynamic-memory-allocation/
and modified to:
 - Include the full license header
 - Not depend on #ifdef DEBUG.
 - Add a include guard to the .h file
Add scout.free bitlash command

This prints some more detailed memory information, instead of just
returning the number of free bytes like the regular free function.
Improve some debug output
Minor code formatting fix
Add StringBuffer class

This class will help simplify the handling of various buffers in this
library. It uses the Arduino String class for handling the memory, but
adds some methods that make efficient use of the String class easier
(which is not otherwise possible since it needs access to protected
members).
Let StringBuffer reserve memory block by block

Specifically, this adds a reserveBlock() method that does the same as
the regular reserve method (make sure the buffer size is at least the
value passed), but rounds the allocation size up to a multiple of the
block size (which is passed to the constructor).

Note that reserveBlock is only used by the StringBuffer methods and not
by the inherited String methods and operators. Specifically, this means
that using e.g. += will not do block reservation, but e.g. appendSprintf
will.
Add PrintToString class and printToString function

The class allows creating a Print object that prints to a string in
memory.

The function allows the same, but requires creating a new
function for every String printed to and requires the String to be
non-static global variables. This limits the usefulness of the function,
but until bitlash learns how to redirect its output to Print objects
instead of functions, this function should do.
Remove some duplicate function definitions
Add include guards to util/StringBuffer.h
Add StringBuffer::addJsonString() method

This method copies a string into the Stringbuffer, applying JSON-style
escaping and optionally also putting quotes around it.
Convert most buffers to use StringBuffer

This uses the StringBuffer object for most buffers in ScoutHandler.cpp
and Shell.cpp. The StringBuffer objects encapsulate all memory
management, automatically freeing up their memory when they go out of
scope.

When returning a StringBuffer object, the compiler automatically causes
the StringBuffer object itself to be allocated by the caller (return
value optimization) and the buffer is not copied (copy-elision) but just
passed to the caller and automatically freed in the caller.

When passing a buffer or string argument, some cases are modified to use
a const String&, but sometimes a const char* is still used, because
there isn't always a String object available in the caller (and creating
one currently always involved copying the entire string). This part
should be cleaned up a bit, but it's less important (since converting a
String or StringBuffer to char* is easy with the c_str() method).

This fixes #79.

Additionally, this commit moves the JSON escaping for commands ran by
field scouts from bitlash output function on the field scout to the
HQ-related functions on the lead scout, which make a lot more sense.

In addition to converting buffers, this also cleans up the buffer
handling in some places, which also fixes #86.
Add free() for remaining memory leaks
Let leadSignal accept a const String&

Every caller had a StringBuffer object that was converted to a char*, so
might a well pass the actual object.

Inside leadSignal, the String is now passed to the wifi client print
method instead of write. This means that the length stored in the
String object is used, saving a strlen call.
Add ConstString and ConstBuf classes

These classes make it easier to pass char* around, without forcing the
complete string copy that would be needed to turn them in to regular
String objects.
Add StringBuffer::concat version for uint8_t*
Pass a ConstBuf& instead of char* where possible

Previously, char* were passed, even when they were not guaranteed to be
nul-terminated (in particular, packets received over the mesh were not
guaranteed to be nul-terminated). Now, a ConstBuf object is passed,
which includes the length, preventing out-of-bounds reads.

This removes most of the c_str() calls from ScoutHandler. The ones
remaining are for interfacing with external things, like bitlash, js0n
and sprintf, which we cannot change to accept anything else.
Remove debug print from StringBuffer
Allow passing a ConstBuf to StringBuffer::appendJsonString

Indirectly, this also allows passing a char*, String& and StringBuffer&,
so the original char* version can be removed.
Fix if inside appendJsonString

There was a stray semicolon, that caused appendJsonString to only
reserve space and never actually copy bytes.
Fix escaping in appendJsonString

Previously, appendJsonString kept a char *out, pointing to the next
character to write that was valid throughout the entire function.
However, when characters needed to be escaped, usually the reserved
buffer would be too small and a second reallocation was needed. This
could change the address of the buffer, making the out pointer invalid.

To fix this, reset the out pointer at the start of each try and keep an
explicit count of bytes written so we know where to point it.