mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-11 21:09:05 +08:00
Add a check and counter if printer is heating
to avoid to go in long loop when sending command
This commit is contained in:
parent
74b9516ccc
commit
99578de542
@ -484,12 +484,13 @@ void COMMAND::execute_command(int cmd,String cmd_params, tpipe output)
|
||||
}
|
||||
}
|
||||
|
||||
void COMMAND::check_command(String buffer, tpipe output, bool handlelockserial)
|
||||
bool COMMAND::check_command(String buffer, tpipe output, bool handlelockserial)
|
||||
{
|
||||
String buffer2;
|
||||
LOG("Check Command:")
|
||||
LOG(buffer)
|
||||
LOG("\r\n")
|
||||
bool is_temp = false;
|
||||
//feed the WD for safety
|
||||
delay(0);
|
||||
//if direct access to SDCard no need to handle the M20 command answer
|
||||
@ -512,12 +513,11 @@ void COMMAND::check_command(String buffer, tpipe output, bool handlelockserial)
|
||||
web_interface->fileslist.clear();
|
||||
//block any new output to serial from ESP to avoid pollution
|
||||
if (handlelockserial)(web_interface->blockserial) = true;
|
||||
return;
|
||||
return is_temp;
|
||||
}
|
||||
#endif
|
||||
#ifdef TEMP_MONITORING_FEATURE
|
||||
int Tpos = buffer.indexOf("T:");
|
||||
#endif
|
||||
if (Tpos > -1 ) is_temp = true;
|
||||
#ifdef POS_MONITORING_FEATURE
|
||||
int Xpos = buffer.indexOf("X:");
|
||||
int Ypos = buffer.indexOf("Y:");
|
||||
@ -673,6 +673,7 @@ void COMMAND::check_command(String buffer, tpipe output, bool handlelockserial)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return is_temp;
|
||||
}
|
||||
|
||||
//read a buffer in an array
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
static void read_buffer_serial(uint8_t *b, size_t len);
|
||||
static void read_buffer_serial(uint8_t b);
|
||||
static void read_buffer_tcp(uint8_t b);
|
||||
static void check_command(String buffer, tpipe output, bool handlelockserial = true);
|
||||
static bool check_command(String buffer, tpipe output, bool handlelockserial = true);
|
||||
static void execute_command(int cmd,String cmd_params, tpipe output);
|
||||
static String get_param(String & cmd_params, const char * id, bool withspace = false);
|
||||
static bool isadmin(String & cmd_params);
|
||||
|
@ -3803,6 +3803,7 @@ void handle_web_command(){
|
||||
String current_buffer;
|
||||
String current_line;
|
||||
int pos;
|
||||
int temp_counter = 0;
|
||||
String tmp;
|
||||
bool datasent = false;
|
||||
//pickup the list
|
||||
@ -3836,7 +3837,7 @@ void handle_web_command(){
|
||||
LOG(current_line)
|
||||
LOG("\r\n")
|
||||
//check command
|
||||
COMMAND::check_command(current_line, NO_PIPE, false);
|
||||
if (COMMAND::check_command(current_line, NO_PIPE, false)) temp_counter ++ ;
|
||||
#if ((FIRMWARE_TARGET == REPETIER) || (FIRMWARE_TARGET == REPETIER4DV))
|
||||
if (!current_line.startsWith( "ok "))
|
||||
#endif
|
||||
@ -3853,7 +3854,10 @@ void handle_web_command(){
|
||||
tmp = current_buffer.substring(current_buffer.indexOf("\n")+1,current_buffer.length());
|
||||
current_buffer = tmp;
|
||||
}
|
||||
delay (0);
|
||||
} else delay(1);
|
||||
//it is sending too many temp status should be heating so let's exit the loop
|
||||
if (temp_counter > 5)count = MAX_TRY;
|
||||
count++;
|
||||
}
|
||||
//to be sure connection close
|
||||
|
Loading…
x
Reference in New Issue
Block a user