mirror of https://github.com/arendst/Tasmota.git
Add cmnds Reset 4 and Reset 5
Add commands Reset 4 (reset to defaults but keep wifi params) and Reset 5 (as reset 4 and also erase flash) (#4061)
This commit is contained in:
parent
10de996892
commit
6b660026cd
|
@ -2,6 +2,7 @@
|
|||
* Fix Color Temperature slider functionality regression from 6.2.1.5 (#4037)
|
||||
* Add auto reload of main web page to some web restarts
|
||||
* Add whitespace removal from RfRaw and SerialSend5 (#4020)
|
||||
* Add commands Reset 4 (reset to defaults but keep wifi params) and Reset 5 (as reset 4 and also erase flash) (#4061)
|
||||
*
|
||||
* 6.2.1.14 20181010
|
||||
* Rewrite Webserver page handler for easier extension (thx to Adrian Scillato)
|
||||
|
|
|
@ -188,8 +188,8 @@ struct SYSCFG {
|
|||
byte seriallog_level; // 09E
|
||||
uint8_t sta_config; // 09F
|
||||
byte sta_active; // 0A0
|
||||
char sta_ssid[2][33]; // 0A1
|
||||
char sta_pwd[2][65]; // 0E3
|
||||
char sta_ssid[2][33]; // 0A1 - Keep together with sta_pwd as being copied as one chunck with reset 4/5
|
||||
char sta_pwd[2][65]; // 0E3 - Keep together with sta_ssid as being copied as one chunck with reset 4/5
|
||||
char hostname[33]; // 165
|
||||
char syslog_host[33]; // 186
|
||||
uint8_t rule_stop; // 1A7
|
||||
|
|
|
@ -1149,15 +1149,9 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
|
|||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
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;
|
||||
case 5:
|
||||
restart_flag = 215;
|
||||
restart_flag = 210 + payload;
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_RESET "\":\"" D_JSON_ERASE ", " D_JSON_RESET_AND_RESTARTING "\"}"));
|
||||
break;
|
||||
default:
|
||||
|
@ -2100,10 +2094,21 @@ void Every250mSeconds()
|
|||
}
|
||||
}
|
||||
if (restart_flag && (backlog_pointer == backlog_index)) {
|
||||
if (213 == restart_flag) {
|
||||
if ((214 == restart_flag) || (215 == restart_flag)) {
|
||||
char storage[sizeof(Settings.sta_ssid) + sizeof(Settings.sta_pwd)];
|
||||
memcpy(storage, Settings.sta_ssid, sizeof(storage)); // Backup current SSIDs and Passwords
|
||||
if (215 == restart_flag) {
|
||||
SettingsErase(0); // Erase all flash from program end to end of physical flash
|
||||
}
|
||||
SettingsDefault();
|
||||
memcpy(Settings.sta_ssid, storage, sizeof(storage)); // Restore current SSIDs and Passwords
|
||||
restart_flag = 2;
|
||||
}
|
||||
else if (213 == restart_flag) {
|
||||
SettingsSdkErase(); // Erase flash SDK parameters
|
||||
restart_flag = 2;
|
||||
} else if (212 == restart_flag) {
|
||||
}
|
||||
else if (212 == restart_flag) {
|
||||
SettingsErase(0); // Erase all flash from program end to end of physical flash
|
||||
restart_flag = 211;
|
||||
}
|
||||
|
@ -2111,23 +2116,6 @@ void Every250mSeconds()
|
|||
SettingsDefault();
|
||||
restart_flag = 2;
|
||||
}
|
||||
if ((214 == restart_flag) || (215 == 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]));
|
||||
if (215 == restart_flag) {
|
||||
SettingsErase(0); // Erase all flash from program end to end of physical flash
|
||||
}
|
||||
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) {
|
||||
|
|
|
@ -124,6 +124,7 @@ void KNX_CB_Action(message_t const &msg, void *arg);
|
|||
#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library
|
||||
#undef USE_ARDUINO_OTA // Disable support for Arduino OTA
|
||||
#undef USE_KNX // Disable KNX IP Protocol Support
|
||||
#undef USE_CUSTOM // Disable Custom features
|
||||
#undef USE_TIMERS // Disable support for up to 16 timers
|
||||
#undef USE_TIMERS_WEB // Disable support for timer webpage
|
||||
#undef USE_SUNRISE // Disable support for Sunrise and sunset tools
|
||||
|
@ -144,6 +145,7 @@ void KNX_CB_Action(message_t const &msg, void *arg);
|
|||
#undef USE_ARILUX_RF // Disable support for Arilux RF remote controller
|
||||
#undef USE_SR04 // Disable support for for HC-SR04 ultrasonic devices
|
||||
#undef USE_TM1638 // Disable support for TM1638 switches copying Switch1 .. Switch8
|
||||
#undef USE_HX711 // Disable support for HX711 load cell
|
||||
#undef USE_RF_FLASH // Disable support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB
|
||||
#undef DEBUG_THEO // Disable debug code
|
||||
#undef USE_DEBUG_DRIVER // Disable debug code
|
||||
|
@ -211,6 +213,7 @@ void KNX_CB_Action(message_t const &msg, void *arg);
|
|||
#undef USE_MQTT_TLS // Disable TLS support won't work as the MQTTHost is not set
|
||||
#undef USE_KNX // Disable KNX IP Protocol Support
|
||||
//#undef USE_WEBSERVER // Disable Webserver
|
||||
#undef USE_CUSTOM // Disable Custom features
|
||||
#undef USE_DISCOVERY // Disable Discovery services for both MQTT and web server
|
||||
#undef USE_EMULATION // Disable Wemo or Hue emulation
|
||||
#undef USE_TIMERS // Disable support for up to 16 timers
|
||||
|
@ -237,6 +240,7 @@ void KNX_CB_Action(message_t const &msg, void *arg);
|
|||
#undef USE_ARILUX_RF // Disable support for Arilux RF remote controller
|
||||
#undef USE_SR04 // Disable support for for HC-SR04 ultrasonic devices
|
||||
#undef USE_TM1638 // Disable support for TM1638 switches copying Switch1 .. Switch8
|
||||
#undef USE_HX711 // Disable support for HX711 load cell
|
||||
#undef USE_RF_FLASH // Disable support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB
|
||||
#undef DEBUG_THEO // Disable debug code
|
||||
#undef USE_DEBUG_DRIVER // Disable debug code
|
||||
|
|
Loading…
Reference in New Issue