Skip to content

Commit e9e7e3b

Browse files
author
Luc
committed
Add more log
1 parent 353f3d8 commit e9e7e3b

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

src/syncwebserver.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,8 +1257,7 @@ void SDFile_serial_upload()
12571257
if (current_line.length() > 0 ) {
12581258
lineNb++;
12591259
if (!sendLine2Serial (current_line, lineNb, NULL) ) {
1260-
//fup.println("[Log]Write Error");
1261-
LOG ("Error over buffer\n")
1260+
LOG ("Error sending line\n")
12621261
CloseSerialUpload (true, current_filename,lineNb);
12631262
#if defined ( ARDUINO_ARCH_ESP8266)
12641263
web_interface->web_server.client().stopAll();

src/webinterface.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ bool purge_serial(){
100100
}
101101
size_t len = ESPCOM::readBytes (DEFAULT_PRINTER_PIPE, buf, 50);
102102
buf[len] = '\0';
103-
LOG("Purge ")
103+
LOG("Purge: \r\n************\r\n")
104104
LOG((const char *)buf)
105-
LOG("\r\n")
105+
LOG("\r\n************\r\n")
106106
if ( ( CONFIG::GetFirmwareTarget() == REPETIER4DV) || (CONFIG::GetFirmwareTarget() == REPETIER) ) {
107107
String s = (const char *)buf;
108108
//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){
138138
//remove potential unwished char
139139
snum.replace("\r", "");
140140
l = snum.toInt();
141-
LOG("New number ")
141+
LOG("Line requested is ")
142142
LOG(String(l))
143143
LOG("\r\n")
144144
return l;
@@ -155,7 +155,7 @@ bool sendLine2Serial (String & line, int32_t linenb, int32_t * newlinenb)
155155
LOG ("\r\n")
156156
String line2send;
157157
String sok = "ok";
158-
String sresend = "Resend";
158+
String sresend = "Resend:";
159159
if (newlinenb) *newlinenb = linenb;
160160
if ( CONFIG::GetFirmwareTarget() == SMOOTHIEWARE)sresend = "rs N";
161161
if (linenb != -1) {
@@ -191,9 +191,9 @@ bool sendLine2Serial (String & line, int32_t linenb, int32_t * newlinenb)
191191
sbuf[len] = '\0';
192192
//use string because easier to handle and allow to re-assemble cutted answer
193193
response += (const char*) sbuf;
194-
LOG ("Response: ")
194+
LOG ("Response:\r\n************\r\n")
195195
LOG (response)
196-
LOG ("\r\n")
196+
LOG ("\r\n************\r\n")
197197
//in that case there is no way to know what is the right number to use and so send should be failed
198198
if (( ( CONFIG::GetFirmwareTarget() == REPETIER4DV) || (CONFIG::GetFirmwareTarget() == REPETIER) ) && (response.indexOf ("skip") != -1)) {
199199
LOG ("Wrong line requested\r\n")
@@ -205,9 +205,11 @@ bool sendLine2Serial (String & line, int32_t linenb, int32_t * newlinenb)
205205
if (( pos > -1) && (response.lastIndexOf("\n") > pos)){
206206
LOG ("Resend detected\r\n")
207207
uint32_t line_number = Get_lineNumber(response);
208-
if (newlinenb){
208+
//this part is only if have newlinenb variable
209+
if (newlinenb != nullptr){
209210
*newlinenb = line_number;
210211
free(sbuf);
212+
//no need newlinenb in this one in theory, but just in case...
211213
return sendLine2Serial (line, line_number, newlinenb);
212214
} else {
213215
//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)
222224
LOG ("Exit too many resend or wrong line\r\n")
223225
return false;
224226
}
225-
LOG ("Resend\r\n")
226227
purge_serial();
228+
LOG ("Resend ")
229+
LOG (String(count))
230+
LOG ("\r\n")
231+
response="";
227232
ESPCOM::println (line2send, DEFAULT_PRINTER_PIPE);
228233
ESPCOM::flush (DEFAULT_PRINTER_PIPE);
229234
wait_for_data(1000);
@@ -244,7 +249,7 @@ bool sendLine2Serial (String & line, int32_t linenb, int32_t * newlinenb)
244249
LOG ("Time out\r\n")
245250
done = true;
246251
}
247-
CONFIG::wait (50);
252+
CONFIG::wait (5);
248253
}
249254
}
250255
LOG ("Send line error\r\n")

0 commit comments

Comments
 (0)