sparkfun / SparkFun_External_EEPROM_Arduino_Library

An Arduino library for the easy control of external I2C EEPROMs.
Other
54 stars 14 forks source link

Option to make bulk write only write changes #37

Closed merlinz01 closed 3 months ago

merlinz01 commented 3 months ago

Subject of the issue

Currently when you call put() with a struct, the entire struct is written to the memory whether or not anything changed. Could we have a method that checks it byte-by-byte and writes only the changed bytes, in order to preserve the EEPROM lifetime?

Or does the EEPROM do this internally?

Your workbench

Steps to reproduce

Call eeprom.put(MyStruct).

Expected behavior

There should be a method or parameter that does the same thing but checks for changes so that we don't put unnecessary wear on the EEPROM.

Actual behavior

The entire struct is written whether or not it changed.

merlinz01 commented 3 months ago

I have opened a PR with an implementation.

nseidle commented 3 months ago

This is wonderful! Thank you for your contribution.