aboutsummaryrefslogtreecommitdiff
path: root/Marlin/src/core/debug_out.h
blob: 6ae1b9d8bb9704d9db60ca2687e353a85b041f8e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/**
 * Marlin 3D Printer Firmware
 * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 *
 * Based on Sprinter and grbl.
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 */

//
// Serial aliases for debugging.
// Include this header after defining DEBUG_OUT
//  (or not) in a given .cpp file
//

#undef DEBUG_SECTION
#undef DEBUG_PRINT_P
#undef DEBUG_ECHO_START
#undef DEBUG_ERROR_START
#undef DEBUG_CHAR
#undef DEBUG_ECHO
#undef DEBUG_DECIMAL
#undef DEBUG_ECHO_F
#undef DEBUG_ECHOLN
#undef DEBUG_ECHOPGM
#undef DEBUG_ECHOLNPGM
#undef DEBUG_ECHOPAIR
#undef DEBUG_ECHOPAIR_P
#undef DEBUG_ECHOPAIR_F
#undef DEBUG_ECHOPAIR_F_P
#undef DEBUG_ECHOLNPAIR
#undef DEBUG_ECHOLNPAIR_P
#undef DEBUG_ECHOLNPAIR_F
#undef DEBUG_ECHOLNPAIR_F_P
#undef DEBUG_ECHO_MSG
#undef DEBUG_ERROR_MSG
#undef DEBUG_EOL
#undef DEBUG_FLUSH
#undef DEBUG_POS
#undef DEBUG_XYZ
#undef DEBUG_DELAY
#undef DEBUG_SYNCHRONIZE

#if DEBUG_OUT

  #include "debug_section.h"
  #define DEBUG_SECTION(N,S,D)    SectionLog N(PSTR(S),D)

  #define DEBUG_PRINT_P(P)        serialprintPGM(P)
  #define DEBUG_ECHO_START        SERIAL_ECHO_START
  #define DEBUG_ERROR_START       SERIAL_ERROR_START
  #define DEBUG_CHAR              SERIAL_CHAR
  #define DEBUG_ECHO              SERIAL_ECHO
  #define DEBUG_DECIMAL           SERIAL_DECIMAL
  #define DEBUG_ECHO_F            SERIAL_ECHO_F
  #define DEBUG_ECHOLN            SERIAL_ECHOLN
  #define DEBUG_ECHOPGM           SERIAL_ECHOPGM
  #define DEBUG_ECHOLNPGM         SERIAL_ECHOLNPGM
  #define DEBUG_ECHOPAIR          SERIAL_ECHOPAIR
  #define DEBUG_ECHOPAIR_P        SERIAL_ECHOPAIR_P
  #define DEBUG_ECHOPAIR_F        SERIAL_ECHOPAIR_F
  #define DEBUG_ECHOPAIR_F_P      SERIAL_ECHOPAIR_F_P
  #define DEBUG_ECHOLNPAIR        SERIAL_ECHOLNPAIR
  #define DEBUG_ECHOLNPAIR_P      SERIAL_ECHOLNPAIR_P
  #define DEBUG_ECHOLNPAIR_F      SERIAL_ECHOLNPAIR_F
  #define DEBUG_ECHOLNPAIR_F_P    SERIAL_ECHOLNPAIR_F_P
  #define DEBUG_ECHO_MSG          SERIAL_ECHO_MSG
  #define DEBUG_ERROR_MSG         SERIAL_ERROR_MSG
  #define DEBUG_EOL               SERIAL_EOL
  #define DEBUG_FLUSH             SERIAL_FLUSH
  #define DEBUG_POS               SERIAL_POS
  #define DEBUG_XYZ               SERIAL_XYZ
  #define DEBUG_DELAY(ms)         serial_delay(ms)
  #define DEBUG_SYNCHRONIZE()     planner.synchronize()

#else

  #define DEBUG_SECTION(...)        NOOP
  #define DEBUG_PRINT_P(P)          NOOP
  #define DEBUG_ECHO_START()        NOOP
  #define DEBUG_ERROR_START()       NOOP
  #define DEBUG_CHAR(...)           NOOP
  #define DEBUG_ECHO(...)           NOOP
  #define DEBUG_DECIMAL(...)        NOOP
  #define DEBUG_ECHO_F(...)         NOOP
  #define DEBUG_ECHOLN(...)         NOOP
  #define DEBUG_ECHOPGM(...)        NOOP
  #define DEBUG_ECHOLNPGM(...)      NOOP
  #define DEBUG_ECHOPAIR(...)       NOOP
  #define DEBUG_ECHOPAIR_P(...)     NOOP
  #define DEBUG_ECHOPAIR_F(...)     NOOP
  #define DEBUG_ECHOPAIR_F_P(...)   NOOP
  #define DEBUG_ECHOLNPAIR(...)     NOOP
  #define DEBUG_ECHOLNPAIR_P(...)   NOOP
  #define DEBUG_ECHOLNPAIR_F(...)   NOOP
  #define DEBUG_ECHOLNPAIR_F_P(...) NOOP
  #define DEBUG_ECHO_MSG(...)       NOOP
  #define DEBUG_ERROR_MSG(...)      NOOP
  #define DEBUG_EOL()               NOOP
  #define DEBUG_FLUSH()             NOOP
  #define DEBUG_POS(...)            NOOP
  #define DEBUG_XYZ(...)            NOOP
  #define DEBUG_DELAY(...)          NOOP
  #define DEBUG_SYNCHRONIZE()       NOOP

#endif

#undef DEBUG_OUT