handling of Serial on CDC USB board

... like the typical -C3
* Replaced a few direct Serial.printf with macros
* Always check if Serial is connected before printing (CDC sometimes hangs  when trying to send/receive without connection)
This commit is contained in:
Frank
2023-04-13 22:59:09 +02:00
parent 0081122f13
commit 94a7f5623d
6 changed files with 27 additions and 25 deletions

View File

@@ -32,10 +32,10 @@ void updateBaudRate(uint32_t rate){
currentBaud = rate100;
if (!pinManager.isPinAllocated(hardwareTX) || pinManager.getPinOwner(hardwareTX) == PinOwner::DebugOut){
Serial.print(F("Baud is now ")); Serial.println(rate);
if (Serial) { Serial.print(F("Baud is now ")); Serial.println(rate); }
}
Serial.flush();
if (Serial) Serial.flush();
Serial.begin(rate);
}