mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-14 12:25:55 +08:00
Add more log
This commit is contained in:
parent
353f3d8af2
commit
e9e7e3bc7a
@ -1257,8 +1257,7 @@ void SDFile_serial_upload()
|
|||||||
if (current_line.length() > 0 ) {
|
if (current_line.length() > 0 ) {
|
||||||
lineNb++;
|
lineNb++;
|
||||||
if (!sendLine2Serial (current_line, lineNb, NULL) ) {
|
if (!sendLine2Serial (current_line, lineNb, NULL) ) {
|
||||||
//fup.println("[Log]Write Error");
|
LOG ("Error sending line\n")
|
||||||
LOG ("Error over buffer\n")
|
|
||||||
CloseSerialUpload (true, current_filename,lineNb);
|
CloseSerialUpload (true, current_filename,lineNb);
|
||||||
#if defined ( ARDUINO_ARCH_ESP8266)
|
#if defined ( ARDUINO_ARCH_ESP8266)
|
||||||
web_interface->web_server.client().stopAll();
|
web_interface->web_server.client().stopAll();
|
||||||
|
@ -100,9 +100,9 @@ bool purge_serial(){
|
|||||||
}
|
}
|
||||||
size_t len = ESPCOM::readBytes (DEFAULT_PRINTER_PIPE, buf, 50);
|
size_t len = ESPCOM::readBytes (DEFAULT_PRINTER_PIPE, buf, 50);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
LOG("Purge ")
|
LOG("Purge: \r\n************\r\n")
|
||||||
LOG((const char *)buf)
|
LOG((const char *)buf)
|
||||||
LOG("\r\n")
|
LOG("\r\n************\r\n")
|
||||||
if ( ( CONFIG::GetFirmwareTarget() == REPETIER4DV) || (CONFIG::GetFirmwareTarget() == REPETIER) ) {
|
if ( ( CONFIG::GetFirmwareTarget() == REPETIER4DV) || (CONFIG::GetFirmwareTarget() == REPETIER) ) {
|
||||||
String s = (const char *)buf;
|
String s = (const char *)buf;
|
||||||
//repetier never stop sending data so no need to wait if have 'wait' or 'busy'
|
//repetier never stop sending data so no need to wait if have 'wait' or 'busy'
|
||||||
@ -138,7 +138,7 @@ uint32_t Get_lineNumber(String & response){
|
|||||||
//remove potential unwished char
|
//remove potential unwished char
|
||||||
snum.replace("\r", "");
|
snum.replace("\r", "");
|
||||||
l = snum.toInt();
|
l = snum.toInt();
|
||||||
LOG("New number ")
|
LOG("Line requested is ")
|
||||||
LOG(String(l))
|
LOG(String(l))
|
||||||
LOG("\r\n")
|
LOG("\r\n")
|
||||||
return l;
|
return l;
|
||||||
@ -155,7 +155,7 @@ bool sendLine2Serial (String & line, int32_t linenb, int32_t * newlinenb)
|
|||||||
LOG ("\r\n")
|
LOG ("\r\n")
|
||||||
String line2send;
|
String line2send;
|
||||||
String sok = "ok";
|
String sok = "ok";
|
||||||
String sresend = "Resend";
|
String sresend = "Resend:";
|
||||||
if (newlinenb) *newlinenb = linenb;
|
if (newlinenb) *newlinenb = linenb;
|
||||||
if ( CONFIG::GetFirmwareTarget() == SMOOTHIEWARE)sresend = "rs N";
|
if ( CONFIG::GetFirmwareTarget() == SMOOTHIEWARE)sresend = "rs N";
|
||||||
if (linenb != -1) {
|
if (linenb != -1) {
|
||||||
@ -191,9 +191,9 @@ bool sendLine2Serial (String & line, int32_t linenb, int32_t * newlinenb)
|
|||||||
sbuf[len] = '\0';
|
sbuf[len] = '\0';
|
||||||
//use string because easier to handle and allow to re-assemble cutted answer
|
//use string because easier to handle and allow to re-assemble cutted answer
|
||||||
response += (const char*) sbuf;
|
response += (const char*) sbuf;
|
||||||
LOG ("Response: ")
|
LOG ("Response:\r\n************\r\n")
|
||||||
LOG (response)
|
LOG (response)
|
||||||
LOG ("\r\n")
|
LOG ("\r\n************\r\n")
|
||||||
//in that case there is no way to know what is the right number to use and so send should be failed
|
//in that case there is no way to know what is the right number to use and so send should be failed
|
||||||
if (( ( CONFIG::GetFirmwareTarget() == REPETIER4DV) || (CONFIG::GetFirmwareTarget() == REPETIER) ) && (response.indexOf ("skip") != -1)) {
|
if (( ( CONFIG::GetFirmwareTarget() == REPETIER4DV) || (CONFIG::GetFirmwareTarget() == REPETIER) ) && (response.indexOf ("skip") != -1)) {
|
||||||
LOG ("Wrong line requested\r\n")
|
LOG ("Wrong line requested\r\n")
|
||||||
@ -205,9 +205,11 @@ bool sendLine2Serial (String & line, int32_t linenb, int32_t * newlinenb)
|
|||||||
if (( pos > -1) && (response.lastIndexOf("\n") > pos)){
|
if (( pos > -1) && (response.lastIndexOf("\n") > pos)){
|
||||||
LOG ("Resend detected\r\n")
|
LOG ("Resend detected\r\n")
|
||||||
uint32_t line_number = Get_lineNumber(response);
|
uint32_t line_number = Get_lineNumber(response);
|
||||||
if (newlinenb){
|
//this part is only if have newlinenb variable
|
||||||
|
if (newlinenb != nullptr){
|
||||||
*newlinenb = line_number;
|
*newlinenb = line_number;
|
||||||
free(sbuf);
|
free(sbuf);
|
||||||
|
//no need newlinenb in this one in theory, but just in case...
|
||||||
return sendLine2Serial (line, line_number, newlinenb);
|
return sendLine2Serial (line, line_number, newlinenb);
|
||||||
} else {
|
} else {
|
||||||
//the line requested is not the current one so we stop
|
//the line requested is not the current one so we stop
|
||||||
@ -222,8 +224,11 @@ bool sendLine2Serial (String & line, int32_t linenb, int32_t * newlinenb)
|
|||||||
LOG ("Exit too many resend or wrong line\r\n")
|
LOG ("Exit too many resend or wrong line\r\n")
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LOG ("Resend\r\n")
|
|
||||||
purge_serial();
|
purge_serial();
|
||||||
|
LOG ("Resend ")
|
||||||
|
LOG (String(count))
|
||||||
|
LOG ("\r\n")
|
||||||
|
response="";
|
||||||
ESPCOM::println (line2send, DEFAULT_PRINTER_PIPE);
|
ESPCOM::println (line2send, DEFAULT_PRINTER_PIPE);
|
||||||
ESPCOM::flush (DEFAULT_PRINTER_PIPE);
|
ESPCOM::flush (DEFAULT_PRINTER_PIPE);
|
||||||
wait_for_data(1000);
|
wait_for_data(1000);
|
||||||
@ -244,7 +249,7 @@ bool sendLine2Serial (String & line, int32_t linenb, int32_t * newlinenb)
|
|||||||
LOG ("Time out\r\n")
|
LOG ("Time out\r\n")
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
CONFIG::wait (50);
|
CONFIG::wait (5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG ("Send line error\r\n")
|
LOG ("Send line error\r\n")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user