Register / Login  |  Desktop view  |  Jump to bottom of page

tcMenu Arduinio library » menuMgr

Author: dsap4004
29/04/2019 17:30:30
I would like to use the menuMgr functions to load and save menu values into the eeprom. I am reading through the documentation and I see something about menuMgr.save(); and menu.Mgr.load() but when I use these in a sketch I get errors related to not passing arguments to the functions. I'm not sure what data type the eeprom object is supposed to be and I'm not sure what is meant by a magic key. According to the documentation passing no arguments means it on menuMgr.save(); it saves all changed items and on menuMgr.load(); it loads all items. Are there any other examples of this being used? I have a way of storing items to eeprom in my full project already but it would be nice to simplify it from the menu manager.

Author: davetcc
29/04/2019 17:42:59
Apologies for hitting this, I’ll get the documentation up to date.

The eeprom is an instance of an EepromAbstraction from IoAbstraction, see the two linked examples for usage. The magic number is just an integer that is written on save and then checked on load. It just means it won’t load unless it finds that value.

Please see this example for inbuilt AVR ROM (Uno Mega etc)

https://github.com/davetcc/tcMenuLib/blob/master/examples/ledFlashNoRemote/ledFlashNoRemote.ino

And for i2c rom on 32 bit boards:

https://github.com/davetcc/tcMenuLib/blob/master/examples/takeOverDisplay/takeOverDisplay.ino

Let me know if that helps.

Thanks,
Dave

Author: dsap4004
29/04/2019 18:00:34
This gives me somewhat of an idea of how to implement but I'm still getting the error "'AvrEeprom' does not name a type" when I try to "AvrEeprom eeprom;" in my sketch. When I try the example "take over display" I'm using local eeprom not I2c eeprom so if I uncomment the "AvrEeprom eeprom;" and comment out the I2c version I get "'AvrEeprom' does not name a type" in that sketch as well. Thanks again for your help on this.

Some info that may be pertinent:

I'm using an ESP32 which was working fine with the standard Arduino EEPROM.h library. I think that this processor is non AVR so maybe that's the issue? I'm not sure as the regular Arduino EEPROM.h library is supposed to be AVR as far as I can tell. I get warnings but my EEPROM.h library sketch works and the menu manager sketch does not. Is the solution here just to get an I2c eeprom when working with chips like the ESP8266 or ESP32?

Author: davetcc
29/04/2019 18:24:08
As you are not using an 8 bit board. Avr eeprom only works on boards with an avr processor such as Mega and Uno.

If you’re using a 32 bit board such as MKR then the best option is the i2c EEPROM example above. ESP support is still in progress at the moment but if you want me to wrap the inbuilt EPROM in flash library I can do so.

Author: dsap4004
29/04/2019 18:40:09
If that's easy enough and possible to do I would love to know how it's done as the built in arduino EEPROM library works with AVR arduino chips and ESP32. I think espressif knew most built in Arduino libraries would get used and came up with some sort of solution that the compiler understands. Either way, let me know if it's too much trouble or not as I would like to use this solution without having to add more hardware to the project. ESP32 and ESP8266 are quickly becoming some of the more popular solutions because of processor power, price and size as compared to Arduino, even on projects not utilizing WiFi.

Author: davetcc
29/04/2019 18:50:30
Agreed, I’ve been working on major improvements for ESP8266 support in the next release. I’m looking at ESP32 as well. I’m having a few problems with ESP8266 at the moment on master.

I’ll add the ESP eeprom support in a release soon.

See https://github.com/davetcc/IoAbstraction/issues/52

Author: dsap4004
29/04/2019 18:53:51
Nice! Sounds like progress. I'll be on the lookout. Until then I may just handle read and write events to eeprom myself as I'm not comfortable modifying libraries yet. Thanks again. smilie

Author: davetcc
08/05/2019 21:19:32
The EEPROM is now wrapped in 1.3.1. See the ESP8266 example that is now packaged in the examples.




Register / Login  |  Desktop view  |  Jump to top of page