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.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 <http://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 const char str_debug_1[] PROGMEM = STR_DEBUG_ECHO,
  29. str_debug_2[] PROGMEM = STR_DEBUG_INFO,
  30. str_debug_4[] PROGMEM = STR_DEBUG_ERRORS,
  31. str_debug_8[] PROGMEM = STR_DEBUG_DRYRUN,
  32. str_debug_16[] PROGMEM = STR_DEBUG_COMMUNICATION
  33. #if ENABLED(DEBUG_LEVELING_FEATURE)
  34. , str_debug_lvl[] PROGMEM = STR_DEBUG_LEVELING
  35. #endif
  36. ;
  37. static PGM_P const debug_strings[] PROGMEM = {
  38. str_debug_1, str_debug_2, str_debug_4, str_debug_8, str_debug_16
  39. #if ENABLED(DEBUG_LEVELING_FEATURE)
  40. , str_debug_lvl
  41. #endif
  42. };
  43. SERIAL_ECHO_START();
  44. SERIAL_ECHOPGM(STR_DEBUG_PREFIX);
  45. if (marlin_debug_flags) {
  46. uint8_t comma = 0;
  47. LOOP_L_N(i, COUNT(debug_strings)) {
  48. if (TEST(marlin_debug_flags, i)) {
  49. if (comma++) SERIAL_CHAR(',');
  50. serialprintPGM((char*)pgm_read_ptr(&debug_strings[i]));
  51. }
  52. }
  53. }
  54. else {
  55. SERIAL_ECHOPGM(STR_DEBUG_OFF);
  56. #if !defined(__AVR__) || !defined(USBCON)
  57. #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
  58. SERIAL_ECHOPAIR("\nBuffer Overruns: ", MYSERIAL0.buffer_overruns());
  59. #endif
  60. #if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS)
  61. SERIAL_ECHOPAIR("\nFraming Errors: ", MYSERIAL0.framing_errors());
  62. #endif
  63. #if ENABLED(SERIAL_STATS_DROPPED_RX)
  64. SERIAL_ECHOPAIR("\nDropped bytes: ", MYSERIAL0.dropped());
  65. #endif
  66. #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
  67. SERIAL_ECHOPAIR("\nMax RX Queue Size: ", MYSERIAL0.rxMaxEnqueued());
  68. #endif
  69. #endif // !defined(__AVR__) || !defined(USBCON)
  70. }
  71. SERIAL_EOL();
  72. }