mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
schedule upload & download feature
This commit is contained in:
@@ -988,15 +988,18 @@ bool System::check_restore() {
|
||||
std::string settings_type = input["type"];
|
||||
if (settings_type == "settings") {
|
||||
// It's a settings file. Parse each section separately. If it's system related it will require a reboot
|
||||
reboot_required = saveSettings(NETWORK_SETTINGS_FILE, "Network", input);
|
||||
reboot_required |= saveSettings(AP_SETTINGS_FILE, "AP", input);
|
||||
reboot_required |= saveSettings(MQTT_SETTINGS_FILE, "MQTT", input);
|
||||
reboot_required |= saveSettings(NTP_SETTINGS_FILE, "NTP", input);
|
||||
reboot_required |= saveSettings(SECURITY_SETTINGS_FILE, "Security", input);
|
||||
reboot_required = saveSettings(NETWORK_SETTINGS_FILE, "Network Settings", input);
|
||||
reboot_required |= saveSettings(AP_SETTINGS_FILE, "AP Settings", input);
|
||||
reboot_required |= saveSettings(MQTT_SETTINGS_FILE, "MQTT Settings", input);
|
||||
reboot_required |= saveSettings(NTP_SETTINGS_FILE, "NTP Settings", input);
|
||||
reboot_required |= saveSettings(SECURITY_SETTINGS_FILE, "Security Settings", input);
|
||||
reboot_required |= saveSettings(EMSESP_SETTINGS_FILE, "Settings", input);
|
||||
} else if (settings_type == "customizations") {
|
||||
// it's a customization file, just replace it and there's no need to reboot
|
||||
saveSettings(EMSESP_CUSTOMIZATION_FILE, "Customizations", input);
|
||||
} else if (settings_type == "schedule") {
|
||||
// it's a schedule file, just replace it and there's no need to reboot
|
||||
saveSettings(EMSESP_SCHEDULER_FILE, "Schedule", input);
|
||||
} else {
|
||||
LOG_ERROR("Unrecognized file uploaded");
|
||||
}
|
||||
@@ -1115,7 +1118,7 @@ bool System::saveSettings(const char * filename, const char * section, JsonObjec
|
||||
if (section_json) {
|
||||
File section_file = LittleFS.open(filename, "w");
|
||||
if (section_file) {
|
||||
LOG_INFO("Applying new %s settings", section);
|
||||
LOG_INFO("Applying new %s", section);
|
||||
serializeJson(section_json, section_file);
|
||||
section_file.close();
|
||||
return true; // reboot required
|
||||
|
||||
Reference in New Issue
Block a user