easy to expect setMaxAllowedWrites to work when _EEPROMEX_DEBUG is not set
Opened this issue · 0 comments
After reading the documentation for this library (both the README, and https://playground.arduino.cc/Code/EEPROMex/), I was at first under the misapprehension that setMaxAllowedWrites set a limit even when _EEPROMEX_DEBUG was not set. But that's wrong, as I later learned by reading the code; only when _EEPROMEX_DEBUG is set does it do anything. It would be easy to make this mistake and harm your hardware.
The only places that mention this, that I've found (now that I know what to look for) are some of the examples which mention that "More writes will only give errors when _EEPROMEX_DEBUG is set"
It would be good to at least mention _EEPROMEX_DEBUG where the documentation talks about setMaxAllowedWrites.
I think it would be a good idea to change the code to warn when setMaxAllowedWrites is used and _EEPROMEX_DEBUG is not set.
void EEPROMClassEx::setMaxAllowedWrites(int allowedWrites) {
#ifdef _EEPROMEX_DEBUG
_allowedWrites = allowedWrites;
#else
#warning "setMaxAllowedWrites has no effect since _EEPROMEX_DEBUG is not set"
#endif
}