Skip to content

Conversation

fedy0
Copy link
Contributor

@fedy0 fedy0 commented Jan 25, 2018

[1] Use multiple sector flash partitions defined by the name column in the partition table
[2] Added 'eeprom_class' example to show how to use the 'EEPROMClass'
[3] Included additional methods to the EEPROM library (similar to that of esp32 preference library)
[4] Added 'eeprom_extra' example to show how to use the additional methods
[5] Included in eeprom_class example how to use ESP32 Partition Manager https://github.com/francis94c/ESP32Partitions

Thanks for the opportunity to contribute in this wonderful repo :)

@fedy0 fedy0 changed the title Added EEPROMClass and Examples Add EEPROMClass and examples Jan 27, 2018
@the-freshlord
Copy link

@fedy0 Could an update method also be added that mirrors what the Arduino library has? Also, could this get merged soon? 😀

@fedy0
Copy link
Contributor Author

fedy0 commented Feb 17, 2018

@eman6576
The 'update' method's function as used in Arduino library has been taken care of within the EEPROM 'begin', 'write' & 'commit' methods of esp32. See code snippet below used within the write method to implement update.

// Optimise _dirty. Only flagged if data written is different.
uint8_t* pData = &_data[address];
if (*pData != value)
{
*pData = value;
_dirty = true;
}

When 'begin' method is called, it loads into the RAM (_data) the EEPROM memory block whose size is specified by its argument (max_size 4kB ~ 0x1000 or 4096)

Also when the 'commit' method is called, it performs the actual write to EEPROM memory if there is a change (ie. _dirty == true) in the buffered _data array in the RAM; thus reducing write cycles. Introducing an explicit update or even within the commit method would impact the time of executing a commit. This implementation would only be justified if commit method is used sparingly. I'd work on that and I hope it maybe helpful.

For now, to prolong the lifespan of the flash sector apportioned to the EEPROM, one calls commit() within the program only when necessary

Note: Without a call to commit and esp32 looses power supply, all data buffered in RAM(_data) is lost. So for an application that depends on one (battery) or two supplies (regular PSU & battery), any sense in power outage, a commit should be performed or before deep-sleep a commit should be performed too.

@me-no-dev me-no-dev merged commit 3310e2e into espressif:master Mar 4, 2018
@me-no-dev
Copy link
Member

nice!

@M10CUBE
Copy link

M10CUBE commented Mar 8, 2018

Hi,
Ecxelent work to eeprom library!
When running examples eeprom_extra and eeprom_class I got the error in serial port "Failed to initialise EEPROM" . It looks eeprom can not initialised ...
The example eeprom_write.ino works fine.
I have the latest ESP32 core installed.
Any sugestions?
Thaks a lot

@fedy0
Copy link
Contributor Author

fedy0 commented Mar 18, 2018

In the example 'eeprom_class.ino' read the introduction comments on how to use it.

Typically, you have to
install (download zip, extract, copy and paste inside '.../Documents/Arduino/tools)
this tool
(https://github.com/francis94c/ESP32Partitions)
ONCE in Arduino IDE to help you manage your partitions.

Also see it's ReadMe

If you don't have a 'tools' folder in your '.../Documents/Arduino/' directory, create one first then install the tool inside that folder. Restart your Arduino IDE and navigate to 'Tools' menu to access the 'esp32 partition manager'.

@Vorrias thanks for the compliments and sorry for the late reply

Curclamas pushed a commit to Curclamas/arduino-esp32 that referenced this pull request Aug 21, 2018
* enchanced EEPROMClass * Added eeprom examles and modified partition * added eeprom class and extra examples * No changes * No changes * added eeprom class and examples * fixed typo * length() returns user-defined sector size * updated and annotated example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants