@@ -100,9 +100,9 @@ bool purge_serial(){
100
100
}
101
101
size_t len = ESPCOM::readBytes (DEFAULT_PRINTER_PIPE, buf, 50 );
102
102
buf[len] = ' \0 ' ;
103
- LOG (" Purge " )
103
+ LOG (" Purge: \r\n ************ \r\n " )
104
104
LOG ((const char *)buf)
105
- LOG (" \r\n " )
105
+ LOG (" \r\n ************ \r\n " )
106
106
if ( ( CONFIG::GetFirmwareTarget () == REPETIER4DV) || (CONFIG::GetFirmwareTarget () == REPETIER) ) {
107
107
String s = (const char *)buf;
108
108
// 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){
138
138
// remove potential unwished char
139
139
snum.replace (" \r " , " " );
140
140
l = snum.toInt ();
141
- LOG (" New number " )
141
+ LOG (" Line requested is " )
142
142
LOG (String (l))
143
143
LOG (" \r\n " )
144
144
return l;
@@ -155,7 +155,7 @@ bool sendLine2Serial (String & line, int32_t linenb, int32_t * newlinenb)
155
155
LOG (" \r\n " )
156
156
String line2send;
157
157
String sok = " ok" ;
158
- String sresend = " Resend" ;
158
+ String sresend = " Resend: " ;
159
159
if (newlinenb) *newlinenb = linenb;
160
160
if ( CONFIG::GetFirmwareTarget () == SMOOTHIEWARE)sresend = " rs N" ;
161
161
if (linenb != -1 ) {
@@ -191,9 +191,9 @@ bool sendLine2Serial (String & line, int32_t linenb, int32_t * newlinenb)
191
191
sbuf[len] = ' \0 ' ;
192
192
// use string because easier to handle and allow to re-assemble cutted answer
193
193
response += (const char *) sbuf;
194
- LOG (" Response: " )
194
+ LOG (" Response:\r\n ************ \r\n " )
195
195
LOG (response)
196
- LOG (" \r\n " )
196
+ LOG (" \r\n ************ \r\n " )
197
197
// in that case there is no way to know what is the right number to use and so send should be failed
198
198
if (( ( CONFIG::GetFirmwareTarget () == REPETIER4DV) || (CONFIG::GetFirmwareTarget () == REPETIER) ) && (response.indexOf (" skip" ) != -1 )) {
199
199
LOG (" Wrong line requested\r\n " )
@@ -205,9 +205,11 @@ bool sendLine2Serial (String & line, int32_t linenb, int32_t * newlinenb)
205
205
if (( pos > -1 ) && (response.lastIndexOf (" \n " ) > pos)){
206
206
LOG (" Resend detected\r\n " )
207
207
uint32_t line_number = Get_lineNumber (response);
208
- if (newlinenb){
208
+ // this part is only if have newlinenb variable
209
+ if (newlinenb != nullptr ){
209
210
*newlinenb = line_number;
210
211
free (sbuf);
212
+ // no need newlinenb in this one in theory, but just in case...
211
213
return sendLine2Serial (line, line_number, newlinenb);
212
214
} else {
213
215
// 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)
222
224
LOG (" Exit too many resend or wrong line\r\n " )
223
225
return false ;
224
226
}
225
- LOG (" Resend\r\n " )
226
227
purge_serial ();
228
+ LOG (" Resend " )
229
+ LOG (String (count))
230
+ LOG (" \r\n " )
231
+ response=" " ;
227
232
ESPCOM::println (line2send, DEFAULT_PRINTER_PIPE);
228
233
ESPCOM::flush (DEFAULT_PRINTER_PIPE);
229
234
wait_for_data (1000 );
@@ -244,7 +249,7 @@ bool sendLine2Serial (String & line, int32_t linenb, int32_t * newlinenb)
244
249
LOG (" Time out\r\n " )
245
250
done = true ;
246
251
}
247
- CONFIG::wait (50 );
252
+ CONFIG::wait (5 );
248
253
}
249
254
}
250
255
LOG (" Send line error\r\n " )
0 commit comments