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.

G30.cpp 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 "../../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. /**
  29. * G30: Do a single Z probe at the current XY
  30. *
  31. * Parameters:
  32. *
  33. * X Probe X position (default current X)
  34. * Y Probe Y position (default current Y)
  35. * E Engage the probe for each probe (default 1)
  36. */
  37. void GcodeSuite::G30() {
  38. const xy_pos_t pos = { parser.linearval('X', current_position.x + probe_offset_xy.x),
  39. parser.linearval('Y', current_position.y + probe_offset_xy.y) };
  40. if (!position_is_reachable_by_probe(pos)) return;
  41. // Disable leveling so the planner won't mess with us
  42. #if HAS_LEVELING
  43. set_bed_leveling_enabled(false);
  44. #endif
  45. remember_feedrate_scaling_off();
  46. const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE;
  47. const float measured_z = probe_at_point(pos, raise_after, 1);
  48. if (!isnan(measured_z))
  49. SERIAL_ECHOLNPAIR("Bed X: ", FIXFLOAT(pos.x), " Y: ", FIXFLOAT(pos.y), " Z: ", FIXFLOAT(measured_z));
  50. restore_feedrate_and_scaling();
  51. #ifdef Z_AFTER_PROBING
  52. if (raise_after == PROBE_PT_STOW) move_z_after_probing();
  53. #endif
  54. report_current_position();
  55. }
  56. #endif // HAS_BED_PROBE