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

@@ -767,7 +767,7 @@ void handleIR()
if (results.value != 0) // only print results if anything is received ( != 0 )
{
if (!pinManager.isPinAllocated(hardwareTX) || pinManager.getPinOwner(hardwareTX) == PinOwner::DebugOut) // Serial TX pin (GPIO 1 on ESP32 and ESP8266)
Serial.printf_P(PSTR("IR recv: 0x%lX\n"), (unsigned long)results.value);
if (Serial) Serial.printf_P(PSTR("IR recv: 0x%lX\n"), (unsigned long)results.value);
}
decodeIR(results.value);
irrecv->resume();