protect unconnected USB-CDC from being used

found a few more places where Serial was used without first checking if its connected.

Arduino docs: `if (Serial)` indicates whether or not the USB CDC serial connection is open. For all non-USB CDC ports, this will always return true
This commit is contained in:
Frank
2024-05-29 15:43:24 +02:00
parent 6a93f46881
commit 15199dc711
2 changed files with 4 additions and 0 deletions

View File

@@ -543,6 +543,8 @@ void show_psram_info_part2(void)
void showRealSpeed() {
//Serial.begin(115200);
if (!Serial) return; // Avoid writing to unconnected USB-CDC
Serial.flush();
Serial.println(F("\n"));
for(int aa=0; aa<65; aa++) Serial.print("="); Serial.println();