MCPcopy Create free account
hub / github.com/HASwitchPlate/openHASP / debugStartSerial

Function debugStartSerial

src/log/hasp_debug.cpp:365–392  ·  view source on GitHub ↗

Start Serial Port at correct

Source from the content-addressed store, hash-verified

363
364// Start Serial Port at correct
365void debugStartSerial()
366{
367 if(debugSerialBaud < 0) {
368 LOG_WARNING(TAG_DEBG, F(D_SERVICE_DISABLED " (%u Bps)"), debugSerialBaud);
369 // return;
370 }
371
372 uint32_t baudrate = debugSerialBaud;
373 if(baudrate < 9600) baudrate = SERIAL_SPEED;
374
375#if defined(STM32F4xx) || defined(STM32F7xx)
376#ifndef STM32_SERIAL1 // Define what Serial port to use for log output
377 Serial.setRx(PA3); // User Serial2
378 Serial.setTx(PA2);
379#endif
380#endif
381
382 Serial.begin(baudrate); /* prepare for possible serial debug */
383 delay(10);
384 Log.registerOutput(0, &Serial, HASP_LOG_LEVEL, true); // LOG_LEVEL_VERBOSE
385
386 Serial.println();
387 debugPrintHaspHeader(&Serial);
388 Serial.flush();
389
390 LOG_INFO(TAG_DEBG, F(D_SERVICE_STARTED " @ %u bps"), debugSerialBaud);
391 LOG_INFO(TAG_DEBG, F(D_INFO_ENVIRONMENT ": " PIOENV));
392}
393
394// Do NOT call Log function before debugSetup is called
395void debugSetup(JsonObject settings)

Callers 1

consoleStartFunction · 0.85

Calls 4

debugPrintHaspHeaderFunction · 0.85
registerOutputMethod · 0.80
LOG_WARNINGFunction · 0.50
beginMethod · 0.45

Tested by

no test coverage detected