Prusa3d Marlin fork
mmu2_log.h
1 #pragma once
2 #ifdef __AVR__
3  #include <avr/pgmspace.h>
4 #endif
5 
6 // Beware - before changing this prefix, think twice
7 // you'd need to change appmain.cpp app_marlin_serial_output_write_hook
8 // and MMU2::ReportError + MMU2::ReportProgress
9 static constexpr char mmu2Magic[] PROGMEM = "MMU2:";
10 
11 namespace MMU2 {
12 
17 void LogErrorEvent_P(const char *msg_P);
18 
23 void LogEchoEvent_P(const char *msg_P);
24 
25 } // namespace MMU2
26 
27 #ifndef UNITTEST
28  #ifdef __AVR__
29  #include "Marlin.h"
30  #else
31  #include "../../core/serial.h"
32  #endif
33  #define SERIAL_MMU2() \
34  { serialprintPGM(mmu2Magic); }
35 
36  #define MMU2_ECHO_MSGLN(S) \
37  do { \
38  SERIAL_ECHO_START; \
39  SERIAL_MMU2(); \
40  SERIAL_ECHOLN(S); \
41  } while (0)
42  #define MMU2_ERROR_MSGLN(S) MMU2_ECHO_MSGLN(S)
43  #define MMU2_ECHO_MSGRPGM(S) \
44  do { \
45  SERIAL_ECHO_START; \
46  SERIAL_MMU2(); \
47  SERIAL_ECHORPGM(S); \
48  } while (0)
49  #define MMU2_ERROR_MSGRPGM(S) MMU2_ECHO_MSGRPGM(S)
50  #define MMU2_ECHO_MSG(S) \
51  do { \
52  SERIAL_ECHO_START; \
53  SERIAL_MMU2(); \
54  SERIAL_ECHO(S); \
55  } while (0)
56  #define MMU2_ERROR_MSG(S) MMU2_ECHO_MSG(S)
57 
58 #else // #ifndef UNITTEST
59  #include "stubs/stub_interfaces.h"
60  #define MMU2_ECHO_MSGLN(S) marlinLogSim.AppendLine(S)
61  #define MMU2_ERROR_MSGLN(S) marlinLogSim.AppendLine(S)
62  #define MMU2_ECHO_MSGRPGM(S) /*marlinLogSim.AppendLine(S)*/
63  #define MMU2_ERROR_MSGRPGM(S) /*marlinLogSim.AppendLine(S)*/
64  #define SERIAL_ECHOLNPGM(S) /*marlinLogSim.AppendLine(S)*/
65  #define SERIAL_ECHOPGM(S) /* */
66  #define SERIAL_ECHOLN(S) /*marlinLogSim.AppendLine(S)*/
67 
68 #endif // #ifndef UNITTEST
New MMU2 protocol logic.
Definition: mmu2.cpp:26
void LogErrorEvent_P(const char *msg)
Definition: mmu2_log.cpp:5
void LogEchoEvent_P(const char *msg)
Definition: mmu2_log.cpp:11