Prusa MINI Firmware overview
|
Go to the documentation of this file.
24 #include "../inc/MarlinConfig.h"
36 #if ENABLED(DEBUG_LEVELING_FEATURE)
47 #define DEBUGGING(F) (marlin_debug_flags & (MARLIN_DEBUG_## F))
49 #define SERIAL_BOTH 0x7F
51 extern int8_t serial_port_index;
52 #define _PORT_REDIRECT(n,p) REMEMBER(n,serial_port_index,p)
53 #define _PORT_RESTORE(n) RESTORE(n)
54 #define SERIAL_OUT(WHAT, V...) do{ \
55 if (!serial_port_index || serial_port_index == SERIAL_BOTH) (void)MYSERIAL0.WHAT(V); \
56 if ( serial_port_index) (void)MYSERIAL1.WHAT(V); \
58 #define SERIAL_ASSERT(P) if(serial_port_index!=(P)){ debugger(); }
60 #define _PORT_REDIRECT(n,p) NOOP
61 #define _PORT_RESTORE(n) NOOP
62 #define SERIAL_OUT(WHAT, V...) (void)MYSERIAL0.WHAT(V)
63 #define SERIAL_ASSERT(P) NOOP
66 #define PORT_REDIRECT(p) _PORT_REDIRECT(1,p)
67 #define PORT_RESTORE() _PORT_RESTORE(1)
69 #define SERIAL_CHAR(x) SERIAL_OUT(write, x)
70 #define SERIAL_ECHO(x) SERIAL_OUT(print, x)
71 #define SERIAL_ECHO_F(V...) SERIAL_OUT(print, V)
72 #define SERIAL_ECHOLN(x) SERIAL_OUT(println, x)
73 #define SERIAL_PRINT(x,b) SERIAL_OUT(print, x, b)
74 #define SERIAL_PRINTLN(x,b) SERIAL_OUT(println, x, b)
75 #define SERIAL_PRINTF(V...) SERIAL_OUT(printf, V)
76 #define SERIAL_FLUSH() SERIAL_OUT(flush)
79 #define SERIAL_FLUSHTX() SERIAL_OUT(flush)
80 #elif TX_BUFFER_SIZE > 0
81 #define SERIAL_FLUSHTX() SERIAL_OUT(flushTX)
83 #define SERIAL_FLUSHTX()
87 #define __SEP_N(N,V...) _SEP_##N(V)
88 #define _SEP_N(N,V...) __SEP_N(N,V)
89 #define _SEP_1(PRE) SERIAL_ECHOPGM(PRE)
90 #define _SEP_2(PRE,V) serial_echopair_PGM(PSTR(PRE),V)
91 #define _SEP_3(a,b,c) do{ _SEP_2(a,b); SERIAL_ECHOPGM(c); }while(0)
92 #define _SEP_4(a,b,V...) do{ _SEP_2(a,b); _SEP_2(V); }while(0)
93 #define _SEP_5(a,b,V...) do{ _SEP_2(a,b); _SEP_3(V); }while(0)
94 #define _SEP_6(a,b,V...) do{ _SEP_2(a,b); _SEP_4(V); }while(0)
95 #define _SEP_7(a,b,V...) do{ _SEP_2(a,b); _SEP_5(V); }while(0)
96 #define _SEP_8(a,b,V...) do{ _SEP_2(a,b); _SEP_6(V); }while(0)
97 #define _SEP_9(a,b,V...) do{ _SEP_2(a,b); _SEP_7(V); }while(0)
98 #define _SEP_10(a,b,V...) do{ _SEP_2(a,b); _SEP_8(V); }while(0)
99 #define _SEP_11(a,b,V...) do{ _SEP_2(a,b); _SEP_9(V); }while(0)
100 #define _SEP_12(a,b,V...) do{ _SEP_2(a,b); _SEP_10(V); }while(0)
101 #define _SEP_13(a,b,V...) do{ _SEP_2(a,b); _SEP_11(V); }while(0)
102 #define _SEP_14(a,b,V...) do{ _SEP_2(a,b); _SEP_12(V); }while(0)
103 #define _SEP_15(a,b,V...) do{ _SEP_2(a,b); _SEP_13(V); }while(0)
104 #define _SEP_16(a,b,V...) do{ _SEP_2(a,b); _SEP_14(V); }while(0)
105 #define _SEP_17(a,b,V...) do{ _SEP_2(a,b); _SEP_15(V); }while(0)
106 #define _SEP_18(a,b,V...) do{ _SEP_2(a,b); _SEP_16(V); }while(0)
107 #define _SEP_19(a,b,V...) do{ _SEP_2(a,b); _SEP_17(V); }while(0)
108 #define _SEP_20(a,b,V...) do{ _SEP_2(a,b); _SEP_18(V); }while(0)
109 #define _SEP_21(a,b,V...) do{ _SEP_2(a,b); _SEP_19(V); }while(0)
110 #define _SEP_22(a,b,V...) do{ _SEP_2(a,b); _SEP_20(V); }while(0)
111 #define _SEP_23(a,b,V...) do{ _SEP_2(a,b); _SEP_21(V); }while(0)
112 #define _SEP_24(a,b,V...) do{ _SEP_2(a,b); _SEP_22(V); }while(0)
114 #define SERIAL_ECHOPAIR(V...) _SEP_N(NUM_ARGS(V),V)
117 #define __SELP_N(N,V...) _SELP_##N(V)
118 #define _SELP_N(N,V...) __SELP_N(N,V)
119 #define _SELP_1(PRE) SERIAL_ECHOLNPGM(PRE)
120 #define _SELP_2(PRE,V) do{ serial_echopair_PGM(PSTR(PRE),V); SERIAL_EOL(); }while(0)
121 #define _SELP_3(a,b,c) do{ _SEP_2(a,b); SERIAL_ECHOLNPGM(c); }while(0)
122 #define _SELP_4(a,b,V...) do{ _SEP_2(a,b); _SELP_2(V); }while(0)
123 #define _SELP_5(a,b,V...) do{ _SEP_2(a,b); _SELP_3(V); }while(0)
124 #define _SELP_6(a,b,V...) do{ _SEP_2(a,b); _SELP_4(V); }while(0)
125 #define _SELP_7(a,b,V...) do{ _SEP_2(a,b); _SELP_5(V); }while(0)
126 #define _SELP_8(a,b,V...) do{ _SEP_2(a,b); _SELP_6(V); }while(0)
127 #define _SELP_9(a,b,V...) do{ _SEP_2(a,b); _SELP_7(V); }while(0)
128 #define _SELP_10(a,b,V...) do{ _SEP_2(a,b); _SELP_8(V); }while(0)
129 #define _SELP_11(a,b,V...) do{ _SEP_2(a,b); _SELP_9(V); }while(0)
130 #define _SELP_12(a,b,V...) do{ _SEP_2(a,b); _SELP_10(V); }while(0)
131 #define _SELP_13(a,b,V...) do{ _SEP_2(a,b); _SELP_11(V); }while(0)
132 #define _SELP_14(a,b,V...) do{ _SEP_2(a,b); _SELP_12(V); }while(0)
133 #define _SELP_15(a,b,V...) do{ _SEP_2(a,b); _SELP_13(V); }while(0)
134 #define _SELP_16(a,b,V...) do{ _SEP_2(a,b); _SELP_14(V); }while(0)
135 #define _SELP_17(a,b,V...) do{ _SEP_2(a,b); _SELP_15(V); }while(0)
136 #define _SELP_18(a,b,V...) do{ _SEP_2(a,b); _SELP_16(V); }while(0)
137 #define _SELP_19(a,b,V...) do{ _SEP_2(a,b); _SELP_17(V); }while(0)
138 #define _SELP_20(a,b,V...) do{ _SEP_2(a,b); _SELP_18(V); }while(0)
139 #define _SELP_21(a,b,V...) do{ _SEP_2(a,b); _SELP_19(V); }while(0)
140 #define _SELP_22(a,b,V...) do{ _SEP_2(a,b); _SELP_20(V); }while(0)
141 #define _SELP_23(a,b,V...) do{ _SEP_2(a,b); _SELP_21(V); }while(0)
142 #define _SELP_24(a,b,V...) do{ _SEP_2(a,b); _SELP_22(V); }while(0) // Use up two, pass the rest up
144 #define SERIAL_ECHOLNPAIR(V...) _SELP_N(NUM_ARGS(V),V)
147 #define __SLST_N(N,V...) _SLST_##N(V)
148 #define _SLST_N(N,V...) __SLST_N(N,V)
149 #define _SLST_1(a) SERIAL_ECHO(a)
150 #define _SLST_2(a,b) do{ SERIAL_ECHO(a); SERIAL_ECHOPAIR(", ",b); }while(0)
151 #define _SLST_3(a,b,c) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_1(c); }while(0)
152 #define _SLST_4(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_2(V); }while(0)
153 #define _SLST_5(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_3(V); }while(0)
154 #define _SLST_6(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_4(V); }while(0)
155 #define _SLST_7(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_5(V); }while(0)
156 #define _SLST_8(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_6(V); }while(0)
157 #define _SLST_9(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_7(V); }while(0)
158 #define _SLST_10(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_8(V); }while(0)
159 #define _SLST_11(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_9(V); }while(0)
160 #define _SLST_12(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_10(V); }while(0)
161 #define _SLST_13(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_11(V); }while(0)
162 #define _SLST_14(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_12(V); }while(0)
163 #define _SLST_15(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_13(V); }while(0)
164 #define _SLST_16(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_14(V); }while(0)
165 #define _SLST_17(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_15(V); }while(0)
166 #define _SLST_18(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_16(V); }while(0)
167 #define _SLST_19(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_17(V); }while(0)
168 #define _SLST_20(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_18(V); }while(0) // Use up two, pass the rest up
170 #define SERIAL_ECHOLIST(pre,V...) do{ SERIAL_ECHOPGM(pre); _SLST_N(NUM_ARGS(V),V); }while(0)
171 #define SERIAL_ECHOLIST_N(N,V...) _SLST_N(N,LIST_N(N,V))
173 #define SERIAL_ECHOPGM(S) (serialprintPGM(PSTR(S)))
174 #define SERIAL_ECHOLNPGM(S) (serialprintPGM(PSTR(S "\n")))
176 #define SERIAL_ECHOPAIR_F(S,V...) do{ SERIAL_ECHOPGM(S); SERIAL_ECHO_F(V); }while(0)
177 #define SERIAL_ECHOLNPAIR_F(V...) do{ SERIAL_ECHOPAIR_F(V); SERIAL_EOL(); }while(0)
179 #define SERIAL_ECHO_START() serial_echo_start()
180 #define SERIAL_ERROR_START() serial_error_start()
181 #define SERIAL_EOL() SERIAL_CHAR('\n')
183 #define SERIAL_ECHO_MSG(S) do{ SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(S); }while(0)
184 #define SERIAL_ERROR_MSG(S) do{ SERIAL_ERROR_START(); SERIAL_ECHOLNPGM(S); }while(0)
186 #define SERIAL_ECHO_SP(C) serial_spaces(C)
188 #define SERIAL_ECHO_TERNARY(TF, PRE, ON, OFF, POST) serial_ternary(TF, PSTR(PRE), PSTR(ON), PSTR(OFF), PSTR(POST))
216 void print_xyz(
const float &x,
const float &y,
const float &z,
PGM_P const prefix=
nullptr,
PGM_P const suffix=
nullptr);
222 #define SERIAL_POS(SUFFIX,VAR) do { print_xyz(VAR, PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n")); }while(0)
223 #define SERIAL_XYZ(PREFIX,V...) do { print_xyz(V, PSTR(PREFIX), nullptr); }while(0)
T z
Definition: types.h:286
#define SERIAL_CHAR(x)
Definition: serial.h:69
void serial_echo_start()
Definition: serial.cpp:38
void serialprint_onoff(const bool onoff)
Definition: serial.cpp:57
void serial_echopair_PGM(PGM_P const s_P, const char *v)
Definition: serial.cpp:41
#define SERIAL_ECHO(x)
Definition: serial.h:70
uint8_t marlin_debug_flags
Definition: serial.cpp:26
void print_xyz(const float &x, const float &y, const float &z, PGM_P const prefix, PGM_P const suffix)
Definition: serial.cpp:70
MarlinDebugFlags
Definition: serial.h:29
T x
Definition: types.h:286
#define MSG_X
Definition: language.h:319
void serial_echo_start()
Definition: serial.cpp:38
void serialprintln_onoff(const bool onoff)
Definition: serial.cpp:58
#define SERIAL_ECHOPAIR(V...)
Definition: serial.h:114
#define PGM_P
Definition: pgmspace.h:30
#define SERIAL_PORT
Definition: Configuration_A3ides_2209_MINI.h:105
uint8_t i
Definition: screen_test_graph.c:72
Not implemented.
Definition: serial.h:35
void serial_error_start()
Definition: serial.cpp:39
#define pgm_read_byte(addr)
Definition: pgmspace.h:95
#define PSTR(str)
Definition: pgmspace.h:31
Print messages for code that has debug output.
Definition: serial.h:32
void serialprintln_onoff(const bool onoff)
Definition: serial.cpp:58
#define MSG_Y
Definition: language.h:320
Ignore temperature setting and E movement commands.
Definition: serial.h:34
void print_bin(const uint16_t val)
Definition: serial.cpp:61
#define MSG_Z
Definition: language.h:321
#define MSG_ON
Definition: language.h:213
uint8_t marlin_debug_flags
Definition: serial.cpp:26
void serialprint_truefalse(const bool tf)
Definition: serial.cpp:59
const uint8_t[]
Definition: 404_html.c:3
Not implemented.
Definition: serial.h:33
void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post)
Definition: serial.cpp:52
#define _BV(bit)
Definition: wiring_constants.h:99
#define PROPORTIONAL_FONT_RATIO
Definition: Configuration_A3ides_2209_MINI_adv.h:2044
T y
Definition: types.h:286
void print_bin(const uint16_t val)
Definition: serial.cpp:61
void serial_spaces(uint8_t count)
Definition: serial.cpp:50
Echo commands in order as they are processed.
Definition: serial.h:31
void print_xyz(const float &x, const float &y, const float &z, PGM_P const prefix=nullptr, PGM_P const suffix=nullptr)
Definition: serial.cpp:70
void serialprintPGM(PGM_P str)
Definition: serial.cpp:35
void serial_error_start()
Definition: serial.cpp:39
#define SERIAL_EOL()
Definition: serial.h:181
void serialprint_onoff(const bool onoff)
Definition: serial.cpp:57
#define MSG_OFF
Definition: language.h:214
void serialprint_truefalse(const bool tf)
Definition: serial.cpp:59
void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post=nullptr)
Definition: serial.cpp:52
void serialprintPGM(PGM_P str)
Definition: serial.cpp:35
void serial_spaces(uint8_t count)
Definition: serial.cpp:50
static const char errormagic[] PROGMEM
Definition: serial.cpp:28
void serial_echopair_PGM(PGM_P const s_P, const char *v)
Definition: serial.cpp:41