mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-12 11:59:00 +08:00
Add more WD feed and flags check to save loop time
remove PURE_SERIAL define as useless now
This commit is contained in:
parent
99578de542
commit
1269e9b09a
@ -493,6 +493,14 @@ bool COMMAND::check_command(String buffer, tpipe output, bool handlelockserial)
|
|||||||
bool is_temp = false;
|
bool is_temp = false;
|
||||||
//feed the WD for safety
|
//feed the WD for safety
|
||||||
delay(0);
|
delay(0);
|
||||||
|
#if ((FIRMWARE_TARGET == REPETIER) || (FIRMWARE_TARGET == REPETIER4DV))
|
||||||
|
//save time no need to continue
|
||||||
|
if ((buffer.indexOf("busy:") > -1) || (buffer.startsWith("wait")))return false;
|
||||||
|
#endif
|
||||||
|
//because some answer start by ok ...
|
||||||
|
#if (FIRMWARE_TARGET != SMOOTHIEWARE)
|
||||||
|
if (buffer.startsWith("ok"))return false;
|
||||||
|
#endif
|
||||||
//if direct access to SDCard no need to handle the M20 command answer
|
//if direct access to SDCard no need to handle the M20 command answer
|
||||||
#ifndef DIRECT_SDCARD_FEATURE
|
#ifndef DIRECT_SDCARD_FEATURE
|
||||||
static bool bfileslist=false;
|
static bool bfileslist=false;
|
||||||
|
@ -28,10 +28,6 @@
|
|||||||
//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 REPETIER4DV
|
#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
|
||||||
@ -91,14 +87,6 @@
|
|||||||
//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
|
|
||||||
|
|
||||||
//Serial rx buffer size is 256 but can be extended
|
//Serial rx buffer size is 256 but can be extended
|
||||||
#define SERIAL_RX_BUFFER_SIZE 512
|
#define SERIAL_RX_BUFFER_SIZE 512
|
||||||
|
@ -3774,7 +3774,6 @@ 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")
|
||||||
if(Serial.available()){
|
if(Serial.available()){
|
||||||
@ -3782,21 +3781,18 @@ 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.sendHeader("Content-Type","text/plain",true);
|
web_interface->WebServer.sendHeader("Content-Type","text/plain",true);
|
||||||
web_interface->WebServer.sendHeader("Cache-Control","no-cache");
|
web_interface->WebServer.sendHeader("Cache-Control","no-cache");
|
||||||
web_interface->WebServer.send(200);
|
web_interface->WebServer.send(200);
|
||||||
//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")
|
||||||
if(Serial.available()){
|
if(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;
|
||||||
@ -3825,7 +3821,7 @@ void handle_web_command(){
|
|||||||
pos = current_buffer.indexOf("\n");
|
pos = current_buffer.indexOf("\n");
|
||||||
//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 ack - just exit so save the time out period
|
||||||
if ((current_line == "ok") || (current_line == "wait"))
|
if ((current_line == "ok") || (current_line == "wait"))
|
||||||
{
|
{
|
||||||
count = MAX_TRY;
|
count = MAX_TRY;
|
||||||
@ -3837,7 +3833,15 @@ void handle_web_command(){
|
|||||||
LOG(current_line)
|
LOG(current_line)
|
||||||
LOG("\r\n")
|
LOG("\r\n")
|
||||||
//check command
|
//check command
|
||||||
|
#if ((FIRMWARE_TARGET == REPETIER) || (FIRMWARE_TARGET == REPETIER4DV))
|
||||||
|
//save time no need to continue
|
||||||
|
if (current_line.indexOf("busy:") > -1){
|
||||||
|
temp_counter++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
if (COMMAND::check_command(current_line, NO_PIPE, false)) temp_counter ++ ;
|
if (COMMAND::check_command(current_line, NO_PIPE, false)) temp_counter ++ ;
|
||||||
|
if (temp_counter > 5)break;
|
||||||
#if ((FIRMWARE_TARGET == REPETIER) || (FIRMWARE_TARGET == REPETIER4DV))
|
#if ((FIRMWARE_TARGET == REPETIER) || (FIRMWARE_TARGET == REPETIER4DV))
|
||||||
if (!current_line.startsWith( "ok "))
|
if (!current_line.startsWith( "ok "))
|
||||||
#endif
|
#endif
|
||||||
@ -3853,6 +3857,7 @@ void handle_web_command(){
|
|||||||
//current remove line from buffer
|
//current remove line from buffer
|
||||||
tmp = current_buffer.substring(current_buffer.indexOf("\n")+1,current_buffer.length());
|
tmp = current_buffer.substring(current_buffer.indexOf("\n")+1,current_buffer.length());
|
||||||
current_buffer = tmp;
|
current_buffer = tmp;
|
||||||
|
delay(0);
|
||||||
}
|
}
|
||||||
delay (0);
|
delay (0);
|
||||||
} else delay(1);
|
} else delay(1);
|
||||||
@ -3867,14 +3872,12 @@ 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")
|
||||||
if(Serial.available()){
|
if(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")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user