mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-12 04:29:00 +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;
|
String buffer2;
|
||||||
LOG("Check Command:")
|
LOG("Check Command:")
|
||||||
LOG(buffer)
|
LOG(buffer)
|
||||||
LOG("\r\n")
|
LOG("\r\n")
|
||||||
|
bool is_temp = false;
|
||||||
//feed the WD for safety
|
//feed the WD for safety
|
||||||
delay(0);
|
delay(0);
|
||||||
//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
|
||||||
@ -512,12 +513,11 @@ void COMMAND::check_command(String buffer, tpipe output, bool handlelockserial)
|
|||||||
web_interface->fileslist.clear();
|
web_interface->fileslist.clear();
|
||||||
//block any new output to serial from ESP to avoid pollution
|
//block any new output to serial from ESP to avoid pollution
|
||||||
if (handlelockserial)(web_interface->blockserial) = true;
|
if (handlelockserial)(web_interface->blockserial) = true;
|
||||||
return;
|
return is_temp;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef TEMP_MONITORING_FEATURE
|
|
||||||
int Tpos = buffer.indexOf("T:");
|
int Tpos = buffer.indexOf("T:");
|
||||||
#endif
|
if (Tpos > -1 ) is_temp = true;
|
||||||
#ifdef POS_MONITORING_FEATURE
|
#ifdef POS_MONITORING_FEATURE
|
||||||
int Xpos = buffer.indexOf("X:");
|
int Xpos = buffer.indexOf("X:");
|
||||||
int Ypos = buffer.indexOf("Y:");
|
int Ypos = buffer.indexOf("Y:");
|
||||||
@ -673,6 +673,7 @@ void COMMAND::check_command(String buffer, tpipe output, bool handlelockserial)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
return is_temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
//read a buffer in an array
|
//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, size_t len);
|
||||||
static void read_buffer_serial(uint8_t b);
|
static void read_buffer_serial(uint8_t b);
|
||||||
static void read_buffer_tcp(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 void execute_command(int cmd,String cmd_params, tpipe output);
|
||||||
static String get_param(String & cmd_params, const char * id, bool withspace = false);
|
static String get_param(String & cmd_params, const char * id, bool withspace = false);
|
||||||
static bool isadmin(String & cmd_params);
|
static bool isadmin(String & cmd_params);
|
||||||
|
@ -3803,6 +3803,7 @@ void handle_web_command(){
|
|||||||
String current_buffer;
|
String current_buffer;
|
||||||
String current_line;
|
String current_line;
|
||||||
int pos;
|
int pos;
|
||||||
|
int temp_counter = 0;
|
||||||
String tmp;
|
String tmp;
|
||||||
bool datasent = false;
|
bool datasent = false;
|
||||||
//pickup the list
|
//pickup the list
|
||||||
@ -3836,7 +3837,7 @@ void handle_web_command(){
|
|||||||
LOG(current_line)
|
LOG(current_line)
|
||||||
LOG("\r\n")
|
LOG("\r\n")
|
||||||
//check command
|
//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 ((FIRMWARE_TARGET == REPETIER) || (FIRMWARE_TARGET == REPETIER4DV))
|
||||||
if (!current_line.startsWith( "ok "))
|
if (!current_line.startsWith( "ok "))
|
||||||
#endif
|
#endif
|
||||||
@ -3853,7 +3854,10 @@ void handle_web_command(){
|
|||||||
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);
|
||||||
} else delay(1);
|
} 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++;
|
count++;
|
||||||
}
|
}
|
||||||
//to be sure connection close
|
//to be sure connection close
|
||||||
|
Loading…
x
Reference in New Issue
Block a user