From d8407cf0ab1b38a229c04ce1217ff3fb8a18c541 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald@gmail.com" Date: Thu, 16 Oct 2014 13:49:32 +0000 Subject: [PATCH] only print counter if it was sent --- example/libusb/spp_and_le_counter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example/libusb/spp_and_le_counter.c b/example/libusb/spp_and_le_counter.c index 3eac7292b..67d2f0573 100644 --- a/example/libusb/spp_and_le_counter.c +++ b/example/libusb/spp_and_le_counter.c @@ -197,12 +197,13 @@ static void heartbeat_handler(struct timer *ts){ counter++; counter_string_len = sprintf(counter_string, "BTstack counter %04u\n", counter); - printf("%s", counter_string); if (rfcomm_channel_id){ int err = rfcomm_send_internal(rfcomm_channel_id, (uint8_t*) counter_string, counter_string_len); if (err) { log_error("rfcomm_send_internal -> error 0X%02x", err); + } else { + printf("%s", counter_string); } }