Setup to find data corruption and general clean up
This data corruption problem is very difficult. Just changing the code
a little bit changes whether the problem even happens and what is
affected. I need these changes in the main branch so I can operate with
the extra debug code always available and turned on.
Everything is setup such that if M100 is turned off or DEBUG(ECHO) is
turned off, the code is not affected. M100 has been made a little bit
more inteligent so it can display the serial command buffers in a more
meaningful way (because the data corruption seems to often times end up
in that area).
All the memory accesses need to be unsigned char in order to avoid
false errors being detected. Two new features are available for
developers to call into the M100 functionality to look for data
corruption.
M100 had numerious changes and quit working. Part of the problem is
the overloading of the SERIAL_PROTOCOL functions. Also, some of the
address arithmatic was changed to use char *ptr and passing ptr into the
SERIAL_PROTOCOL functions caused them to try to print a string instead
of a number. M100 is working again. Let's keep it that way!
M100 has been expanded to now have a function int
free_memory_is_corrupted() that can be called from other code to see if
the free space is still contiguous. It may make sense to add a flag to
control its verbose nature but right now, the extra chit chat is very
helpful to know int free_memory_is_corrupted() is doing the right thing
and what it found at various points when it was called. A 'Show &
Tell' is coming up with int free_memory_is_corrupted().
G20/21 and M149 support, and code_value() refactor
This is an update of MarlinDev PR #196.
G20/21: support for switching input units between millimeters and
inches.
M149: support for changing input temperature units.
In support of these changes, code_value() and code_value_short() are
replaced with an array of functions which handle converting to the
proper types and/or units.