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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 ENABLED(BABYSTEPPING)
  24. #include "../gcode.h"
  25. #include "../../feature/babystep.h"
  26. #include "../../module/probe.h"
  27. #include "../../module/temperature.h"
  28. #include "../../module/planner.h"
  29. #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
  30. #include "../../core/serial.h"
  31. #endif
  32. #if ENABLED(MESH_BED_LEVELING)
  33. #include "../../feature/bedlevel/bedlevel.h"
  34. #endif
  35. #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
  36. FORCE_INLINE void mod_probe_offset(const float &offs) {
  37. if (true
  38. #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
  39. && active_extruder == 0
  40. #endif
  41. ) {
  42. probe.offset.z += offs;
  43. SERIAL_ECHO_START();
  44. SERIAL_ECHOLNPAIR(STR_PROBE_OFFSET STR_Z ": ", probe.offset.z);
  45. }
  46. else {
  47. #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
  48. hotend_offset[active_extruder].z -= offs;
  49. SERIAL_ECHO_START();
  50. SERIAL_ECHOLNPAIR(STR_PROBE_OFFSET STR_Z ": ", hotend_offset[active_extruder].z);
  51. #endif
  52. }
  53. }
  54. #endif
  55. /**
  56. * M290: Babystepping
  57. *
  58. * Send 'R' or no parameters for a report.
  59. *
  60. * X<linear> - Distance to step X
  61. * Y<linear> - Distance to step Y
  62. * Z<linear> - Distance to step Z
  63. * S<linear> - Distance to step Z (alias for Z)
  64. *
  65. * With BABYSTEP_ZPROBE_OFFSET:
  66. * P0 - Don't adjust the Z probe offset
  67. */
  68. void GcodeSuite::M290() {
  69. #if ENABLED(BABYSTEP_XY)
  70. for (uint8_t a = X_AXIS; a <= Z_AXIS; a++)
  71. if (parser.seenval(axis_codes[a]) || (a == Z_AXIS && parser.seenval('S'))) {
  72. const float offs = constrain(parser.value_axis_units((AxisEnum)a), -2, 2);
  73. babystep.add_mm((AxisEnum)a, offs);
  74. #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
  75. if (a == Z_AXIS && (!parser.seen('P') || parser.value_bool())) mod_probe_offset(offs);
  76. #endif
  77. }
  78. #else
  79. if (parser.seenval('Z') || parser.seenval('S')) {
  80. const float offs = constrain(parser.value_axis_units(Z_AXIS), -2, 2);
  81. babystep.add_mm(Z_AXIS, offs);
  82. #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
  83. if (!parser.seen('P') || parser.value_bool()) mod_probe_offset(offs);
  84. #endif
  85. }
  86. #endif
  87. if (!parser.seen("XYZ") || parser.seen('R')) {
  88. SERIAL_ECHO_START();
  89. #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
  90. SERIAL_ECHOLNPAIR(STR_PROBE_OFFSET " " STR_Z, probe.offset.z);
  91. #endif
  92. #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
  93. {
  94. SERIAL_ECHOLNPAIR_P(
  95. PSTR("Hotend "), int(active_extruder)
  96. #if ENABLED(BABYSTEP_XY)
  97. , PSTR("Offset X"), hotend_offset[active_extruder].x
  98. , SP_Y_STR, hotend_offset[active_extruder].y
  99. , SP_Z_STR
  100. #else
  101. , PSTR("Offset Z")
  102. #endif
  103. , hotend_offset[active_extruder].z
  104. );
  105. }
  106. #endif
  107. #if ENABLED(MESH_BED_LEVELING)
  108. SERIAL_ECHOLNPAIR("MBL Adjust Z", mbl.z_offset);
  109. #endif
  110. #if ENABLED(BABYSTEP_DISPLAY_TOTAL)
  111. {
  112. SERIAL_ECHOLNPAIR_P(
  113. #if ENABLED(BABYSTEP_XY)
  114. PSTR("Babystep X"), babystep.axis_total[X_AXIS]
  115. , SP_Y_STR, babystep.axis_total[Y_AXIS]
  116. , SP_Z_STR
  117. #else
  118. PSTR("Babystep Z")
  119. #endif
  120. , babystep.axis_total[BS_AXIS_IND(Z_AXIS)]
  121. );
  122. }
  123. #endif
  124. }
  125. }
  126. #endif // BABYSTEPPING