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 5.7KB

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 "../MarlinCore.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(NOZZLE_AS_PROBE)
  56. "NOZZLE_AS_PROBE"
  57. #elif ENABLED(FIX_MOUNTED_PROBE)
  58. "FIX_MOUNTED_PROBE"
  59. #elif ENABLED(BLTOUCH)
  60. "BLTOUCH"
  61. #elif HAS_Z_SERVO_PROBE
  62. "SERVO PROBE"
  63. #elif ENABLED(TOUCH_MI_PROBE)
  64. "TOUCH_MI_PROBE"
  65. #elif ENABLED(Z_PROBE_SLED)
  66. "Z_PROBE_SLED"
  67. #elif ENABLED(Z_PROBE_ALLEN_KEY)
  68. "Z_PROBE_ALLEN_KEY"
  69. #elif ENABLED(SOLENOID_PROBE)
  70. "SOLENOID_PROBE"
  71. #else
  72. "NONE"
  73. #endif
  74. );
  75. #if HAS_BED_PROBE
  76. #if !HAS_PROBE_XY_OFFSET
  77. SERIAL_ECHOPAIR("Probe Offset X0 Y0 Z", probe_offset.z, " (");
  78. #else
  79. SERIAL_ECHOPAIR_P(PSTR("Probe Offset X"), probe_offset.x, SP_Y_STR, probe_offset.y, SP_Z_STR, probe_offset.z);
  80. if (probe_offset.x > 0)
  81. SERIAL_ECHOPGM(" (Right");
  82. else if (probe_offset.x < 0)
  83. SERIAL_ECHOPGM(" (Left");
  84. else if (probe_offset.y != 0)
  85. SERIAL_ECHOPGM(" (Middle");
  86. else
  87. SERIAL_ECHOPGM(" (Aligned With");
  88. if (probe_offset.y > 0) {
  89. #if IS_SCARA
  90. SERIAL_ECHOPGM("-Distal");
  91. #else
  92. SERIAL_ECHOPGM("-Back");
  93. #endif
  94. }
  95. else if (probe_offset.y < 0) {
  96. #if IS_SCARA
  97. SERIAL_ECHOPGM("-Proximal");
  98. #else
  99. SERIAL_ECHOPGM("-Front");
  100. #endif
  101. }
  102. else if (probe_offset.x != 0)
  103. SERIAL_ECHOPGM("-Center");
  104. SERIAL_ECHOPGM(" & ");
  105. #endif
  106. if (probe_offset.z < 0)
  107. SERIAL_ECHOPGM("Below");
  108. else if (probe_offset.z > 0)
  109. SERIAL_ECHOPGM("Above");
  110. else
  111. SERIAL_ECHOPGM("Same Z as");
  112. SERIAL_ECHOLNPGM(" Nozzle)");
  113. #endif
  114. #if HAS_ABL_OR_UBL
  115. SERIAL_ECHOLNPGM("Auto Bed Leveling: "
  116. #if ENABLED(AUTO_BED_LEVELING_LINEAR)
  117. "LINEAR"
  118. #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
  119. "BILINEAR"
  120. #elif ENABLED(AUTO_BED_LEVELING_3POINT)
  121. "3POINT"
  122. #elif ENABLED(AUTO_BED_LEVELING_UBL)
  123. "UBL"
  124. #endif
  125. );
  126. if (planner.leveling_active) {
  127. SERIAL_ECHOLNPGM(" (enabled)");
  128. #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
  129. if (planner.z_fade_height)
  130. SERIAL_ECHOLNPAIR("Z Fade: ", planner.z_fade_height);
  131. #endif
  132. #if ABL_PLANAR
  133. SERIAL_ECHOPGM("ABL Adjustment X");
  134. LOOP_XYZ(a) {
  135. float v = planner.get_axis_position_mm(AxisEnum(a)) - current_position[a];
  136. SERIAL_CHAR(' ', 'X' + char(a));
  137. if (v > 0) SERIAL_CHAR('+');
  138. SERIAL_ECHO(v);
  139. }
  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);
  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), '+'));
  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), '+'));
  165. #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
  166. if (planner.z_fade_height) {
  167. SERIAL_ECHOPAIR(" (", ftostr43sign(
  168. mbl.get_z(current_position, planner.fade_scaling_factor_for_z(current_position.z)), '+'
  169. ));
  170. SERIAL_CHAR(')');
  171. }
  172. #endif
  173. }
  174. else
  175. SERIAL_ECHOPGM(" (disabled)");
  176. SERIAL_EOL();
  177. #endif // MESH_BED_LEVELING
  178. }
  179. #endif // DEBUG_LEVELING_FEATURE