mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-29 13:46:37 +00:00
Some webserver code saving
This commit is contained in:
parent
f95a0d13d1
commit
9d86c15685
@ -34,8 +34,8 @@
|
|||||||
const uint16_t CHUNKED_BUFFER_SIZE = (MESSZ / 2) - 100; // Chunk buffer size (should be smaller than half mqtt_data size = MESSZ)
|
const uint16_t CHUNKED_BUFFER_SIZE = (MESSZ / 2) - 100; // Chunk buffer size (should be smaller than half mqtt_data size = MESSZ)
|
||||||
|
|
||||||
const uint16_t HTTP_REFRESH_TIME = 2345; // milliseconds
|
const uint16_t HTTP_REFRESH_TIME = 2345; // milliseconds
|
||||||
#define HTTP_RESTART_RECONNECT_TIME 9000 // milliseconds
|
const uint16_t HTTP_RESTART_RECONNECT_TIME = 9000; // milliseconds - Allow time for restart and wifi reconnect
|
||||||
#define HTTP_OTA_RESTART_RECONNECT_TIME 20000 // milliseconds
|
const uint16_t HTTP_OTA_RESTART_RECONNECT_TIME = 28000; // milliseconds - Allow time for uploading binary, unzip/write to final destination and wifi reconnect
|
||||||
|
|
||||||
#include <ESP8266WebServer.h>
|
#include <ESP8266WebServer.h>
|
||||||
#include <DNSServer.h>
|
#include <DNSServer.h>
|
||||||
@ -170,12 +170,8 @@ const char HTTP_SCRIPT_WIFI[] PROGMEM =
|
|||||||
"eb('p1').focus();"
|
"eb('p1').focus();"
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
const char HTTP_SCRIPT_RELOAD[] PROGMEM =
|
const char HTTP_SCRIPT_RELOAD_TIME[] PROGMEM =
|
||||||
"setTimeout(function(){location.href='.';}," STR(HTTP_RESTART_RECONNECT_TIME) ");";
|
"setTimeout(function(){location.href='.';},%d);";
|
||||||
|
|
||||||
// Local OTA upgrade requires more time to complete cp: before web ui should be reloaded
|
|
||||||
const char HTTP_SCRIPT_RELOAD_OTA[] PROGMEM =
|
|
||||||
"setTimeout(function(){location.href='.';}," STR(HTTP_OTA_RESTART_RECONNECT_TIME) ");";
|
|
||||||
|
|
||||||
const char HTTP_SCRIPT_CONSOL[] PROGMEM =
|
const char HTTP_SCRIPT_CONSOL[] PROGMEM =
|
||||||
"var sn=0,id=0;" // Scroll position, Get most of weblog initially
|
"var sn=0,id=0;" // Scroll position, Get most of weblog initially
|
||||||
@ -980,7 +976,7 @@ void WebRestart(uint32_t type)
|
|||||||
bool reset_only = (HTTP_MANAGER_RESET_ONLY == Web.state);
|
bool reset_only = (HTTP_MANAGER_RESET_ONLY == Web.state);
|
||||||
|
|
||||||
WSContentStart_P((type) ? S_SAVE_CONFIGURATION : S_RESTART, !reset_only);
|
WSContentStart_P((type) ? S_SAVE_CONFIGURATION : S_RESTART, !reset_only);
|
||||||
WSContentSend_P(HTTP_SCRIPT_RELOAD);
|
WSContentSend_P(HTTP_SCRIPT_RELOAD_TIME, HTTP_RESTART_RECONNECT_TIME);
|
||||||
WSContentSendStyle();
|
WSContentSendStyle();
|
||||||
if (type) {
|
if (type) {
|
||||||
WSContentSend_P(PSTR("<div style='text-align:center;'><b>" D_CONFIGURATION_SAVED "</b><br>"));
|
WSContentSend_P(PSTR("<div style='text-align:center;'><b>" D_CONFIGURATION_SAVED "</b><br>"));
|
||||||
@ -2346,7 +2342,7 @@ void HandleUpgradeFirmwareStart(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WSContentStart_P(S_INFORMATION);
|
WSContentStart_P(S_INFORMATION);
|
||||||
WSContentSend_P(HTTP_SCRIPT_RELOAD_OTA);
|
WSContentSend_P(HTTP_SCRIPT_RELOAD_TIME, HTTP_OTA_RESTART_RECONNECT_TIME);
|
||||||
WSContentSendStyle();
|
WSContentSendStyle();
|
||||||
WSContentSend_P(PSTR("<div style='text-align:center;'><b>" D_UPGRADE_STARTED " ...</b></div>"));
|
WSContentSend_P(PSTR("<div style='text-align:center;'><b>" D_UPGRADE_STARTED " ...</b></div>"));
|
||||||
WSContentSend_P(HTTP_MSG_RSTRT);
|
WSContentSend_P(HTTP_MSG_RSTRT);
|
||||||
@ -2371,7 +2367,7 @@ void HandleUploadDone(void)
|
|||||||
|
|
||||||
WSContentStart_P(S_INFORMATION);
|
WSContentStart_P(S_INFORMATION);
|
||||||
if (!Web.upload_error) {
|
if (!Web.upload_error) {
|
||||||
WSContentSend_P(HTTP_SCRIPT_RELOAD_OTA); // Refesh main web ui after OTA upgrade
|
WSContentSend_P(HTTP_SCRIPT_RELOAD_TIME, HTTP_OTA_RESTART_RECONNECT_TIME); // Refesh main web ui after OTA upgrade
|
||||||
}
|
}
|
||||||
WSContentSendStyle();
|
WSContentSendStyle();
|
||||||
WSContentSend_P(PSTR("<div style='text-align:center;'><b>" D_UPLOAD " <font color='#"));
|
WSContentSend_P(PSTR("<div style='text-align:center;'><b>" D_UPLOAD " <font color='#"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user