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.

tool_change.h 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. #pragma once
  23. #include "../inc/MarlinConfigPre.h"
  24. #include "../core/types.h"
  25. //#define DEBUG_TOOLCHANGE_MIGRATION_FEATURE
  26. #if HAS_MULTI_EXTRUDER
  27. typedef struct {
  28. #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
  29. float swap_length, extra_prime, extra_resume;
  30. int16_t prime_speed, retract_speed, unretract_speed, fan, fan_speed, fan_time;
  31. #endif
  32. #if ENABLED(TOOLCHANGE_PARK)
  33. bool enable_park;
  34. xy_pos_t change_point;
  35. #endif
  36. float z_raise;
  37. } toolchange_settings_t;
  38. extern toolchange_settings_t toolchange_settings;
  39. #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
  40. extern void tool_change_prime();
  41. #endif
  42. #if ENABLED(TOOLCHANGE_FS_PRIME_FIRST_USED)
  43. extern bool enable_first_prime;
  44. #endif
  45. #if ENABLED(TOOLCHANGE_FS_INIT_BEFORE_SWAP)
  46. extern bool toolchange_extruder_ready[EXTRUDERS];
  47. #endif
  48. #if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
  49. typedef struct {
  50. uint8_t target, last;
  51. bool automode, in_progress;
  52. } migration_settings_t;
  53. constexpr migration_settings_t migration_defaults = { 0, 0, false, false };
  54. extern migration_settings_t migration;
  55. bool extruder_migration();
  56. #endif
  57. #endif
  58. #if DO_SWITCH_EXTRUDER
  59. void move_extruder_servo(const uint8_t e);
  60. #endif
  61. #if ENABLED(SWITCHING_NOZZLE)
  62. #if SWITCHING_NOZZLE_TWO_SERVOS
  63. void lower_nozzle(const uint8_t e);
  64. void raise_nozzle(const uint8_t e);
  65. #else
  66. void move_nozzle_servo(const uint8_t angle_index);
  67. #endif
  68. #endif
  69. #if ENABLED(PARKING_EXTRUDER)
  70. #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
  71. #define PE_MAGNET_ON_STATE !PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE
  72. #else
  73. #define PE_MAGNET_ON_STATE PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE
  74. #endif
  75. void pe_set_solenoid(const uint8_t extruder_num, const uint8_t state);
  76. inline void pe_activate_solenoid(const uint8_t extruder_num) { pe_set_solenoid(extruder_num, PE_MAGNET_ON_STATE); }
  77. inline void pe_deactivate_solenoid(const uint8_t extruder_num) { pe_set_solenoid(extruder_num, !PE_MAGNET_ON_STATE); }
  78. void pe_solenoid_init();
  79. #elif ENABLED(MAGNETIC_PARKING_EXTRUDER)
  80. typedef struct MPESettings {
  81. float parking_xpos[2], // M951 L R
  82. grab_distance; // M951 I
  83. feedRate_t slow_feedrate, // M951 J
  84. fast_feedrate; // M951 H
  85. float travel_distance, // M951 D
  86. compensation_factor; // M951 C
  87. } mpe_settings_t;
  88. extern mpe_settings_t mpe_settings;
  89. void mpe_settings_init();
  90. #endif
  91. #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
  92. extern uint16_t singlenozzle_temp[EXTRUDERS];
  93. #endif
  94. #if BOTH(HAS_FAN, SINGLENOZZLE_STANDBY_FAN)
  95. extern uint8_t singlenozzle_fan_speed[EXTRUDERS];
  96. #endif
  97. TERN_(ELECTROMAGNETIC_SWITCHING_TOOLHEAD, void est_init());
  98. TERN_(SWITCHING_TOOLHEAD, void swt_init());
  99. /**
  100. * Perform a tool-change, which may result in moving the
  101. * previous tool out of the way and the new tool into place.
  102. */
  103. void tool_change(const uint8_t tmp_extruder, bool no_move=false);