My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

M665.cpp 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 IS_KINEMATIC
  24. #include "../gcode.h"
  25. #include "../../module/motion.h"
  26. #if ENABLED(DELTA)
  27. #include "../../module/delta.h"
  28. /**
  29. * M665: Set delta configurations
  30. *
  31. * H = delta height
  32. * L = diagonal rod
  33. * R = delta radius
  34. * S = segments per second
  35. * B = delta calibration radius
  36. * X = Alpha (Tower 1) angle trim
  37. * Y = Beta (Tower 2) angle trim
  38. * Z = Gamma (Tower 3) angle trim
  39. */
  40. void GcodeSuite::M665() {
  41. if (parser.seen('H')) delta_height = parser.value_linear_units();
  42. if (parser.seen('L')) delta_diagonal_rod = parser.value_linear_units();
  43. if (parser.seen('R')) delta_radius = parser.value_linear_units();
  44. if (parser.seen('S')) delta_segments_per_second = parser.value_float();
  45. if (parser.seen('B')) delta_calibration_radius = parser.value_float();
  46. if (parser.seen('X')) delta_tower_angle_trim[A_AXIS] = parser.value_float();
  47. if (parser.seen('Y')) delta_tower_angle_trim[B_AXIS] = parser.value_float();
  48. if (parser.seen('Z')) delta_tower_angle_trim[C_AXIS] = parser.value_float();
  49. recalc_delta_settings();
  50. }
  51. #elif IS_SCARA
  52. #include "../../module/scara.h"
  53. /**
  54. * M665: Set SCARA settings
  55. *
  56. * Parameters:
  57. *
  58. * S[segments-per-second] - Segments-per-second
  59. * P[theta-psi-offset] - Theta-Psi offset, added to the shoulder (A/X) angle
  60. * T[theta-offset] - Theta offset, added to the elbow (B/Y) angle
  61. * Z[z-offset] - Z offset, added to Z
  62. *
  63. * A, P, and X are all aliases for the shoulder angle
  64. * B, T, and Y are all aliases for the elbow angle
  65. */
  66. void GcodeSuite::M665() {
  67. if (parser.seenval('S')) delta_segments_per_second = parser.value_float();
  68. #if HAS_SCARA_OFFSET
  69. if (parser.seenval('Z')) scara_home_offset[Z_AXIS] = parser.value_linear_units();
  70. const bool hasA = parser.seenval('A'), hasP = parser.seenval('P'), hasX = parser.seenval('X');
  71. const uint8_t sumAPX = hasA + hasP + hasX;
  72. if (sumAPX) {
  73. if (sumAPX == 1)
  74. scara_home_offset[A_AXIS] = parser.value_float();
  75. else {
  76. SERIAL_ERROR_MSG("Only one of A, P, or X is allowed.");
  77. return;
  78. }
  79. }
  80. const bool hasB = parser.seenval('B'), hasT = parser.seenval('T'), hasY = parser.seenval('Y');
  81. const uint8_t sumBTY = hasB + hasT + hasY;
  82. if (sumBTY) {
  83. if (sumBTY == 1)
  84. scara_home_offset[B_AXIS] = parser.value_float();
  85. else {
  86. SERIAL_ERROR_MSG("Only one of B, T, or Y is allowed.");
  87. return;
  88. }
  89. }
  90. #endif // HAS_SCARA_OFFSET
  91. }
  92. #endif
  93. #endif // IS_KINEMATIC