From d5dee30368b2d21d2a9c5f1bd632e375229ce2b1 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Mon, 14 Feb 2022 17:53:21 +0100 Subject: [PATCH] shell/sc_gnrc_udp: don't add delay after last packet --- sys/shell/commands/sc_gnrc_udp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/shell/commands/sc_gnrc_udp.c b/sys/shell/commands/sc_gnrc_udp.c index e8eb3e46c1..2c30416e40 100644 --- a/sys/shell/commands/sc_gnrc_udp.c +++ b/sys/shell/commands/sc_gnrc_udp.c @@ -60,7 +60,7 @@ static void _send(const char *addr_str, const char *port_str, return; } - for (unsigned int i = 0; i < num; i++) { + while (num--) { gnrc_pktsnip_t *payload, *udp, *ip; unsigned payload_size; /* allocate payload */ @@ -105,11 +105,13 @@ static void _send(const char *addr_str, const char *port_str, * => use temporary variable for output */ printf("Success: sent %u byte(s) to [%s]:%u\n", payload_size, addr_str, port); + if (num) { #if IS_USED(MODULE_ZTIMER_MSEC) - ztimer_sleep(ZTIMER_MSEC, delay); + ztimer_sleep(ZTIMER_MSEC, delay); #else - xtimer_usleep(delay); + xtimer_usleep(delay); #endif + } } }