fwretract.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. /**
  23. * fwretract.h - Define firmware-based retraction interface
  24. */
  25. #ifndef FWRETRACT_H
  26. #define FWRETRACT_H
  27. #include "MarlinConfig.h"
  28. class FWRetract {
  29. public:
  30. static bool autoretract_enabled, // M209 S - Autoretract switch
  31. retracted[EXTRUDERS]; // Which extruders are currently retracted
  32. #if EXTRUDERS > 1
  33. static bool retracted_swap[EXTRUDERS]; // Which extruders are swap-retracted
  34. #endif
  35. static float retract_length, // M207 S - G10 Retract length
  36. retract_feedrate_mm_s, // M207 F - G10 Retract feedrate
  37. retract_zlift, // M207 Z - G10 Retract hop size
  38. retract_recover_length, // M208 S - G11 Recover length
  39. retract_recover_feedrate_mm_s, // M208 F - G11 Recover feedrate
  40. swap_retract_length, // M207 W - G10 Swap Retract length
  41. swap_retract_recover_length, // M208 W - G11 Swap Recover length
  42. swap_retract_recover_feedrate_mm_s, // M208 R - G11 Swap Recover feedrate
  43. hop_amount;
  44. FWRetract() { reset(); }
  45. static void reset();
  46. static void refresh_autoretract() {
  47. for (uint8_t i = 0; i < EXTRUDERS; i++) retracted[i] = false;
  48. }
  49. static void enable_autoretract(const bool enable) {
  50. autoretract_enabled = enable;
  51. refresh_autoretract();
  52. }
  53. static void retract(const bool retracting
  54. #if EXTRUDERS > 1
  55. , bool swapping = false
  56. #endif
  57. );
  58. };
  59. extern FWRetract fwretract;
  60. #endif // FWRETRACT_H