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
[ESP8266] Conflict if EEPROM is used in main code. #41
Comments
EEPROM.put((deviceNumber *sizeof(inaEE))+1024,inaEE); EEPROM.get((deviceNumber *sizeof(inaEE))+1024,inaEE); Should put data at 1024 start address. |
Adding the 1024 byte offset would break all other implementations, so making that change to the base software is not possible. It might be possible to change the class instantiation to have an optional offset for the beginning of the EEPROM used by the library, e.g. |
And if offset is specified in istantiation no EEPROM.begin should be done in library. |
At the moment, the INA library initializes with a EEPROM.begin(512) for the 8266. So in order to remain backwards compatible, I wouldn't want to change this. I would expect that if the library has already been initialized a second call won't re-initialize it. Can you check the 8266 code to see what would happen with a second call to begin()? |
|
The code indicates that the old data is only destroyed and space re-allocated if the size is different. Perhaps then adding 2 parameters to the instantiation call might be the solution :
|
I'm on the road (or, better put, at sea) at the moment and don't have access to an Arduino. Once I get access I'll look into making these changes and will see if that can be implemented. |
I've just looked into the open issues - sorry for the delay. I'll see about changing the class instantiation to accommodate this |
Sorry for the lengthy delay, this issue slipped between the cracks. Now that I have some time on my hands I will look into it. |
Here's an option - I can expose a public variable, "EEPROM_offset", which will be applied to all EEPROM Read & Write commands. The default is "0" but another value can be written to the variable before the begin() method is called. That way a specific number of bytes at the beginning of the EEPROM range can be reserved. |
What is the state of this issue? I have the same problem with an ESP32 |
I still don't want to change the instantiation or add ESP32 and ESP8266 specific code, so I think that the last suggestion, exposing a variable "_EEPROM_offset" which can be set prior to calling "begin()" which will apply an offset to the first EEPROM address used. |
I use in my esp8266 emulated EEPROM in main code and begin it with (4096) in size for main
code purpose(only 1024 byte used), is possible to avoid in library eeprom size call and add start pointer so i can initialize bigger area and put ina2xx data upper o lower main code data?
The text was updated successfully, but these errors were encountered: