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.

G0_G1.cpp 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 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 "../gcode.h"
  23. #include "../../module/motion.h"
  24. #include "../../Marlin.h"
  25. #if ENABLED(FWRETRACT)
  26. #include "../../feature/fwretract.h"
  27. #endif
  28. #include "../../sd/cardreader.h"
  29. extern float destination[XYZE];
  30. /**
  31. * G0, G1: Coordinated movement of X Y Z E axes
  32. */
  33. void GcodeSuite::G0_G1(
  34. #if IS_SCARA
  35. bool fast_move/*=false*/
  36. #endif
  37. ) {
  38. if (MOTION_CONDITIONS) {
  39. get_destination_from_command(); // For X Y Z E F
  40. #if ENABLED(FWRETRACT)
  41. if (MIN_AUTORETRACT <= MAX_AUTORETRACT) {
  42. // When M209 Autoretract is enabled, convert E-only moves to firmware retract/recover moves
  43. if (fwretract.autoretract_enabled && parser.seen('E') && !(parser.seen('X') || parser.seen('Y') || parser.seen('Z'))) {
  44. const float echange = destination[E_AXIS] - current_position[E_AXIS];
  45. // Is this a retract or recover move?
  46. if (WITHIN(FABS(echange), MIN_AUTORETRACT, MAX_AUTORETRACT) && fwretract.retracted[active_extruder] == (echange > 0.0)) {
  47. current_position[E_AXIS] = destination[E_AXIS]; // Hide a G1-based retract/recover from calculations
  48. sync_plan_position_e(); // AND from the planner
  49. return fwretract.retract(echange < 0.0); // Firmware-based retract/recover (double-retract ignored)
  50. }
  51. }
  52. }
  53. #endif // FWRETRACT
  54. #if IS_SCARA
  55. fast_move ? prepare_uninterpolated_move_to_destination() : prepare_move_to_destination();
  56. #else
  57. prepare_move_to_destination();
  58. #endif
  59. }
  60. }