From 02c141edad5fc76a4f5f9e7d268b3c39584e6b48 Mon Sep 17 00:00:00 2001 From: Mitch Bradley Date: Fri, 21 May 2021 10:06:57 -1000 Subject: [PATCH] Fixed logging - Serial -> Uart0 --- Grbl_Esp32/src/Logging.cpp | 25 +++++++++++++++---------- Grbl_Esp32/src/Logging.h | 10 +++++----- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Grbl_Esp32/src/Logging.cpp b/Grbl_Esp32/src/Logging.cpp index e1d42a5c..aec8cfb8 100644 --- a/Grbl_Esp32/src/Logging.cpp +++ b/Grbl_Esp32/src/Logging.cpp @@ -2,30 +2,35 @@ #ifndef ESP32 -#include +# include DebugStream::DebugStream(const char* name) { std::cout << '[' << name << ": "; } -void DebugStream::add(char c) -{ +void DebugStream::add(char c) { std::cout << c; } -DebugStream::~DebugStream() { std::cout << ']' << std::endl; } +DebugStream::~DebugStream() { + std::cout << ']' << std::endl; +} #else -#include +# include "Uart.h" DebugStream::DebugStream(const char* name) { - Serial.print("["); - Serial.print(name); - Serial.print(": "); + Uart0.print("["); + Uart0.print(name); + Uart0.print(": "); } -void DebugStream::add(char c) { Serial.print(c); } +void DebugStream::add(char c) { + Uart0.print(c); +} -DebugStream::~DebugStream() { Serial.println("]"); } +DebugStream::~DebugStream() { + Uart0.println("]"); +} #endif diff --git a/Grbl_Esp32/src/Logging.h b/Grbl_Esp32/src/Logging.h index 89fa5bb7..6f4519cc 100644 --- a/Grbl_Esp32/src/Logging.h +++ b/Grbl_Esp32/src/Logging.h @@ -25,31 +25,31 @@ public: #include "StringStream.h" // Note: these '{'..'}' scopes are here for a reason: the destructor should flush. -#define log_debug(x) \ +#define log_debug(x) \ { \ DebugStream ss("DBG "); \ ss << x; \ } -#define log_info(x) \ +#define log_info(x) \ { \ DebugStream ss("INFO"); \ ss << x; \ } -#define log_warn(x) \ +#define log_warn(x) \ { \ DebugStream ss("WARN"); \ ss << x; \ } -#define log_error(x) \ +#define log_error(x) \ { \ DebugStream ss("ERR "); \ ss << x; \ } -#define log_fatal(x) \ +#define log_fatal(x) \ { \ DebugStream ss("FATAL "); \ ss << x; \