My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

M666.cpp 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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(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. if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> M666");
  35. LOOP_XYZ(i) {
  36. if (parser.seen(axis_codes[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[", axis_codes[i], "] = ", delta_endstop_adj[i]);
  40. }
  41. }
  42. if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< M666");
  43. }
  44. #elif HAS_EXTRA_ENDSTOPS
  45. #include "../../module/endstops.h"
  46. /**
  47. * M666: Set Dual Endstops offsets for X, Y, and/or Z.
  48. * With no parameters report current offsets.
  49. *
  50. * For Triple / Quad Z Endstops:
  51. * Set Z2 Only: M666 S2 Z<offset>
  52. * Set Z3 Only: M666 S3 Z<offset>
  53. * Set Z4 Only: M666 S4 Z<offset>
  54. * Set All: M666 Z<offset>
  55. */
  56. void GcodeSuite::M666() {
  57. #if ENABLED(X_DUAL_ENDSTOPS)
  58. if (parser.seenval('X')) endstops.x2_endstop_adj = parser.value_linear_units();
  59. #endif
  60. #if ENABLED(Y_DUAL_ENDSTOPS)
  61. if (parser.seenval('Y')) endstops.y2_endstop_adj = parser.value_linear_units();
  62. #endif
  63. #if ENABLED(Z_MULTI_ENDSTOPS)
  64. if (parser.seenval('Z')) {
  65. #if NUM_Z_STEPPER_DRIVERS >= 3
  66. const float z_adj = parser.value_linear_units();
  67. const int ind = parser.intval('S');
  68. if (!ind || ind == 2) endstops.z2_endstop_adj = z_adj;
  69. if (!ind || ind == 3) endstops.z3_endstop_adj = z_adj;
  70. #if NUM_Z_STEPPER_DRIVERS >= 4
  71. if (!ind || ind == 4) endstops.z4_endstop_adj = z_adj;
  72. #endif
  73. #else
  74. endstops.z2_endstop_adj = parser.value_linear_units();
  75. #endif
  76. }
  77. #endif
  78. if (!parser.seen("XYZ")) {
  79. SERIAL_ECHOPGM("Dual Endstop Adjustment (mm): ");
  80. #if ENABLED(X_DUAL_ENDSTOPS)
  81. SERIAL_ECHOPAIR(" X2:", endstops.x2_endstop_adj);
  82. #endif
  83. #if ENABLED(Y_DUAL_ENDSTOPS)
  84. SERIAL_ECHOPAIR(" Y2:", endstops.y2_endstop_adj);
  85. #endif
  86. #if ENABLED(Z_MULTI_ENDSTOPS)
  87. SERIAL_ECHOPAIR(" Z2:", endstops.z2_endstop_adj);
  88. #if NUM_Z_STEPPER_DRIVERS >= 3
  89. SERIAL_ECHOPAIR(" Z3:", endstops.z3_endstop_adj);
  90. #if NUM_Z_STEPPER_DRIVERS >= 4
  91. SERIAL_ECHOPAIR(" Z4:", endstops.z4_endstop_adj);
  92. #endif
  93. #endif
  94. #endif
  95. SERIAL_EOL();
  96. }
  97. }
  98. #endif // HAS_EXTRA_ENDSTOPS
  99. #endif // DELTA || HAS_EXTRA_ENDSTOPS