From fde823a3220ac135d27e4cad6e0d00191ca92125 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 13 Apr 2020 14:24:07 +0700 Subject: [PATCH] remove the force Serial connected when debug is eanbled. --- cores/nRF5/main.cpp | 8 ++------ .../examples/Peripheral/bleuart/bleuart.ino | 6 +++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cores/nRF5/main.cpp b/cores/nRF5/main.cpp index 62f3ca30..83a3aa3e 100644 --- a/cores/nRF5/main.cpp +++ b/cores/nRF5/main.cpp @@ -46,17 +46,13 @@ static void loop_task(void* arg) #if CFG_DEBUG // If Serial is not begin(), call it to avoid hard fault - Serial.begin(115200); - - // Wait for Serial connection in debug mode - while ( !Serial ) yield(); - - dbgPrintVersion(); + if(!Serial) Serial.begin(115200); #endif setup(); #if CFG_DEBUG + dbgPrintVersion(); Bluefruit_printInfo(); #endif diff --git a/libraries/Bluefruit52Lib/examples/Peripheral/bleuart/bleuart.ino b/libraries/Bluefruit52Lib/examples/Peripheral/bleuart/bleuart.ino index 739ff03c..2287c494 100644 --- a/libraries/Bluefruit52Lib/examples/Peripheral/bleuart/bleuart.ino +++ b/libraries/Bluefruit52Lib/examples/Peripheral/bleuart/bleuart.ino @@ -24,7 +24,11 @@ BLEBas blebas; // battery void setup() { Serial.begin(115200); -// while ( !Serial ) delay(10); // for nrf52840 with native usb + +#if CFG_DEBUG + // Blocking wait for connection when debug mode is enabled via IDE + while ( !Serial ) yield(); +#endif Serial.println("Bluefruit52 BLEUART Example"); Serial.println("---------------------------\n");