Skip to content

Commit 9f18192

Browse files
committed
Silence debug_printf() throughout is UART is not enabled
1 parent 6240e2c commit 9f18192

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

firmware/nRF51/tag-proximity/inc/main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ extern uint8_t hibernate;
3030
extern uint16_t status_flags;
3131
extern uint8_t boot_count;
3232
extern uint32_t reset_reason;
33+
extern uint8_t uart_enabled;
3334

3435
extern void blink(uint8_t times);
3536
extern void blink_fast(uint8_t times);

firmware/nRF51/tag-proximity/src/log.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,8 @@ uint8_t flash_setup_logging(uint32_t uid)
561561
if (nrf_gpio_pin_read(CONFIG_SWITCH_PIN) && blink_wait_release() > 1000)
562562
{
563563
blink_fast(5);
564-
debug_printf("\n\rERASING FLASH\n\r");
564+
if (uart_enabled)
565+
debug_printf("\n\rERASING FLASH\n\r");
565566
flash_erase_chip();
566567
flash_wait_ready(1);
567568

@@ -602,7 +603,8 @@ uint8_t flash_setup_logging(uint32_t uid)
602603
#endif
603604

604605
log_running = 1;
605-
debug_printf("\n\rLogging starts at block %i of %i\n\r", current_block, flash_log_last_block);
606+
if (uart_enabled)
607+
debug_printf("\n\rLogging starts at block %i of %i\n\r", current_block, flash_log_last_block);
606608

607609
return 0;
608610
}

0 commit comments

Comments
 (0)