mirror of https://github.com/arendst/Tasmota.git
Merge pull request #4062 from andrethomas/development
Add Reset 4 command to reset defaults but keep wifi config
This commit is contained in:
commit
203053e468
sonoff
|
@ -1152,6 +1152,10 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
|
|||
restart_flag = 210 + payload;
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_RESET "\":\"" D_JSON_ERASE ", " D_JSON_RESET_AND_RESTARTING "\"}"));
|
||||
break;
|
||||
case 4:
|
||||
restart_flag = 214;
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_RESET "\":\"" D_JSON_ERASE ", " D_JSON_RESET_AND_RESTARTING "\"}"));
|
||||
break;
|
||||
default:
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_ONE_TO_RESET);
|
||||
}
|
||||
|
@ -2103,6 +2107,20 @@ void Every250mSeconds()
|
|||
SettingsDefault();
|
||||
restart_flag = 2;
|
||||
}
|
||||
if (214 == restart_flag) {
|
||||
char tmp_sta_ssid[2][33];
|
||||
char tmp_sta_pwd[2][65];
|
||||
strlcpy(tmp_sta_ssid[0],Settings.sta_ssid[0],sizeof(Settings.sta_ssid[0]));
|
||||
strlcpy(tmp_sta_pwd[0],Settings.sta_pwd[0],sizeof(Settings.sta_pwd[0]));
|
||||
strlcpy(tmp_sta_ssid[1],Settings.sta_ssid[1],sizeof(Settings.sta_ssid[1]));
|
||||
strlcpy(tmp_sta_pwd[1],Settings.sta_pwd[1],sizeof(Settings.sta_pwd[1]));
|
||||
SettingsDefault();
|
||||
strlcpy(Settings.sta_ssid[0],tmp_sta_ssid[0],sizeof(Settings.sta_ssid[0]));
|
||||
strlcpy(Settings.sta_pwd[0],tmp_sta_pwd[0],sizeof(Settings.sta_pwd[0]));
|
||||
strlcpy(Settings.sta_ssid[1],tmp_sta_ssid[1],sizeof(Settings.sta_ssid[1]));
|
||||
strlcpy(Settings.sta_pwd[1],tmp_sta_pwd[1],sizeof(Settings.sta_pwd[1]));
|
||||
restart_flag = 2;
|
||||
}
|
||||
SettingsSaveAll();
|
||||
restart_flag--;
|
||||
if (restart_flag <= 0) {
|
||||
|
|
Loading…
Reference in New Issue