Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to avoid EEPROM footprint #82

Open
ortegafernando opened this issue Sep 18, 2021 · 1 comment
Open

Try to avoid EEPROM footprint #82

ortegafernando opened this issue Sep 18, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@ortegafernando
Copy link

Hi, I have read your great library, and I am using it in memory, not in EEPROM.

But I found that INA.begin function does this:

#if defined(ESP32) || defined(ESP8266)
    EEPROM.begin(_EEPROM_size + _EEPROM_offset);  // If ESP32 then allocate 512 Bytes
    maxDevices = (_EEPROM_size) / sizeof(inaEE);  // and compute number of devices

Will EEPROM.begin be better in Class constructor to use it in conjunction of _expectedDevices.

I mean, all stuff about initializating EEPROM could be in Class constructor?

Thanks.

@ortegafernando ortegafernando added the bug Something isn't working label Sep 18, 2021
@SV-Zanshin SV-Zanshin added enhancement New feature or request and removed bug Something isn't working labels Sep 29, 2021
@SV-Zanshin
Copy link
Collaborator

I've changed this from a "bug" to an "enhancement" because the way the library currently works is not incorrect, it is just different from what you would like to see. The addition of the ESP32 and ESP8266 devices came after the initial library was developed and considering the amount of free RAM these devices have (at least compared to an Atmel microprocessor) a generous allocation of 512B is made. This allocation is not done during class instantiation, as the library was developed to push all of the actual initialization into the begin() method rather than class instantiation. This gives greater flexibility at runtime where sometimes the hardware is not initialized by Arduino IDE at the point in time where the class is instantiated - many libraries use this "delay" tactic.

It would be possible to change this 512B allocation to a size of (expected_devices * instance size) to reduce the memory footprint.

Is there a specific problem that you are seeing, or is this more of a general discussion as to how to make the library more generally useable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants