Fix #13 "wait" issue for pipe going to dead loop

Fix % not showing during FW update on lcd status
This commit is contained in:
luc lebosse 2016-11-11 16:11:10 +01:00
parent 86cd23cfea
commit 3dae051e0c
2 changed files with 41 additions and 5 deletions

View File

@ -26,7 +26,12 @@
#define SMOOTHIEWARE 4 #define SMOOTHIEWARE 4
//FIRMWARE_TARGET: the targeted FW, can be REPETIER (Original Repetier)/ REPETIER4DV (Repetier for Davinci) / MARLIN (Marlin)/ SMOOTHIEWARE (Smoothieware) //FIRMWARE_TARGET: the targeted FW, can be REPETIER (Original Repetier)/ REPETIER4DV (Repetier for Davinci) / MARLIN (Marlin)/ SMOOTHIEWARE (Smoothieware)
#define FIRMWARE_TARGET REPETIER #define FIRMWARE_TARGET REPETIER4DV
//Depending of your printer FW configuration you may have a permanent wait identifier
//sent when printer is idle that can cause trouble
//uncomment and set value to overload default setting
//#define PURGE_SERIAL 1
//number of clients allowed to use data port at once //number of clients allowed to use data port at once
#define MAX_SRV_CLIENTS 1 #define MAX_SRV_CLIENTS 1
@ -46,7 +51,7 @@
#define CAPTIVE_PORTAL_FEATURE #define CAPTIVE_PORTAL_FEATURE
//AUTHENTICATION_FEATURE: protect pages by login password //AUTHENTICATION_FEATURE: protect pages by login password
#define AUTHENTICATION_FEATURE //#define AUTHENTICATION_FEATURE
//WEB_UPDATE_FEATURE: allow to flash fw using web UI //WEB_UPDATE_FEATURE: allow to flash fw using web UI
#define WEB_UPDATE_FEATURE #define WEB_UPDATE_FEATURE
@ -86,6 +91,14 @@
//FLOW_MONITORING_FEATURE : catch the specific answer and store it to variable //FLOW_MONITORING_FEATURE : catch the specific answer and store it to variable
#define FLOW_MONITORING_FEATURE #define FLOW_MONITORING_FEATURE
//default seting for purge serial define
#ifndef PURGE_SERIAL
#if ((FIRMWARE_TARGET == REPETIER) || (FIRMWARE_TARGET == REPETIER4DV))
#define PURGE_SERIAL 0
#else
#define PURGE_SERIAL 1
#endif
#endif
//DEBUG Flag do not do this when connected to printer !!! //DEBUG Flag do not do this when connected to printer !!!
//#define DEBUG_ESP3D //#define DEBUG_ESP3D

View File

@ -2707,7 +2707,11 @@ void WebUpdateUpload()
if(!Update.begin(maxSketchSpace)) { //start with max available size if(!Update.begin(maxSketchSpace)) { //start with max available size
web_interface->_upload_status=UPLOAD_STATUS_CANCELLED; web_interface->_upload_status=UPLOAD_STATUS_CANCELLED;
} else { } else {
#if (( FIRMWARE_TARGET == REPETIER4DV) || (FIRMWARE_TARGET == REPETIER))
Serial.println(F("M117 Update 0%%"));
#else
Serial.println(F("M117 Update 0%")); Serial.println(F("M117 Update 0%"));
#endif
} }
//Upload write //Upload write
//************** //**************
@ -2719,7 +2723,11 @@ void WebUpdateUpload()
last_upload_update = (100 * upload.totalSize) / maxSketchSpace; last_upload_update = (100 * upload.totalSize) / maxSketchSpace;
Serial.print(F("M117 Update ")); Serial.print(F("M117 Update "));
Serial.print(last_upload_update); Serial.print(last_upload_update);
#if (( FIRMWARE_TARGET == REPETIER4DV) || (FIRMWARE_TARGET == REPETIER))
Serial.println(F("%%"));
#else
Serial.println(F("%")); Serial.println(F("%"));
#endif
} }
if(Update.write(upload.buf, upload.currentSize) != upload.currentSize) { if(Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
web_interface->_upload_status=UPLOAD_STATUS_CANCELLED; web_interface->_upload_status=UPLOAD_STATUS_CANCELLED;
@ -2730,7 +2738,11 @@ void WebUpdateUpload()
} else if(upload.status == UPLOAD_FILE_END) { } else if(upload.status == UPLOAD_FILE_END) {
if(Update.end(true)) { //true to set the size to the current progress if(Update.end(true)) { //true to set the size to the current progress
//Now Reboot //Now Reboot
#if (( FIRMWARE_TARGET == REPETIER4DV) || (FIRMWARE_TARGET == REPETIER))
Serial.println(F("M117 Update 100%%"));
#else
Serial.println(F("M117 Update 100%")); Serial.println(F("M117 Update 100%"));
#endif
web_interface->_upload_status=UPLOAD_STATUS_SUCCESSFUL; web_interface->_upload_status=UPLOAD_STATUS_SUCCESSFUL;
} }
} else if(upload.status == UPLOAD_FILE_ABORTED) { } else if(upload.status == UPLOAD_FILE_ABORTED) {
@ -3392,6 +3404,7 @@ void handle_web_command(){
//block every query //block every query
web_interface->blockserial = true; web_interface->blockserial = true;
LOG("Block Serial\r\n") LOG("Block Serial\r\n")
#if (PURGE_SERIAL == 1)
//empty the serial buffer and incoming data //empty the serial buffer and incoming data
LOG("Start PurgeSerial\r\n") LOG("Start PurgeSerial\r\n")
while(Serial.available()){ while(Serial.available()){
@ -3399,18 +3412,21 @@ void handle_web_command(){
delay(1); delay(1);
} }
LOG("End PurgeSerial\r\n") LOG("End PurgeSerial\r\n")
#endif
web_interface->WebServer.setContentLength(CONTENT_LENGTH_UNKNOWN); web_interface->WebServer.setContentLength(CONTENT_LENGTH_UNKNOWN);
web_interface->WebServer.send(200); web_interface->WebServer.send(200);
web_interface->WebServer.sendHeader("Content-Type","text/plain"); web_interface->WebServer.sendHeader("Content-Type","text/plain");
web_interface->WebServer.sendHeader("Cache-Control","no-cache"); web_interface->WebServer.sendHeader("Cache-Control","no-cache");
//send command //send command
LOG(String(cmd.length())) LOG(String(cmd.length()))
#if (PURGE_SERIAL == 1)
LOG("Start PurgeSerial\r\n") LOG("Start PurgeSerial\r\n")
while(Serial.available()){ while(Serial.available()){
BRIDGE::processFromSerial2TCP(); BRIDGE::processFromSerial2TCP();
delay(1); delay(1);
} }
LOG("End PurgeSerial\r\n") LOG("End PurgeSerial\r\n")
#endif
LOG("Send Command\r\n") LOG("Send Command\r\n")
Serial.println(cmd); Serial.println(cmd);
count = 0; count = 0;
@ -3439,7 +3455,7 @@ void handle_web_command(){
//get line //get line
current_line = current_buffer.substring(0,current_buffer.indexOf("\n")); current_line = current_buffer.substring(0,current_buffer.indexOf("\n"));
//if line is command acck - just exit so save the time out period //if line is command acck - just exit so save the time out period
if ((current_line.indexOf("ok" ) == 0) && (current_line.length() == 2)) if ((current_line == "ok") || (current_line == "wait"))
{ {
count = MAX_TRY; count = MAX_TRY;
LOG("Found ok\r\n") LOG("Found ok\r\n")
@ -3450,8 +3466,13 @@ void handle_web_command(){
LOG("\r\n") LOG("\r\n")
//check command //check command
COMMAND::check_command(current_line,false); COMMAND::check_command(current_line,false);
buffer2send +=current_line; #if ((FIRMWARE_TARGET == REPETIER) || (FIRMWARE_TARGET == REPETIER4DV))
buffer2send +="\n"; if ((current_line != "ok 0"))
#endif
{
buffer2send +=current_line;
buffer2send +="\n";
}
if (buffer2send.length() > 1200) { if (buffer2send.length() > 1200) {
web_interface->WebServer.sendContent(buffer2send); web_interface->WebServer.sendContent(buffer2send);
buffer2send = ""; buffer2send = "";
@ -3471,12 +3492,14 @@ void handle_web_command(){
} }
if (!datasent)web_interface->WebServer.sendContent(" \r\n"); if (!datasent)web_interface->WebServer.sendContent(" \r\n");
web_interface->WebServer.sendContent(""); web_interface->WebServer.sendContent("");
#if (PURGE_SERIAL == 1)
LOG("Start PurgeSerial\r\n") LOG("Start PurgeSerial\r\n")
while(Serial.available()){ while(Serial.available()){
BRIDGE::processFromSerial2TCP(); BRIDGE::processFromSerial2TCP();
delay(1); delay(1);
} }
LOG("End PurgeSerial\r\n") LOG("End PurgeSerial\r\n")
#endif
web_interface->blockserial = false; web_interface->blockserial = false;
LOG("Release Serial\r\n") LOG("Release Serial\r\n")
} }