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.

G12.cpp 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2019 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 "../../../inc/MarlinConfig.h"
  23. #if ENABLED(NOZZLE_CLEAN_FEATURE)
  24. #include "../../../libs/nozzle.h"
  25. #include "../../gcode.h"
  26. #include "../../parser.h"
  27. #include "../../../module/motion.h"
  28. #if HAS_LEVELING
  29. #include "../../../module/planner.h"
  30. #include "../../../feature/bedlevel/bedlevel.h"
  31. #endif
  32. /**
  33. * G12: Clean the nozzle
  34. */
  35. void GcodeSuite::G12() {
  36. // Don't allow nozzle cleaning without homing first
  37. if (axis_unhomed_error()) return;
  38. const uint8_t pattern = parser.ushortval('P', 0),
  39. strokes = parser.ushortval('S', NOZZLE_CLEAN_STROKES),
  40. objects = parser.ushortval('T', NOZZLE_CLEAN_TRIANGLES);
  41. const float radius = parser.floatval('R', NOZZLE_CLEAN_CIRCLE_RADIUS);
  42. const bool seenxyz = parser.seen("XYZ");
  43. const uint8_t cleans = (!seenxyz || parser.boolval('X') ? _BV(X_AXIS) : 0)
  44. | (!seenxyz || parser.boolval('Y') ? _BV(Y_AXIS) : 0)
  45. #if DISABLED(NOZZLE_CLEAN_NO_Z)
  46. | (!seenxyz || parser.boolval('Z') ? _BV(Z_AXIS) : 0)
  47. #endif
  48. ;
  49. #if HAS_LEVELING
  50. // Disable bed leveling if cleaning Z
  51. TEMPORARY_BED_LEVELING_STATE(!TEST(cleans, Z_AXIS) && planner.leveling_active);
  52. #endif
  53. nozzle.clean(pattern, strokes, radius, objects, cleans);
  54. }
  55. #endif // NOZZLE_CLEAN_FEATURE