My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

M111.cpp 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../gcode.h"
  23. /**
  24. * M111: Set the debug level
  25. */
  26. void GcodeSuite::M111() {
  27. if (parser.seen('S')) marlin_debug_flags = parser.byteval('S');
  28. static PGMSTR(str_debug_1, STR_DEBUG_ECHO);
  29. static PGMSTR(str_debug_2, STR_DEBUG_INFO);
  30. static PGMSTR(str_debug_4, STR_DEBUG_ERRORS);
  31. static PGMSTR(str_debug_8, STR_DEBUG_DRYRUN);
  32. static PGMSTR(str_debug_16, STR_DEBUG_COMMUNICATION);
  33. #if ENABLED(DEBUG_LEVELING_FEATURE)
  34. static PGMSTR(str_debug_lvl, STR_DEBUG_LEVELING);
  35. #endif
  36. static PGM_P const debug_strings[] PROGMEM = {
  37. str_debug_1, str_debug_2, str_debug_4, str_debug_8, str_debug_16,
  38. TERN_(DEBUG_LEVELING_FEATURE, str_debug_lvl)
  39. };
  40. SERIAL_ECHO_START();
  41. SERIAL_ECHOPGM(STR_DEBUG_PREFIX);
  42. if (marlin_debug_flags) {
  43. uint8_t comma = 0;
  44. LOOP_L_N(i, COUNT(debug_strings)) {
  45. if (TEST(marlin_debug_flags, i)) {
  46. if (comma++) SERIAL_CHAR(',');
  47. SERIAL_ECHOPGM_P((char*)pgm_read_ptr(&debug_strings[i]));
  48. }
  49. }
  50. }
  51. else {
  52. SERIAL_ECHOPGM(STR_DEBUG_OFF);
  53. #if !defined(__AVR__) || !defined(USBCON)
  54. #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
  55. SERIAL_ECHOPGM("\nBuffer Overruns: ", MYSERIAL1.buffer_overruns());
  56. #endif
  57. #if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS)
  58. SERIAL_ECHOPGM("\nFraming Errors: ", MYSERIAL1.framing_errors());
  59. #endif
  60. #if ENABLED(SERIAL_STATS_DROPPED_RX)
  61. SERIAL_ECHOPGM("\nDropped bytes: ", MYSERIAL1.dropped());
  62. #endif
  63. #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
  64. SERIAL_ECHOPGM("\nMax RX Queue Size: ", MYSERIAL1.rxMaxEnqueued());
  65. #endif
  66. #endif // !__AVR__ || !USBCON
  67. }
  68. SERIAL_EOL();
  69. }