My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../../inc/MarlinConfig.h"
  23. #if HAS_BED_PROBE
  24. #include "../gcode.h"
  25. #include "../../module/motion.h"
  26. #include "../../module/probe.h"
  27. #include "../../feature/bedlevel/bedlevel.h"
  28. #if HAS_PTC
  29. #include "../../feature/probe_temp_comp.h"
  30. #endif
  31. #if HAS_MULTI_HOTEND
  32. #include "../../module/tool_change.h"
  33. #endif
  34. #if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
  35. #include "../../lcd/marlinui.h"
  36. #endif
  37. /**
  38. * G30: Do a single Z probe at the current XY
  39. *
  40. * Parameters:
  41. *
  42. * X Probe X position (default current X)
  43. * Y Probe Y position (default current Y)
  44. * E Engage the probe for each probe (default 1)
  45. * C Enable probe temperature compensation (0 or 1, default 1)
  46. */
  47. void GcodeSuite::G30() {
  48. #if HAS_MULTI_HOTEND
  49. const uint8_t old_tool_index = active_extruder;
  50. tool_change(0);
  51. #endif
  52. const xy_pos_t pos = { parser.linearval('X', current_position.x + probe.offset_xy.x),
  53. parser.linearval('Y', current_position.y + probe.offset_xy.y) };
  54. if (!probe.can_reach(pos)) {
  55. #if ENABLED(DWIN_LCD_PROUI)
  56. SERIAL_ECHOLNF(GET_EN_TEXT_F(MSG_ZPROBE_OUT));
  57. LCD_MESSAGE(MSG_ZPROBE_OUT);
  58. #endif
  59. }
  60. else {
  61. // Disable leveling so the planner won't mess with us
  62. TERN_(HAS_LEVELING, set_bed_leveling_enabled(false));
  63. remember_feedrate_scaling_off();
  64. #if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
  65. process_subcommands_now(F("G28O"));
  66. #endif
  67. const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE;
  68. TERN_(HAS_PTC, ptc.set_enabled(!parser.seen('C') || parser.value_bool()));
  69. const float measured_z = probe.probe_at_point(pos, raise_after, 1);
  70. TERN_(HAS_PTC, ptc.set_enabled(true));
  71. if (!isnan(measured_z)) {
  72. SERIAL_ECHOLNPGM("Bed X: ", pos.x, " Y: ", pos.y, " Z: ", measured_z);
  73. #if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
  74. char msg[31], str_1[6], str_2[6], str_3[6];
  75. sprintf_P(msg, PSTR("X:%s, Y:%s, Z:%s"),
  76. dtostrf(pos.x, 1, 1, str_1),
  77. dtostrf(pos.y, 1, 1, str_2),
  78. dtostrf(measured_z, 1, 2, str_3)
  79. );
  80. ui.set_status(msg);
  81. #endif
  82. }
  83. restore_feedrate_and_scaling();
  84. if (raise_after == PROBE_PT_STOW)
  85. probe.move_z_after_probing();
  86. report_current_position();
  87. }
  88. // Restore the active tool
  89. TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index));
  90. }
  91. #endif // HAS_BED_PROBE