Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

easy to expect setMaxAllowedWrites to work when _EEPROMEX_DEBUG is not set #29

Open
joeyh opened this issue Jan 31, 2020 · 0 comments
Open

Comments

@joeyh
Copy link

joeyh commented Jan 31, 2020

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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant