Browse Source

Включение отладки

pull/24/head
Sergey 4 years ago
parent
commit
72214cfff0
  1. 55
      Marlin/src/libs/Segger/log.h
  2. 2
      Marlin/src/module/mks_wifi/debug_to_uart.cpp
  3. 4
      Marlin/src/module/mks_wifi/debug_to_uart.h

55
Marlin/src/libs/Segger/log.h

@ -1,43 +1,37 @@
#ifndef LOG_H #ifndef LOG_H
#define 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_UART
#define DEBUG_TO_SEGGER_RTT //#define DEBUG_TO_SEGGER_RTT
#ifdef COLOR_LOG_RTT #ifdef DEBUG_TO_UART
#include <stdarg.h>
#include "../../module/mks_wifi/debug_to_uart.h"
#define DEBUG_MSG
#define INFO_MSG
#define WARNING_MSG
#define ERROR_MSG
#endif
#ifdef DEBUG_MSG #ifdef DEBUG_TO_SEGGER_RTT
#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) #include "SEGGER_RTT.h"
#else #define DEBUG_MSG
#define INFO_MSG
#define WARNING_MSG
#define ERROR_MSG
#endif
#ifndef DEBUG_TO_SEGGER_RTT
#ifndef DEBUG_TO_UART
#include <stdarg.h>
#define DEBUG(fmt, args...) #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...) #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...) #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...) #define ERROR(fmt, args...)
#endif #endif
#else #endif
#ifdef DEBUG_TO_UART
#ifdef DEBUG_TO_UART
#ifdef DEBUG_MSG #ifdef DEBUG_MSG
#define DEBUG(fmt, args...) debug_to_uart((char*)"[D] %-20s:%-4d :" fmt "\n", __func__, __LINE__, ## args) #define DEBUG(fmt, args...) debug_to_uart((char*)"[D] %-20s:%-4d :" fmt "\n", __func__, __LINE__, ## args)
#else #else
@ -59,9 +53,9 @@
#define ERROR(fmt, args...) #define ERROR(fmt, args...)
#endif #endif
#endif #endif
#ifdef DEBUG_TO_SEGGER_RTT #ifdef DEBUG_TO_SEGGER_RTT
#ifdef DEBUG_MSG #ifdef DEBUG_MSG
#define DEBUG(fmt, args...) SEGGER_RTT_printf(0,"[D] %-20s:%-4d :" fmt "\r\n", __func__, __LINE__, ## args) #define DEBUG(fmt, args...) SEGGER_RTT_printf(0,"[D] %-20s:%-4d :" fmt "\r\n", __func__, __LINE__, ## args)
@ -88,4 +82,3 @@
#endif #endif
#endif

2
Marlin/src/module/mks_wifi/debug_to_uart.cpp

@ -25,7 +25,5 @@ void debug_to_uart(char *fmt,...){
} }
} }
#endif #endif

4
Marlin/src/module/mks_wifi/debug_to_uart.h

@ -1,11 +1,11 @@
#ifndef DEBUG_UART_H #ifndef DEBUG_UART_H
#define DEBUG_UART_H #define DEBUG_UART_H
#ifdef DEBUG_TO_UART
#include "../../MarlinCore.h" #include "../../MarlinCore.h"
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#ifdef DEBUG_TO_UART
void debug_to_uart(char *fmt,...); void debug_to_uart(char *fmt,...);
#endif #endif

Loading…
Cancel
Save