Skip to content

EEPROM.length() returns zero by default? #2280

Closed
@aphelps

Description

@aphelps

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleIssue is stale stage (outdated/stuck)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions