File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -394,6 +394,19 @@ bool ATCmdParser::process_oob()
394
394
if (c < 0 ) {
395
395
return false ;
396
396
}
397
+ // Simplify newlines (borrowed from retarget.cpp)
398
+ if ((c == CR && _in_prev != LF) ||
399
+ (c == LF && _in_prev != CR)) {
400
+ _in_prev = c;
401
+ c = ' \n ' ;
402
+ } else if ((c == CR && _in_prev == LF) ||
403
+ (c == LF && _in_prev == CR)) {
404
+ _in_prev = c;
405
+ // onto next character
406
+ continue ;
407
+ } else {
408
+ _in_prev = c;
409
+ }
397
410
_buffer[i++] = c;
398
411
_buffer[i] = 0 ;
399
412
@@ -411,9 +424,7 @@ bool ATCmdParser::process_oob()
411
424
412
425
// Clear the buffer when we hit a newline or ran out of space
413
426
// running out of space usually means we ran into binary data
414
- if (i+1 >= _buffer_size ||
415
- strcmp (&_buffer[i-_output_delim_size], _output_delimiter) == 0 ) {
416
-
427
+ if (((i+1 ) >= _buffer_size) || (c == ' \n ' )) {
417
428
debug_if (_dbg_on, " AT< %s" , _buffer);
418
429
i = 0 ;
419
430
}
You can’t perform that action at this time.
0 commit comments