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

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