-
Notifications
You must be signed in to change notification settings - Fork 113
Add callback to config save #77
Comments
Cool, can you add please an example to call it? |
It's very straightforward actually. First, you create a function with what you want to do when the 'Save' button is clicked. The simplest example:
Then in |
By the way, even though I mention you can do anything in the saveCallback function, it is best to just set a flag there and leave the actual work to be done in |
I get the esp hard-reboot (panic) when I click the save button a second time too soon (within a second or so) without changing the data. I thought maybe writing to EEPROM takes too much time and that causes a conflict, so I tried a
Not the best code I admit, but I don't know how else to give |
Thanks for proposing this functionality. I think the panics are caused by the fact that the I have implemented your callback in PR #83, and in addition I have made the Thanks again for your suggestion and code. This will be added to the next release. |
Thanks for implementing my crude code-idea into your wonderful project. I will try your new code as soon as possible. Hopefully some time this week, but I will let you know what happens. |
Not an issue, but I'm not an experienced Github user, so I don't know where to put this. Maybe it is a pull-request, but I don't know how that works...
I needed a way to know if any of the config values has changed, so i can combine that with my MQTT calls. So I added a function to configManager.
My configManager.cpp now looks like this:
And my configManager.h:
So now you can define a function to be called in
setup()
when the 'Save' button is clicked:configManager.setConfigSaveCallback(saveCallback);
The text was updated successfully, but these errors were encountered: