only print counter if it was sent

This commit is contained in:
matthias.ringwald@gmail.com 2014-10-16 13:49:32 +00:00
parent e9f7ae9d05
commit d8407cf0ab

View File

@ -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);
}
}