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.

utility.cpp 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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 "utility.h"
  23. #include "../Marlin.h"
  24. #include "../module/temperature.h"
  25. void safe_delay(millis_t ms) {
  26. while (ms > 50) {
  27. ms -= 50;
  28. delay(50);
  29. thermalManager.manage_heater();
  30. }
  31. delay(ms);
  32. thermalManager.manage_heater(); // This keeps us safe if too many small safe_delay() calls are made
  33. }
  34. #if ENABLED(DEBUG_LEVELING_FEATURE)
  35. #include "../module/probe.h"
  36. #include "../module/motion.h"
  37. #include "../module/stepper.h"
  38. #include "../module/stepper.h"
  39. #include "../libs/numtostr.h"
  40. #include "../feature/bedlevel/bedlevel.h"
  41. void log_machine_info() {
  42. SERIAL_ECHOLNPGM("Machine Type: "
  43. #if ENABLED(DELTA)
  44. "Delta"
  45. #elif IS_SCARA
  46. "SCARA"
  47. #elif IS_CORE
  48. "Core"
  49. #else
  50. "Cartesian"
  51. #endif
  52. );
  53. SERIAL_ECHOLNPGM("Probe: "
  54. #if ENABLED(PROBE_MANUALLY)
  55. "PROBE_MANUALLY"
  56. #elif ENABLED(FIX_MOUNTED_PROBE)
  57. "FIX_MOUNTED_PROBE"
  58. #elif ENABLED(BLTOUCH)
  59. "BLTOUCH"
  60. #elif HAS_Z_SERVO_PROBE
  61. "SERVO PROBE"
  62. #elif ENABLED(TOUCH_MI_PROBE)
  63. "TOUCH_MI_PROBE"
  64. #elif ENABLED(Z_PROBE_SLED)
  65. "Z_PROBE_SLED"
  66. #elif ENABLED(Z_PROBE_ALLEN_KEY)
  67. "Z_PROBE_ALLEN_KEY"
  68. #else
  69. "NONE"
  70. #endif
  71. );
  72. #if HAS_BED_PROBE
  73. SERIAL_ECHOPAIR(
  74. "Probe Offset X:" STRINGIFY(X_PROBE_OFFSET_FROM_EXTRUDER)
  75. " Y:" STRINGIFY(Y_PROBE_OFFSET_FROM_EXTRUDER)
  76. " Z:", zprobe_zoffset
  77. );
  78. if ((X_PROBE_OFFSET_FROM_EXTRUDER) > 0)
  79. SERIAL_ECHOPGM(" (Right");
  80. else if ((X_PROBE_OFFSET_FROM_EXTRUDER) < 0)
  81. SERIAL_ECHOPGM(" (Left");
  82. else if ((Y_PROBE_OFFSET_FROM_EXTRUDER) != 0)
  83. SERIAL_ECHOPGM(" (Middle");
  84. else
  85. SERIAL_ECHOPGM(" (Aligned With");
  86. if ((Y_PROBE_OFFSET_FROM_EXTRUDER) > 0) {
  87. #if IS_SCARA
  88. SERIAL_ECHOPGM("-Distal");
  89. #else
  90. SERIAL_ECHOPGM("-Back");
  91. #endif
  92. }
  93. else if ((Y_PROBE_OFFSET_FROM_EXTRUDER) < 0) {
  94. #if IS_SCARA
  95. SERIAL_ECHOPGM("-Proximal");
  96. #else
  97. SERIAL_ECHOPGM("-Front");
  98. #endif
  99. }
  100. else if ((X_PROBE_OFFSET_FROM_EXTRUDER) != 0)
  101. SERIAL_ECHOPGM("-Center");
  102. if (zprobe_zoffset < 0)
  103. SERIAL_ECHOPGM(" & Below");
  104. else if (zprobe_zoffset > 0)
  105. SERIAL_ECHOPGM(" & Above");
  106. else
  107. SERIAL_ECHOPGM(" & Same Z as");
  108. SERIAL_ECHOLNPGM(" Nozzle)");
  109. #endif
  110. #if HAS_ABL_OR_UBL
  111. SERIAL_ECHOLNPGM("Auto Bed Leveling: "
  112. #if ENABLED(AUTO_BED_LEVELING_LINEAR)
  113. "LINEAR"
  114. #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
  115. "BILINEAR"
  116. #elif ENABLED(AUTO_BED_LEVELING_3POINT)
  117. "3POINT"
  118. #elif ENABLED(AUTO_BED_LEVELING_UBL)
  119. "UBL"
  120. #endif
  121. );
  122. if (planner.leveling_active) {
  123. SERIAL_ECHOLNPGM(" (enabled)");
  124. #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
  125. if (planner.z_fade_height)
  126. SERIAL_ECHOLNPAIR("Z Fade: ", planner.z_fade_height);
  127. #endif
  128. #if ABL_PLANAR
  129. const float diff[XYZ] = {
  130. planner.get_axis_position_mm(X_AXIS) - current_position[X_AXIS],
  131. planner.get_axis_position_mm(Y_AXIS) - current_position[Y_AXIS],
  132. planner.get_axis_position_mm(Z_AXIS) - current_position[Z_AXIS]
  133. };
  134. SERIAL_ECHOPGM("ABL Adjustment X");
  135. if (diff[X_AXIS] > 0) SERIAL_CHAR('+');
  136. SERIAL_ECHO(diff[X_AXIS]);
  137. SERIAL_ECHOPGM(" Y");
  138. if (diff[Y_AXIS] > 0) SERIAL_CHAR('+');
  139. SERIAL_ECHO(diff[Y_AXIS]);
  140. SERIAL_ECHOPGM(" Z");
  141. if (diff[Z_AXIS] > 0) SERIAL_CHAR('+');
  142. SERIAL_ECHO(diff[Z_AXIS]);
  143. #else
  144. #if ENABLED(AUTO_BED_LEVELING_UBL)
  145. SERIAL_ECHOPGM("UBL Adjustment Z");
  146. const float rz = ubl.get_z_correction(current_position[X_AXIS], current_position[Y_AXIS]);
  147. #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
  148. SERIAL_ECHOPGM("ABL Adjustment Z");
  149. const float rz = bilinear_z_offset(current_position);
  150. #endif
  151. SERIAL_ECHO(ftostr43sign(rz, '+'));
  152. #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
  153. if (planner.z_fade_height) {
  154. SERIAL_ECHOPAIR(" (", ftostr43sign(rz * planner.fade_scaling_factor_for_z(current_position[Z_AXIS]), '+'));
  155. SERIAL_CHAR(')');
  156. }
  157. #endif
  158. #endif
  159. }
  160. else
  161. SERIAL_ECHOLNPGM(" (disabled)");
  162. SERIAL_EOL();
  163. #elif ENABLED(MESH_BED_LEVELING)
  164. SERIAL_ECHOPGM("Mesh Bed Leveling");
  165. if (planner.leveling_active) {
  166. SERIAL_ECHOLNPGM(" (enabled)");
  167. SERIAL_ECHOPAIR("MBL Adjustment Z", ftostr43sign(mbl.get_z(current_position[X_AXIS], current_position[Y_AXIS]
  168. #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
  169. , 1.0
  170. #endif
  171. ), '+'));
  172. #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
  173. if (planner.z_fade_height) {
  174. SERIAL_ECHOPAIR(" (", ftostr43sign(
  175. mbl.get_z(current_position[X_AXIS], current_position[Y_AXIS], planner.fade_scaling_factor_for_z(current_position[Z_AXIS])), '+'
  176. ));
  177. SERIAL_CHAR(')');
  178. }
  179. #endif
  180. }
  181. else
  182. SERIAL_ECHOPGM(" (disabled)");
  183. SERIAL_EOL();
  184. #endif // MESH_BED_LEVELING
  185. }
  186. #endif // DEBUG_LEVELING_FEATURE