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.

M218.cpp 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 "../../inc/MarlinConfig.h"
  23. #if HAS_HOTEND_OFFSET
  24. #include "../gcode.h"
  25. #include "../../module/motion.h"
  26. #if ENABLED(DELTA)
  27. #include "../../module/planner.h"
  28. #endif
  29. /**
  30. * M218 - set hotend offset (in linear units)
  31. *
  32. * T<tool>
  33. * X<xoffset>
  34. * Y<yoffset>
  35. * Z<zoffset>
  36. */
  37. void GcodeSuite::M218() {
  38. const int8_t target_extruder = get_target_extruder_from_command();
  39. if (target_extruder < 0) return;
  40. if (parser.seenval('X')) hotend_offset[target_extruder].x = parser.value_linear_units();
  41. if (parser.seenval('Y')) hotend_offset[target_extruder].y = parser.value_linear_units();
  42. if (parser.seenval('Z')) hotend_offset[target_extruder].z = parser.value_linear_units();
  43. if (!parser.seen("XYZ")) {
  44. SERIAL_ECHO_START();
  45. SERIAL_ECHOPGM(STR_HOTEND_OFFSET);
  46. HOTEND_LOOP() {
  47. SERIAL_CHAR(' ');
  48. SERIAL_ECHO(hotend_offset[e].x);
  49. SERIAL_CHAR(',');
  50. SERIAL_ECHO(hotend_offset[e].y);
  51. SERIAL_CHAR(',');
  52. SERIAL_ECHO_F(hotend_offset[e].z, 3);
  53. }
  54. SERIAL_EOL();
  55. }
  56. #if ENABLED(DELTA)
  57. if (target_extruder == active_extruder)
  58. do_blocking_move_to_xy(current_position, planner.settings.max_feedrate_mm_s[X_AXIS]);
  59. #endif
  60. }
  61. #endif // HAS_HOTEND_OFFSET