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

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