OttoDIYLib icon indicating copy to clipboard operation
OttoDIYLib copied to clipboard

EEPROM values should have checksum or tag

Open anjok opened this issue 3 years ago • 4 comments

When I installed a sample sketch onto a new Nano - with otto.init(true), apparently there was garbage in the EEPROM, which resulted in very tense and weird leg positions.

The EEPROM values should have a tag at the start (say, "OTTO") or a checksum or both. If they don't match, the console should log an error and the values should be discarded.

anjok avatar Aug 29 '21 17:08 anjok

Hi @anjok Sounds like a good idea how can we implement?

cparrapa avatar Oct 04 '21 16:10 cparrapa

The easiest way would be to write a known start, say OTTO, then 2 bytes of length, then the Len bytes of data and then either a CRC or simply an XOR over the Len data bytes? On read you would check the prefix and the checksum and print an error if they don't match.

anjok avatar Oct 04 '21 19:10 anjok

The easiest way would be to write a known start, say OTTO, then 2 bytes of length, then the Len bytes of data and then either a CRC or simply an XOR over the Len data bytes? On read you would check the prefix and the checksum and print an error if they don't match.

Cool! can you put that in the code so that we can test?

cparrapa avatar Oct 11 '21 19:10 cparrapa

this has been added to the devel todo list ...

sfranzyshen avatar Apr 16 '24 21:04 sfranzyshen