@@ -35,8 +35,10 @@ using namespace mbed_cellular_util;
35
35
36
36
#include " CellularLog.h"
37
37
38
- #ifndef MBED_CONF_CELLULAR_DEBUG_AT
39
- #define MBED_CONF_CELLULAR_DEBUG_AT 0
38
+ #if defined(MBED_CONF_CELLULAR_DEBUG_AT) && (MBED_CONF_CELLULAR_DEBUG_AT) && defined(MBED_CONF_MBED_TRACE_ENABLE) && MBED_CONF_MBED_TRACE_ENABLE
39
+ #define DEBUG_AT_ENABLED 1
40
+ #else
41
+ #define DEBUG_AT_ENABLED 0
40
42
#endif
41
43
42
44
// URCs should be handled fast, if you add debug traces within URC processing then you also need to increase this time
@@ -89,7 +91,7 @@ ATHandler::ATHandler(FileHandle *fh, EventQueue &queue, uint32_t timeout, const
89
91
_urc_matched(false ),
90
92
_error_found(false ),
91
93
_max_resp_length(MAX_RESP_LENGTH),
92
- _debug_on(MBED_CONF_CELLULAR_DEBUG_AT ),
94
+ _debug_on(DEBUG_AT_ENABLED ),
93
95
_cmd_start(false ),
94
96
_use_delimiter(true ),
95
97
_start_time(0 ),
@@ -495,7 +497,7 @@ ssize_t ATHandler::read_bytes(uint8_t *buf, size_t len)
495
497
buf[read_len] = c;
496
498
}
497
499
498
- #if MBED_CONF_CELLULAR_DEBUG_AT
500
+ #if DEBUG_AT_ENABLED
499
501
if (debug_on && disabled_debug) {
500
502
tr_info (" read_bytes trace suppressed (total length %d)" , read_len);
501
503
}
@@ -651,7 +653,7 @@ ssize_t ATHandler::read_hex_string(char *buf, size_t size)
651
653
buf_idx++;
652
654
}
653
655
654
- #if MBED_CONF_CELLULAR_DEBUG_AT
656
+ #if DEBUG_AT_ENABLED
655
657
if (debug_on && disabled_debug) {
656
658
tr_info (" read_hex_string trace suppressed (total length %d)" , buf_idx);
657
659
}
@@ -1379,8 +1381,8 @@ size_t ATHandler::write(const void *data, size_t len)
1379
1381
fhs.events = POLLOUT;
1380
1382
size_t write_len = 0 ;
1381
1383
1382
- #if MBED_CONF_CELLULAR_DEBUG_AT
1383
- bool suppress_traced = false ;
1384
+ #if DEBUG_AT_ENABLED
1385
+ bool suppress_traces = false ;
1384
1386
#endif
1385
1387
1386
1388
for (; write_len < len;) {
@@ -1395,13 +1397,13 @@ size_t ATHandler::write(const void *data, size_t len)
1395
1397
return 0 ;
1396
1398
}
1397
1399
1398
- #if MBED_CONF_CELLULAR_DEBUG_AT
1400
+ #if DEBUG_AT_ENABLED
1399
1401
if (write_len + ret > DEBUG_MAXLEN) {
1400
- if (_debug_on && !suppress_traced ) {
1402
+ if (_debug_on && !suppress_traces ) {
1401
1403
debug_print ((char *)data + write_len, DEBUG_MAXLEN, AT_TX);
1402
1404
tr_debug (" write trace suppressed (total length %d)" , len);
1403
1405
}
1404
- suppress_traced = true ;
1406
+ suppress_traces = true ;
1405
1407
} else {
1406
1408
debug_print ((char *)data + write_len, ret, AT_TX);
1407
1409
}
@@ -1451,7 +1453,7 @@ void ATHandler::flush()
1451
1453
1452
1454
void ATHandler::debug_print (const char *p, int len, ATType type)
1453
1455
{
1454
- #if MBED_CONF_CELLULAR_DEBUG_AT
1456
+ #if DEBUG_AT_ENABLED
1455
1457
if (_debug_on) {
1456
1458
const int buf_size = len * 4 + 1 ; // x4 -> reserve space for extra characters, +1 -> terminating null
1457
1459
char *buffer = new char [buf_size];
@@ -1489,7 +1491,7 @@ void ATHandler::debug_print(const char *p, int len, ATType type)
1489
1491
tr_error (" AT trace unable to allocate buffer!" );
1490
1492
}
1491
1493
}
1492
- #endif // MBED_CONF_CELLULAR_DEBUG_AT
1494
+ #endif // DEBUG_AT_ENABLED
1493
1495
}
1494
1496
1495
1497
bool ATHandler::sync (int timeout_ms)
0 commit comments