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.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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(Z_PROBE_SLED)
  63. "Z_PROBE_SLED"
  64. #elif ENABLED(Z_PROBE_ALLEN_KEY)
  65. "Z_PROBE_ALLEN_KEY"
  66. #else
  67. "NONE"
  68. #endif
  69. );
  70. #if HAS_BED_PROBE
  71. SERIAL_ECHOPAIR(
  72. "Probe Offset X:" STRINGIFY(X_PROBE_OFFSET_FROM_EXTRUDER)
  73. " Y:" STRINGIFY(Y_PROBE_OFFSET_FROM_EXTRUDER)
  74. " Z:", zprobe_zoffset
  75. );
  76. if ((X_PROBE_OFFSET_FROM_EXTRUDER) > 0)
  77. SERIAL_ECHOPGM(" (Right");
  78. else if ((X_PROBE_OFFSET_FROM_EXTRUDER) < 0)
  79. SERIAL_ECHOPGM(" (Left");
  80. else if ((Y_PROBE_OFFSET_FROM_EXTRUDER) != 0)
  81. SERIAL_ECHOPGM(" (Middle");
  82. else
  83. SERIAL_ECHOPGM(" (Aligned With");
  84. if ((Y_PROBE_OFFSET_FROM_EXTRUDER) > 0) {
  85. #if IS_SCARA
  86. SERIAL_ECHOPGM("-Distal");
  87. #else
  88. SERIAL_ECHOPGM("-Back");
  89. #endif
  90. }
  91. else if ((Y_PROBE_OFFSET_FROM_EXTRUDER) < 0) {
  92. #if IS_SCARA
  93. SERIAL_ECHOPGM("-Proximal");
  94. #else
  95. SERIAL_ECHOPGM("-Front");
  96. #endif
  97. }
  98. else if ((X_PROBE_OFFSET_FROM_EXTRUDER) != 0)
  99. SERIAL_ECHOPGM("-Center");
  100. if (zprobe_zoffset < 0)
  101. SERIAL_ECHOPGM(" & Below");
  102. else if (zprobe_zoffset > 0)
  103. SERIAL_ECHOPGM(" & Above");
  104. else
  105. SERIAL_ECHOPGM(" & Same Z as");
  106. SERIAL_ECHOLNPGM(" Nozzle)");
  107. #endif
  108. #if HAS_ABL_OR_UBL
  109. SERIAL_ECHOLNPGM("Auto Bed Leveling: "
  110. #if ENABLED(AUTO_BED_LEVELING_LINEAR)
  111. "LINEAR"
  112. #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
  113. "BILINEAR"
  114. #elif ENABLED(AUTO_BED_LEVELING_3POINT)
  115. "3POINT"
  116. #elif ENABLED(AUTO_BED_LEVELING_UBL)
  117. "UBL"
  118. #endif
  119. );
  120. if (planner.leveling_active) {
  121. SERIAL_ECHOLNPGM(" (enabled)");
  122. #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
  123. if (planner.z_fade_height)
  124. SERIAL_ECHOLNPAIR("Z Fade: ", planner.z_fade_height);
  125. #endif
  126. #if ABL_PLANAR
  127. const float diff[XYZ] = {
  128. planner.get_axis_position_mm(X_AXIS) - current_position[X_AXIS],
  129. planner.get_axis_position_mm(Y_AXIS) - current_position[Y_AXIS],
  130. planner.get_axis_position_mm(Z_AXIS) - current_position[Z_AXIS]
  131. };
  132. SERIAL_ECHOPGM("ABL Adjustment X");
  133. if (diff[X_AXIS] > 0) SERIAL_CHAR('+');
  134. SERIAL_ECHO(diff[X_AXIS]);
  135. SERIAL_ECHOPGM(" Y");
  136. if (diff[Y_AXIS] > 0) SERIAL_CHAR('+');
  137. SERIAL_ECHO(diff[Y_AXIS]);
  138. SERIAL_ECHOPGM(" Z");
  139. if (diff[Z_AXIS] > 0) SERIAL_CHAR('+');
  140. SERIAL_ECHO(diff[Z_AXIS]);
  141. #else
  142. #if ENABLED(AUTO_BED_LEVELING_UBL)
  143. SERIAL_ECHOPGM("UBL Adjustment Z");
  144. const float rz = ubl.get_z_correction(current_position[X_AXIS], current_position[Y_AXIS]);
  145. #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
  146. SERIAL_ECHOPGM("ABL Adjustment Z");
  147. const float rz = bilinear_z_offset(current_position);
  148. #endif
  149. SERIAL_ECHO(ftostr43sign(rz, '+'));
  150. #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
  151. if (planner.z_fade_height) {
  152. SERIAL_ECHOPAIR(" (", ftostr43sign(rz * planner.fade_scaling_factor_for_z(current_position[Z_AXIS]), '+'));
  153. SERIAL_CHAR(')');
  154. }
  155. #endif
  156. #endif
  157. }
  158. else
  159. SERIAL_ECHOLNPGM(" (disabled)");
  160. SERIAL_EOL();
  161. #elif ENABLED(MESH_BED_LEVELING)
  162. SERIAL_ECHOPGM("Mesh Bed Leveling");
  163. if (planner.leveling_active) {
  164. SERIAL_ECHOLNPGM(" (enabled)");
  165. SERIAL_ECHOPAIR("MBL Adjustment Z", ftostr43sign(mbl.get_z(current_position[X_AXIS], current_position[Y_AXIS]
  166. #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
  167. , 1.0
  168. #endif
  169. ), '+'));
  170. #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
  171. if (planner.z_fade_height) {
  172. SERIAL_ECHOPAIR(" (", ftostr43sign(
  173. mbl.get_z(current_position[X_AXIS], current_position[Y_AXIS], planner.fade_scaling_factor_for_z(current_position[Z_AXIS])), '+'
  174. ));
  175. SERIAL_CHAR(')');
  176. }
  177. #endif
  178. }
  179. else
  180. SERIAL_ECHOPGM(" (disabled)");
  181. SERIAL_EOL();
  182. #endif // MESH_BED_LEVELING
  183. }
  184. #endif // DEBUG_LEVELING_FEATURE