Skip to content

Commit 3bb70e7

Browse files
authored
feat(rmt): improve verbose logging code
1 parent 00989d4 commit 3bb70e7

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

cores/esp32/esp32-hal-rmt.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,18 +303,23 @@ static bool _rmtWrite(int pin, rmt_data_t *data, size_t num_rmt_symbols, bool bl
303303
}
304304
}
305305

306+
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE
306307
log_v("GPIO: %d - Request: %d RMT Symbols - %s - Timeout: %d", pin, num_rmt_symbols, blocking ? "Blocking" : "Non-Blocking", timeout_ms);
307308
// loop parameter semantics:
308309
// loop == 0: no looping (single transmission)
309310
// loop == 1: infinite looping
310311
// loop > 1: transmit the data 'loop' times
311-
log_v(
312-
"GPIO: %d - Currently in Loop Mode: [%s] | Loop Request: [%s], LoopCancel: [%s]", pin,
313-
bus->rmt_ch_is_looping ? "YES" : "NO",
314-
loop == 0 ? "NO" : (loop == 1 ? "FOREVER" : ({ char buf[20]; sprintf(buf, "%lu times", loop); buf; })),
315-
loopCancel ? "YES" : "NO"
316-
);
317-
312+
{
313+
char buf[20];
314+
log_v(
315+
"GPIO: %d - Currently in Loop Mode: [%s] | Loop Request: [%s], LoopCancel: [%s]", pin,
316+
bus->rmt_ch_is_looping ? "YES" : "NO",
317+
loop == 0 ? "NO" : (loop == 1 ? "FOREVER" : ({ sprintf(buf, "%lu times", loop); buf; })),
318+
loopCancel ? "YES" : "NO"
319+
);
320+
}
321+
#endif
322+
318323
if ((xEventGroupGetBits(bus->rmt_events) & RMT_FLAG_TX_DONE) == 0) {
319324
log_v("GPIO %d - RMT Write still pending to be completed.", pin);
320325
return false;

0 commit comments

Comments
 (0)