File tree Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Original file line number Diff line number Diff line change 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
1818void 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 );
Original file line number Diff line number Diff 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*/
216213uint16_t EEPROMClass::length ()
217214{
218- return _user_defined_size ;
215+ return _size ;
219216}
220217
221218/*
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ typedef uint32_t nvs_handle;
3535class 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)
You can’t perform that action at this time.
0 commit comments