Description
Is there a design reason that EEPROM.length()
is returning the value of _user_defined_size
rather than _size
? It would appear that the _user_defined_size
is only set by the constructors and is never used, whereas the size specified to EEPROM.begin()
is the one that all other EEPROM functions use to limit the writable area.
To be consistent with the Arduino EEPROM API for AVRs (where EEPROM.length()
returns the actual EEPROM limit for the chip), it would seem to be more logical for EEPROM.length()
to either return the size specified in EEPROM.begin()
or to return SPI_FLASH_SEC_SIZE
when _user_defined_size
hasn't been set.
I'd be happy to submit a patch if appropriate.
For context, I'm working on converting some personal library code to work on my existing boards and a new one based on the Esp32, and ran into this probably while doing so.