mmu2_log.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #ifndef UNITTEST
  3. #include "Marlin.h"
  4. // Beware - before changing this prefix, think twice
  5. // you'd need to change appmain.cpp app_marlin_serial_output_write_hook
  6. // and MMU2::ReportError + MMU2::ReportProgress
  7. static constexpr char mmu2Magic[] PROGMEM = "MMU2:";
  8. namespace MMU2 {
  9. /// Report the msg into the general logging subsystem (through Marlin's SERIAL_ECHO stuff)
  10. /// @param msg pointer to a string in PROGMEM
  11. void LogErrorEvent_P(const char *msg);
  12. /// Report the msg into the general logging subsystem (through Marlin's SERIAL_ECHO stuff)
  13. /// @param msg pointer to a string in PROGMEM
  14. void LogEchoEvent_P(const char *msg);
  15. } // namespace
  16. #define SERIAL_MMU2() { serialprintPGM(mmu2Magic); }
  17. #define MMU2_ECHO_MSGLN(S) do{ SERIAL_ECHO_START; SERIAL_MMU2(); SERIAL_ECHOLN(S); }while(0)
  18. #define MMU2_ERROR_MSGLN(S) MMU2_ECHO_MSGLN(S) //!@todo Decide MMU2 errors on serial line
  19. #define MMU2_ECHO_MSGRPGM(S) do{ SERIAL_ECHO_START; SERIAL_MMU2(); SERIAL_ECHORPGM(S); }while(0)
  20. #define MMU2_ERROR_MSGRPGM(S) MMU2_ECHO_MSGRPGM(S) //!@todo Decide MMU2 errors on serial line
  21. #else // #ifndef UNITTEST
  22. #define MMU2_ECHO_MSGLN(S) /* */
  23. #define MMU2_ERROR_MSGLN(S) /* */
  24. #define MMU2_ECHO_MSGRPGM(S) /* */
  25. #define MMU2_ERROR_MSGRPGM(S) /* */
  26. #endif // #ifndef UNITTEST