Eeprom access via mySensors
-
Hi i hope you can help me finding a solution for my requirement. I want eeprom content to be fully manageable via mySensors protocol using payload.
The previous days I've tried a few solutions but I'm unsatisfied with all of them, here are some of my unusable solutions:- Each eeprom value has it's own function for accessing --> stupid solution e.g. Payload: readValue1
- Direct access eeprom addresses --> hassle solution without structured access, datatype length problem. e.g. Payload: %command%,%address%,%value% --> write,0x10,255
Please note, the above Payload examples aren't real, they are just for better description.
I want a generic solution to manage eeprom values with the use of structured eeprom access, optionally where the node can give information about it's structure (variables and datatypes) to the controller for easier management. Do you have any ideas who to do that, please?
-
I have noted the request.
-
Hi, just wanted to ask about any ideas, not to make a feature request. But in general i think this could be useful for the whole mySensors project.
What i built already:-Used the EEPROMAnything.h library for structured eeprom access
-Wrote a Payload parser for: command,section,value e.g. write,value1,199
-But then i've a problem to access the struct sectionsHere's an excerpt about my solution:
struct store_t {
byte version;
int value1;
unsigned long value2;
char code[5];
} configuration;The parser separates the Payload into:
-command <-- e.g. write
-section <-- e.g. value1
-value <-- e.g. 199To read data from the struct i can simply use** configuration.value1** which works fine.
But i want to use the data from the Payload like ** configuration.section** where the section holds the struct section name to access.
The only nasty solution i figured out was, comparing the Payload section with a string.if (strcmp(payload,"value1") == 0) {
Serial.println(configuration.value1);
} else
if (strcmp(payload,"value2") == 0) {
Serial.println(configuration.value2);
}How could i do that better?
-
It is a hard to solve it any other way if you use a string as identifier.
-
Thanks for reply. This means, my it is not possible do it that way, right?
Any other ideas to generalize eeprom access?
-
You could for instance use a index + length to access a certain a region in the eeprom pretty easy. But remember there are a limit on the size of payload.
-
I already mentioned direct access eeprom addresses. I don't like it, because of loosing all the benefits of structured eeprom access.
-
You could read-up on and get inspired of protocol buffers. Pretty neat.
-
thanks, i'll give it a try.
Suggested Topics
-
OTA and Authentication Evaluation Board
OpenHardware.io • 21 Jan 2016, 10:29 • openhardware.io 18 Feb 2017, 14:10 -
st=fail issue with custom energy meter sketch maybe eeprom?
Troubleshooting • 17 Jul 2015, 17:12 • Gambituk 17 Jul 2015, 18:33 -
NodeId, ChildId and EEPROM
Troubleshooting • 30 Sept 2014, 20:21 • nono056 30 Sept 2014, 20:21 -
Arduino Celebrates 10 years (Malmö/Sweden)
Announcements • 29 Mar 2014, 17:08 • hek 29 Mar 2014, 17:08 -
eeprom address for node id
Development • 4 Mar 2015, 12:37 • Mickey 4 Mar 2015, 12:50 -
💬 MySGrowLED - MySensors control for Grow Lights or Greenhouse
OpenHardware.io • 9 May 2016, 06:03 • openhardware.io 27 Jul 2017, 20:51 -
ESP8266 WiFi settings in EEPROM
Development • 11 Feb 2016, 13:42 • Alexander Voronin 12 Feb 2016, 11:06