-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Missing EEPROM.length() method #2066
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
Comments
The current EEPROM Library implementation for ESP8266 requires you to initialize the size in the @igrr I am afraid that the change is not as straightforward as adding the |
Why the function begin (4096), creates a buffer of the same size? In my view the EEPROM lib would be used to save RAM too, does not make sense I create a buffer of the same size. I think what could be done is to have a smaller buffer when full, write the data in the EEPROM. In my implementation I need to store a list of rfid tags , then I plan to allocate the maximum size: 4096 in this case I would finish with two buffers = 2 * 4096 It would be viable to improve this design? |
I think the EEPROMClass::begin should also have a version like EEPROMClass::begin(startaddress,size) After that you can only read/write addresses between startaddress and (startaddress+size-1) This way you can have a very large EEPROM, but never allocate more memory than needed for the current read/write actions. PS: There should be functions to retrieve the size of the EEPROM and the current min- and max- read/write addresses (-1 if not between begin and end() ?) PS 2: And EEPROMClass::end() should return the result of commit(); |
Hello, |
Excuse me, what does this repository have to do with arduino.org? |
Maybe I am wrong, but I thought you had a problem with missing a function of From: Ivan Grokhotkov [mailto:[email protected]] Excuse me, what does this repository have to do with arduino.org? You are receiving this because you commented. No virus found in this message. |
In Arduino, EEPROM library is normally part of the core and not a standalone library. So there is one version for AVR core, one for ARM, one for ESP8266, etc. All these versions of EEPROM library are derived from the original AVR version as seen in Arduino.cc project. However as you may have noticed that original library (Arduino.cc one) has recently been updated with some new methods. The libraries which were derived from it may not have been updated by their maintainers yet to match the new API of Arduino.cc's library. This is the case here (we haven't updated our library to use the new API) and also the case with Arduino.org's AVR library (they haven't updated their library either). |
Some fly-by commenting and 2 observations.
for (auto &data : EEPROM) { data = 0x00 }
|
@ricardojlrufino I can add the length method without problems. As for the size of the buffer, it is meant for reducing wear on the underlying flash, which is also why commit() exists. This is due to the inherent difference in hardware between AVR and ESP: the ESP doesn't have EEPROM, it is just emulated on flash. |
@pgScorpio about EEPROMClass::begin(startaddress,size), that is unnecessary. If you need different addresses, just instantiate a diffrent EEPROM object, with a different address passed to the constructor:
|
@middelink about begin() / end(), that's a BigDiscussion topic related to Arduino bad design. In fact, even their current EEPROM v2 is not well designed, they implemented additional classes to try and sort-of mimic C++ iterators. |
@devyte The main point, it's make API compatible |
Closed via #3855 . |
Hardware
Hardware: ESP-12f
Core Version: 2.2.0
Description
The EEPROM.length () method is not available for the ESP
Ref: https://www.arduino.cc/en/Tutorial/EEPROMClear
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: