Feature: Save configs permanently and automatically restore on boot.

This commit is contained in:
2019-06-06 19:58:28 +02:00
parent 59e84a6146
commit d3da31d6db
3 changed files with 50 additions and 4 deletions

View File

@@ -127,6 +127,28 @@ void Config::loadFile(const char *filename, const char * const sectionConfigItem
}
}
void Config::writeAllConfigs(void) {
boolean allChangesWritten = false;
logHeap();
while (!allChangesWritten) {
for (int i=0; i<numberOfConfigItems; ++i) {
debug.out(configItems[i].section);
debug.out(".");
debug.out(configItems[i].name);
debug.out("(");
debug.out(configItems[i].changed ? "changed" : "-");
debug.out(")=");
debug.outln(configItems[i].value);
if (configItems[i].changed) {
writeConfigFile(configItems[i].section);
break; // leave for-loop and restart search for changes
}
}
// no further changes found, we are done
allChangesWritten = true;
}
}
void Config::writeConfigFile(String filename) {
logHeap();