thijse / Arduino-EEPROMEx

Extended EEPROM library for Arduino
Other
170 stars 54 forks source link

wrong indentation or missing bracket? #28

Open powergt opened 4 years ago

powergt commented 4 years ago

in file: EEPROMex.cpp in function: void EEPROMClassEx::setMemPool(int base, int memSize) { //Base can only be adjusted if no addresses have already been issued if (_nextAvailableaddress == _base) _base = base; _nextAvailableaddress=_base; //<- this is outside if conditional statement: is right?

lilo-chita commented 2 years ago

Looks like missing brackets. If no addresses have already been issued we can change _base and _nextAvailableaddress setting them to the same value. Also without brackets debug check at the end of function is always false and makes no sense.

if (_nextAvailableaddress != _base) 
     Serial.println("Cannot change base, addresses have been issued");

So I assume it should be

if (_nextAvailableaddress == _base) {
    _base = base;
    _nextAvailableaddress=_base;
}