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
#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 <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
#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 <stdarg.h>
#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

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

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

4
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

Loading…
Cancel
Save