@@ -37,7 +37,8 @@ using namespace mbed_cellular_util;
37
37
#define PROCESS_URC_TIME 20
38
38
39
39
// Suppress logging of very big packet payloads, maxlen is approximate due to write/read are cached
40
- #define DEBUG_MAXLEN 80
40
+ #define DEBUG_MAXLEN 60
41
+ #define DEBUG_END_MARK " ..\r "
41
42
42
43
const char *mbed::OK = " OK\r\n " ;
43
44
const uint8_t OK_LENGTH = 4 ;
@@ -463,7 +464,7 @@ ssize_t ATHandler::read_bytes(uint8_t *buf, size_t len)
463
464
}
464
465
buf[read_len] = c;
465
466
if (_debug_on && read_len >= DEBUG_MAXLEN) {
466
- debug_print (" .. " , sizeof (" .. " ) );
467
+ debug_print (DEBUG_END_MARK , sizeof (DEBUG_END_MARK) - 1 );
467
468
_debug_on = false ;
468
469
}
469
470
}
@@ -555,9 +556,15 @@ ssize_t ATHandler::read_hex_string(char *buf, size_t size)
555
556
size_t buf_idx = 0 ;
556
557
char hexbuf[2 ];
557
558
559
+ bool debug_on = _debug_on;
558
560
for (; read_idx < size * 2 + match_pos; read_idx++) {
559
561
int c = get_char ();
560
562
563
+ if (_debug_on && read_idx >= DEBUG_MAXLEN) {
564
+ debug_print (DEBUG_END_MARK, sizeof (DEBUG_END_MARK) - 1 );
565
+ _debug_on = false ;
566
+ }
567
+
561
568
if (match_pos) {
562
569
buf_idx++;
563
570
} else {
@@ -595,6 +602,7 @@ ssize_t ATHandler::read_hex_string(char *buf, size_t size)
595
602
}
596
603
}
597
604
}
605
+ _debug_on = debug_on;
598
606
599
607
if (read_idx && (read_idx == size * 2 + match_pos)) {
600
608
buf_idx++;
@@ -1168,7 +1176,7 @@ size_t ATHandler::write(const void *data, size_t len)
1168
1176
if (write_len + ret < DEBUG_MAXLEN) {
1169
1177
debug_print ((char *)data + write_len, ret);
1170
1178
} else {
1171
- debug_print (" .. " , sizeof (" .. " ) );
1179
+ debug_print (DEBUG_END_MARK , sizeof (DEBUG_END_MARK) - 1 );
1172
1180
_debug_on = false ;
1173
1181
}
1174
1182
}
@@ -1228,7 +1236,7 @@ void ATHandler::debug_print(const char *p, int len)
1228
1236
debug (" \n " );
1229
1237
} else if (c == ' \n ' ) {
1230
1238
} else {
1231
- debug (" [%d] " , c);
1239
+ debug (" #%02x " , c);
1232
1240
}
1233
1241
} else {
1234
1242
debug (" %c" , c);
0 commit comments