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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 "../../inc/MarlinConfig.h"
  23. #if ENABLED(DELTA) || HAS_EXTRA_ENDSTOPS
  24. #include "../gcode.h"
  25. #if ENABLED(DELTA)
  26. #include "../../module/delta.h"
  27. #include "../../module/motion.h"
  28. #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
  29. #include "../../core/debug_out.h"
  30. /**
  31. * M666: Set delta endstop adjustment
  32. */
  33. void GcodeSuite::M666() {
  34. DEBUG_SECTION(log_M666, "M666", DEBUGGING(LEVELING));
  35. LOOP_XYZ(i) {
  36. if (parser.seen(XYZ_CHAR(i))) {
  37. const float v = parser.value_linear_units();
  38. if (v * Z_HOME_DIR <= 0) delta_endstop_adj[i] = v;
  39. if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("delta_endstop_adj[", XYZ_CHAR(i), "] = ", delta_endstop_adj[i]);
  40. }
  41. }
  42. }
  43. #elif HAS_EXTRA_ENDSTOPS
  44. #include "../../module/endstops.h"
  45. /**
  46. * M666: Set Dual Endstops offsets for X, Y, and/or Z.
  47. * With no parameters report current offsets.
  48. *
  49. * For Triple / Quad Z Endstops:
  50. * Set Z2 Only: M666 S2 Z<offset>
  51. * Set Z3 Only: M666 S3 Z<offset>
  52. * Set Z4 Only: M666 S4 Z<offset>
  53. * Set All: M666 Z<offset>
  54. */
  55. void GcodeSuite::M666() {
  56. #if ENABLED(X_DUAL_ENDSTOPS)
  57. if (parser.seenval('X')) endstops.x2_endstop_adj = parser.value_linear_units();
  58. #endif
  59. #if ENABLED(Y_DUAL_ENDSTOPS)
  60. if (parser.seenval('Y')) endstops.y2_endstop_adj = parser.value_linear_units();
  61. #endif
  62. #if ENABLED(Z_MULTI_ENDSTOPS)
  63. if (parser.seenval('Z')) {
  64. #if NUM_Z_STEPPER_DRIVERS >= 3
  65. const float z_adj = parser.value_linear_units();
  66. const int ind = parser.intval('S');
  67. if (!ind || ind == 2) endstops.z2_endstop_adj = z_adj;
  68. if (!ind || ind == 3) endstops.z3_endstop_adj = z_adj;
  69. #if NUM_Z_STEPPER_DRIVERS >= 4
  70. if (!ind || ind == 4) endstops.z4_endstop_adj = z_adj;
  71. #endif
  72. #else
  73. endstops.z2_endstop_adj = parser.value_linear_units();
  74. #endif
  75. }
  76. #endif
  77. if (!parser.seen("XYZ")) {
  78. SERIAL_ECHOPGM("Dual Endstop Adjustment (mm): ");
  79. #if ENABLED(X_DUAL_ENDSTOPS)
  80. SERIAL_ECHOPAIR(" X2:", endstops.x2_endstop_adj);
  81. #endif
  82. #if ENABLED(Y_DUAL_ENDSTOPS)
  83. SERIAL_ECHOPAIR(" Y2:", endstops.y2_endstop_adj);
  84. #endif
  85. #if ENABLED(Z_MULTI_ENDSTOPS)
  86. #define _ECHO_ZADJ(N) SERIAL_ECHOPAIR(" Z" STRINGIFY(N) ":", endstops.z##N##_endstop_adj);
  87. REPEAT_S(2, INCREMENT(NUM_Z_STEPPER_DRIVERS), _ECHO_ZADJ)
  88. #endif
  89. SERIAL_EOL();
  90. }
  91. }
  92. #endif // HAS_EXTRA_ENDSTOPS
  93. #endif // DELTA || HAS_EXTRA_ENDSTOPS