Arduino-EEPROMEx icon indicating copy to clipboard operation
Arduino-EEPROMEx copied to clipboard

wrong indentation or missing bracket?

Open powergt opened this issue 5 years ago • 1 comments

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?

powergt avatar Nov 06 '19 18:11 powergt

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;
}

lilo-chita avatar Mar 16 '22 00:03 lilo-chita