Skip to content

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

Description

@joeyh

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
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions