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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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(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. SERIAL_ECHOPAIR_P(PSTR("Probe Offset X"), probe_offset.x, SP_Y_STR, probe_offset.y, SP_Z_STR, probe_offset.z);
  77. if (probe_offset.x > 0)
  78. SERIAL_ECHOPGM(" (Right");
  79. else if (probe_offset.x < 0)
  80. SERIAL_ECHOPGM(" (Left");
  81. else if (probe_offset.y != 0)
  82. SERIAL_ECHOPGM(" (Middle");
  83. else
  84. SERIAL_ECHOPGM(" (Aligned With");
  85. if (probe_offset.y > 0) {
  86. #if IS_SCARA
  87. SERIAL_ECHOPGM("-Distal");
  88. #else
  89. SERIAL_ECHOPGM("-Back");
  90. #endif
  91. }
  92. else if (probe_offset.y < 0) {
  93. #if IS_SCARA
  94. SERIAL_ECHOPGM("-Proximal");
  95. #else
  96. SERIAL_ECHOPGM("-Front");
  97. #endif
  98. }
  99. else if (probe_offset.x != 0)
  100. SERIAL_ECHOPGM("-Center");
  101. if (probe_offset.z < 0)
  102. SERIAL_ECHOPGM(" & Below");
  103. else if (probe_offset.z > 0)
  104. SERIAL_ECHOPGM(" & Above");
  105. else
  106. SERIAL_ECHOPGM(" & Same Z as");
  107. SERIAL_ECHOLNPGM(" Nozzle)");
  108. #endif
  109. #if HAS_ABL_OR_UBL
  110. SERIAL_ECHOLNPGM("Auto Bed Leveling: "
  111. #if ENABLED(AUTO_BED_LEVELING_LINEAR)
  112. "LINEAR"
  113. #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
  114. "BILINEAR"
  115. #elif ENABLED(AUTO_BED_LEVELING_3POINT)
  116. "3POINT"
  117. #elif ENABLED(AUTO_BED_LEVELING_UBL)
  118. "UBL"
  119. #endif
  120. );
  121. if (planner.leveling_active) {
  122. SERIAL_ECHOLNPGM(" (enabled)");
  123. #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
  124. if (planner.z_fade_height)
  125. SERIAL_ECHOLNPAIR("Z Fade: ", planner.z_fade_height);
  126. #endif
  127. #if ABL_PLANAR
  128. SERIAL_ECHOPGM("ABL Adjustment X");
  129. LOOP_XYZ(a) {
  130. float v = planner.get_axis_position_mm(AxisEnum(a)) - current_position[a];
  131. SERIAL_CHAR(' ');
  132. SERIAL_CHAR('X' + char(a));
  133. if (v > 0) SERIAL_CHAR('+');
  134. SERIAL_ECHO(v);
  135. }
  136. #else
  137. #if ENABLED(AUTO_BED_LEVELING_UBL)
  138. SERIAL_ECHOPGM("UBL Adjustment Z");
  139. const float rz = ubl.get_z_correction(current_position);
  140. #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
  141. SERIAL_ECHOPGM("ABL Adjustment Z");
  142. const float rz = bilinear_z_offset(current_position);
  143. #endif
  144. SERIAL_ECHO(ftostr43sign(rz, '+'));
  145. #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
  146. if (planner.z_fade_height) {
  147. SERIAL_ECHOPAIR(" (", ftostr43sign(rz * planner.fade_scaling_factor_for_z(current_position.z), '+'));
  148. SERIAL_CHAR(')');
  149. }
  150. #endif
  151. #endif
  152. }
  153. else
  154. SERIAL_ECHOLNPGM(" (disabled)");
  155. SERIAL_EOL();
  156. #elif ENABLED(MESH_BED_LEVELING)
  157. SERIAL_ECHOPGM("Mesh Bed Leveling");
  158. if (planner.leveling_active) {
  159. SERIAL_ECHOLNPGM(" (enabled)");
  160. SERIAL_ECHOPAIR("MBL Adjustment Z", ftostr43sign(mbl.get_z(current_position), '+'));
  161. #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
  162. if (planner.z_fade_height) {
  163. SERIAL_ECHOPAIR(" (", ftostr43sign(
  164. mbl.get_z(current_position, planner.fade_scaling_factor_for_z(current_position.z)), '+'
  165. ));
  166. SERIAL_CHAR(')');
  167. }
  168. #endif
  169. }
  170. else
  171. SERIAL_ECHOPGM(" (disabled)");
  172. SERIAL_EOL();
  173. #endif // MESH_BED_LEVELING
  174. }
  175. #endif // DEBUG_LEVELING_FEATURE