mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 19:56:30 +00:00
Refactor gui upload
This commit is contained in:
parent
d4a4818da5
commit
146eb6654d
@ -2712,6 +2712,7 @@ void HandleUploadLoop(void)
|
|||||||
|
|
||||||
HTTPUpload& upload = Webserver->upload();
|
HTTPUpload& upload = Webserver->upload();
|
||||||
|
|
||||||
|
// ***** Step1: Start upload file
|
||||||
if (UPLOAD_FILE_START == upload.status) {
|
if (UPLOAD_FILE_START == upload.status) {
|
||||||
restart_flag = 60;
|
restart_flag = 60;
|
||||||
if (0 == upload.filename.c_str()[0]) {
|
if (0 == upload.filename.c_str()[0]) {
|
||||||
@ -2752,7 +2753,10 @@ void HandleUploadLoop(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Web.upload_progress_dot_count = 0;
|
Web.upload_progress_dot_count = 0;
|
||||||
} else if (!Web.upload_error && (UPLOAD_FILE_WRITE == upload.status)) {
|
}
|
||||||
|
|
||||||
|
// ***** Step2: Write upload file
|
||||||
|
else if (!Web.upload_error && (UPLOAD_FILE_WRITE == upload.status)) {
|
||||||
if (0 == upload.totalSize) {
|
if (0 == upload.totalSize) {
|
||||||
if (UPL_SETTINGS == Web.upload_file_type) {
|
if (UPL_SETTINGS == Web.upload_file_type) {
|
||||||
Web.config_block_count = 0;
|
Web.config_block_count = 0;
|
||||||
@ -2803,6 +2807,7 @@ void HandleUploadLoop(void)
|
|||||||
// upload.buf[2] = 3; // Force DOUT - ESP8285
|
// upload.buf[2] = 3; // Force DOUT - ESP8285
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "File type %d"), Web.upload_file_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (UPL_SETTINGS == Web.upload_file_type) {
|
if (UPL_SETTINGS == Web.upload_file_type) {
|
||||||
@ -2874,7 +2879,10 @@ void HandleUploadLoop(void)
|
|||||||
if (!(Web.upload_progress_dot_count % 80)) { Serial.println(); }
|
if (!(Web.upload_progress_dot_count % 80)) { Serial.println(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(!Web.upload_error && (UPLOAD_FILE_END == upload.status)) {
|
}
|
||||||
|
|
||||||
|
// ***** Step3: Finish upload file
|
||||||
|
else if(!Web.upload_error && (UPLOAD_FILE_END == upload.status)) {
|
||||||
if (_serialoutput && (Web.upload_progress_dot_count % 80)) {
|
if (_serialoutput && (Web.upload_progress_dot_count % 80)) {
|
||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}
|
||||||
@ -2950,9 +2958,12 @@ void HandleUploadLoop(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Web.upload_error) {
|
if (!Web.upload_error) {
|
||||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD D_SUCCESSFUL " %u bytes. " D_RESTARTING), upload.totalSize);
|
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD D_SUCCESSFUL " %u bytes"), upload.totalSize);
|
||||||
}
|
}
|
||||||
} else if (UPLOAD_FILE_ABORTED == upload.status) {
|
}
|
||||||
|
|
||||||
|
// ***** Step4: Abort upload file
|
||||||
|
else if (UPLOAD_FILE_ABORTED == upload.status) {
|
||||||
restart_flag = 0;
|
restart_flag = 0;
|
||||||
MqttRetryCounter(0);
|
MqttRetryCounter(0);
|
||||||
#ifdef USE_COUNTER
|
#ifdef USE_COUNTER
|
||||||
|
Loading…
x
Reference in New Issue
Block a user