Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 02c3ec0

Browse filesBrowse files
authored
remove _user_defined_size from EEPROM (espressif#5775)
Summary Related to the issue espressif#5773 and espressif#2280. _user_defined_size is removed from EEPROMClass because it is redundant in the current code EEPROMClass::length() returns _size that is the true available size of EEPROM Impact _user_defined_size is removed from EEPROMClass EEPROMClass::length() returns _size that is the true available size of EEPROM
1 parent cb5a490 commit 02c3ec0
Copy full SHA for 02c3ec0

File tree

3 files changed

+9
-13
lines changed
Filter options

3 files changed

+9
-13
lines changed

‎libraries/EEPROM/examples/eeprom_class/eeprom_class.ino

Copy file name to clipboardExpand all lines: libraries/EEPROM/examples/eeprom_class/eeprom_class.ino
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@
1111
#include "EEPROM.h"
1212

1313
// Instantiate eeprom objects with parameter/argument names and sizes
14-
EEPROMClass NAMES("eeprom0", 0x500);
15-
EEPROMClass HEIGHT("eeprom1", 0x200);
16-
EEPROMClass AGE("eeprom2", 0x100);
14+
EEPROMClass NAMES("eeprom0");
15+
EEPROMClass HEIGHT("eeprom1");
16+
EEPROMClass AGE("eeprom2");
1717

1818
void setup() {
1919
Serial.begin(115200);
2020
delay(1000);
2121
Serial.println("Testing EEPROMClass\n");
22-
if (!NAMES.begin(NAMES.length())) {
22+
if (!NAMES.begin(0x500)) {
2323
Serial.println("Failed to initialise NAMES");
2424
Serial.println("Restarting...");
2525
delay(1000);
2626
ESP.restart();
2727
}
28-
if (!HEIGHT.begin(HEIGHT.length())) {
28+
if (!HEIGHT.begin(0x200)) {
2929
Serial.println("Failed to initialise HEIGHT");
3030
Serial.println("Restarting...");
3131
delay(1000);
3232
ESP.restart();
3333
}
34-
if (!AGE.begin(AGE.length())) {
34+
if (!AGE.begin(0x100)) {
3535
Serial.println("Failed to initialise AGE");
3636
Serial.println("Restarting...");
3737
delay(1000);

‎libraries/EEPROM/src/EEPROM.cpp

Copy file name to clipboardExpand all lines: libraries/EEPROM/src/EEPROM.cpp
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ EEPROMClass::EEPROMClass(void)
3434
, _size(0)
3535
, _dirty(false)
3636
, _name("eeprom")
37-
, _user_defined_size(0)
3837
{
3938
}
4039

@@ -45,17 +44,15 @@ EEPROMClass::EEPROMClass(uint32_t sector)
4544
, _size(0)
4645
, _dirty(false)
4746
, _name("eeprom")
48-
, _user_defined_size(0)
4947
{
5048
}
5149

52-
EEPROMClass::EEPROMClass(const char* name, uint32_t user_defined_size)
50+
EEPROMClass::EEPROMClass(const char* name)
5351
: _handle(0)
5452
, _data(0)
5553
, _size(0)
5654
, _dirty(false)
5755
, _name(name)
58-
, _user_defined_size(user_defined_size)
5956
{
6057
}
6158

@@ -215,7 +212,7 @@ uint8_t * EEPROMClass::getDataPtr() {
215212
*/
216213
uint16_t EEPROMClass::length ()
217214
{
218-
return _user_defined_size;
215+
return _size;
219216
}
220217

221218
/*

‎libraries/EEPROM/src/EEPROM.h

Copy file name to clipboardExpand all lines: libraries/EEPROM/src/EEPROM.h
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ typedef uint32_t nvs_handle;
3535
class EEPROMClass {
3636
public:
3737
EEPROMClass(uint32_t sector);
38-
EEPROMClass(const char* name, uint32_t user_defined_size);
38+
EEPROMClass(const char* name);
3939
EEPROMClass(void);
4040
~EEPROMClass(void);
4141

@@ -112,7 +112,6 @@ class EEPROMClass {
112112
size_t _size;
113113
bool _dirty;
114114
const char* _name;
115-
uint32_t _user_defined_size;
116115
};
117116

118117
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_EEPROM)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.