1. Revert the change to memcpytoeepromwithchecksum() so
it can be used to read old EEPROM data that was written
with the old broken checksum algorithm
2. Store the coordinate system data in tagged NVS using
a class mechanism modeled on the Settings classes
3. Convert the #defines that defined the coordinate
system indices into an enum, for better error checking.
4. Propagate the old-format EEPROM data into the new format
in a way that is resilient to N_AXIS differences.
5. The new structure avoids unnecessary EEPROM accesses
as a result of the value caching inherent in the Settings-
inspired class structure. At the same time, it avoids
the possibility of read failure at runtime.
6. Fixed a longstanding FIXME involving the reuse of the
ijk field for non-IJK purposes, thus avoiding confusion
and possible overflow. ijk only needs 3 float values since
arc center offsets only exist for cartesian coordinates,
while the coordinate data that was previously stored in
ijk temporarily can have 6 float values.
7. Revised the code that handles P values for G10 to be more
explicit in its handling of the 0 value and the conversion
to coordinate indices for non-0 values.
8. Changed a number of occurrences of “MAXNAXIS * sizeof(float)”
to “sizeof(TheDestinationArray)”.
9. Cleaned up and simplified the code in Report.cpp that
formats the coordinate system report. The resulting code
no longer requires a careful pre-calculation of the
maximum string length, so it should be resistant to
buffer overflow.
10. – The build info is still stored in EEPROM. It ought
to be moved to NVS in a similar fashion, thus eliminating
the use of EEPROM entirely.
Testing: The first time that you run this firmware on
a system that does not have the new storage format,
the old data will be copied to the new format at startup,
with a series of messages like:
[MSG:Propagating G54 data to NVS format]
On subsequent reboots, the data will be in the new format
and there will be no more messages.
You can display the data with the usual command:
$GCode/Offsets or $#
To re-test, you can erase the entire NVS area with
$Settings/Erase or $NVX
The next reboot will then re-propagate the coordinate data.
Note that $Settings/Erase will erase the entire NVS area,
which will make all settings return to their defaults –
not only the coordinates.
You might think that $RST=gcode would reset just the
coordinate systems. In fact, it does so, but it does
it by setting all the G54 etc. coordinate systems to 0,
retaining the new format. It does not wipe out the
new-format entries and thus make the old format data
visible for re-propagation.