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.7KB

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