diff --git a/Marlin/src/libs/Segger/log.h b/Marlin/src/libs/Segger/log.h index 3fc5dc468d..28978e22b9 100644 --- a/Marlin/src/libs/Segger/log.h +++ b/Marlin/src/libs/Segger/log.h @@ -1,43 +1,37 @@ #ifndef LOG_H #define LOG_H -#include "SEGGER_RTT.h" -#include "../../module/mks_wifi/debug_to_uart.h" - -//#define DEBUG_MSG -//#define INFO_MSG -//#define WARNING_MSG -//#define ERROR_MSG - -//#define COLOR_LOG_RTT //#define DEBUG_TO_UART -#define DEBUG_TO_SEGGER_RTT +//#define DEBUG_TO_SEGGER_RTT -#ifdef COLOR_LOG_RTT +#ifdef DEBUG_TO_UART + #include + #include "../../module/mks_wifi/debug_to_uart.h" + #define DEBUG_MSG + #define INFO_MSG + #define WARNING_MSG + #define ERROR_MSG +#endif - #ifdef DEBUG_MSG - #define DEBUG(fmt, args...) SEGGER_RTT_printf(0,"%sDEBUG %-20s:%-4d [%d]:" fmt "%s\r\n",RTT_CTRL_TEXT_BLUE, __func__, __LINE__,dwt_get_tick_in_sec(), ## args, RTT_CTRL_RESET) - #else +#ifdef DEBUG_TO_SEGGER_RTT + #include "SEGGER_RTT.h" + #define DEBUG_MSG + #define INFO_MSG + #define WARNING_MSG + #define ERROR_MSG +#endif + +#ifndef DEBUG_TO_SEGGER_RTT + #ifndef DEBUG_TO_UART + #include #define DEBUG(fmt, args...) - #endif - #ifdef INFO_MSG - #define INFO(fmt, args...) SEGGER_RTT_printf(0,"%s[I] %-20s:%-4d [%d]:" fmt "%s\r\n",RTT_CTRL_TEXT_WHITE, __func__, __LINE__,dwt_get_tick_in_sec(), ## args,RTT_CTRL_RESET) - #else #define INFO(fmt, args...) - #endif - #ifdef WARNING_MSG - #define WARNING(fmt, args...) SEGGER_RTT_printf(0,"%s[W] %-20s:%-4d [%d]:" fmt "%s\r\n",RTT_CTRL_TEXT_BRIGHT_YELLOW, __func__, __LINE__,dwt_get_tick_in_sec(), ## args,RTT_CTRL_RESET) - #else #define WARNING(fmt, args...) - #endif - #ifdef ERROR_MSG - #define ERROR(fmt, args...) SEGGER_RTT_printf(0,"%s[E] %-20s:%-4d [%d]:" fmt "%s\r\n",RTT_CTRL_TEXT_RED, __func__, __LINE__,dwt_get_tick_in_sec(),## args,RTT_CTRL_RESET) - #else #define ERROR(fmt, args...) #endif -#else - #ifdef DEBUG_TO_UART +#endif +#ifdef DEBUG_TO_UART #ifdef DEBUG_MSG #define DEBUG(fmt, args...) debug_to_uart((char*)"[D] %-20s:%-4d :" fmt "\n", __func__, __LINE__, ## args) #else @@ -59,9 +53,9 @@ #define ERROR(fmt, args...) #endif - #endif +#endif - #ifdef DEBUG_TO_SEGGER_RTT +#ifdef DEBUG_TO_SEGGER_RTT #ifdef DEBUG_MSG #define DEBUG(fmt, args...) SEGGER_RTT_printf(0,"[D] %-20s:%-4d :" fmt "\r\n", __func__, __LINE__, ## args) @@ -88,4 +82,3 @@ #endif -#endif diff --git a/Marlin/src/module/mks_wifi/debug_to_uart.cpp b/Marlin/src/module/mks_wifi/debug_to_uart.cpp index 79be0b201a..d42e53465d 100644 --- a/Marlin/src/module/mks_wifi/debug_to_uart.cpp +++ b/Marlin/src/module/mks_wifi/debug_to_uart.cpp @@ -25,7 +25,5 @@ void debug_to_uart(char *fmt,...){ } - } - #endif diff --git a/Marlin/src/module/mks_wifi/debug_to_uart.h b/Marlin/src/module/mks_wifi/debug_to_uart.h index eacf46d3b5..7621525c4b 100644 --- a/Marlin/src/module/mks_wifi/debug_to_uart.h +++ b/Marlin/src/module/mks_wifi/debug_to_uart.h @@ -1,11 +1,11 @@ #ifndef DEBUG_UART_H #define DEBUG_UART_H -#ifdef DEBUG_TO_UART - #include "../../MarlinCore.h" #include "../../inc/MarlinConfig.h" +#ifdef DEBUG_TO_UART + void debug_to_uart(char *fmt,...); #endif