2017-09-06 06:28:31 -05:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2020-02-03 08:00:57 -06:00
|
|
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2017-09-06 06:28:31 -05:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-27 23:57:50 -05:00
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
2017-09-06 06:28:31 -05:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
2018-10-10 09:45:20 -05:00
|
|
|
#pragma once
|
2017-09-06 06:28:31 -05:00
|
|
|
|
2018-10-10 09:45:20 -05:00
|
|
|
#include "../inc/MarlinConfigPre.h"
|
2019-09-29 04:25:39 -05:00
|
|
|
#include "../core/types.h"
|
2017-09-06 06:28:31 -05:00
|
|
|
|
2018-10-17 11:11:41 -05:00
|
|
|
#if EXTRUDERS > 1
|
|
|
|
|
|
|
|
typedef struct {
|
2018-11-06 21:52:20 -06:00
|
|
|
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
2020-04-22 21:03:28 -05:00
|
|
|
float swap_length, extra_prime, extra_resume;
|
|
|
|
int16_t prime_speed, retract_speed, unretract_speed, fan, fan_speed, fan_time;
|
|
|
|
#endif
|
|
|
|
#if ENABLED(TOOLCHANGE_PARK)
|
|
|
|
bool enable_park;
|
|
|
|
xy_pos_t change_point;
|
2018-11-06 21:52:20 -06:00
|
|
|
#endif
|
2018-10-21 02:56:31 -05:00
|
|
|
float z_raise;
|
2018-10-17 11:11:41 -05:00
|
|
|
} toolchange_settings_t;
|
|
|
|
|
|
|
|
extern toolchange_settings_t toolchange_settings;
|
|
|
|
|
2020-04-22 21:03:28 -05:00
|
|
|
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
|
|
|
extern void tool_change_prime();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(TOOLCHANGE_FS_PRIME_FIRST_USED)
|
|
|
|
extern bool enable_first_prime;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(TOOLCHANGE_FS_INIT_BEFORE_SWAP)
|
|
|
|
extern bool toolchange_extruder_ready[EXTRUDERS];
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
|
|
|
|
typedef struct {
|
|
|
|
uint8_t target, last;
|
|
|
|
bool automode, in_progress;
|
|
|
|
} migration_settings_t;
|
|
|
|
constexpr migration_settings_t migration_defaults = { 0, 0, false, false };
|
|
|
|
extern migration_settings_t migration;
|
2020-06-27 21:57:01 -05:00
|
|
|
bool extruder_migration();
|
2020-04-22 21:03:28 -05:00
|
|
|
#endif
|
2018-10-17 11:11:41 -05:00
|
|
|
#endif
|
|
|
|
|
2018-05-18 13:16:59 -05:00
|
|
|
#if DO_SWITCH_EXTRUDER
|
2017-09-06 06:28:31 -05:00
|
|
|
void move_extruder_servo(const uint8_t e);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(SWITCHING_NOZZLE)
|
2019-02-04 00:19:56 -06:00
|
|
|
#if SWITCHING_NOZZLE_TWO_SERVOS
|
|
|
|
void lower_nozzle(const uint8_t e);
|
|
|
|
void raise_nozzle(const uint8_t e);
|
|
|
|
#else
|
|
|
|
void move_nozzle_servo(const uint8_t angle_index);
|
|
|
|
#endif
|
2017-09-06 06:28:31 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(PARKING_EXTRUDER)
|
|
|
|
|
|
|
|
#if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
|
|
|
|
#define PE_MAGNET_ON_STATE !PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE
|
|
|
|
#else
|
|
|
|
#define PE_MAGNET_ON_STATE PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE
|
|
|
|
#endif
|
|
|
|
|
2019-02-06 06:30:53 -06:00
|
|
|
void pe_set_solenoid(const uint8_t extruder_num, const uint8_t state);
|
2017-09-06 06:28:31 -05:00
|
|
|
|
2019-02-06 06:30:53 -06:00
|
|
|
inline void pe_activate_solenoid(const uint8_t extruder_num) { pe_set_solenoid(extruder_num, PE_MAGNET_ON_STATE); }
|
|
|
|
inline void pe_deactivate_solenoid(const uint8_t extruder_num) { pe_set_solenoid(extruder_num, !PE_MAGNET_ON_STATE); }
|
2017-09-06 06:28:31 -05:00
|
|
|
|
2019-02-06 06:30:53 -06:00
|
|
|
void pe_solenoid_init();
|
2017-09-18 01:05:44 -05:00
|
|
|
|
2019-02-06 06:30:53 -06:00
|
|
|
#elif ENABLED(MAGNETIC_PARKING_EXTRUDER)
|
|
|
|
|
|
|
|
typedef struct MPESettings {
|
2019-09-26 01:28:09 -05:00
|
|
|
float parking_xpos[2], // M951 L R
|
|
|
|
grab_distance; // M951 I
|
|
|
|
feedRate_t slow_feedrate, // M951 J
|
|
|
|
fast_feedrate; // M951 H
|
|
|
|
float travel_distance, // M951 D
|
|
|
|
compensation_factor; // M951 C
|
2019-02-06 06:30:53 -06:00
|
|
|
} mpe_settings_t;
|
|
|
|
|
|
|
|
extern mpe_settings_t mpe_settings;
|
|
|
|
|
|
|
|
void mpe_settings_init();
|
|
|
|
|
|
|
|
#endif
|
2017-09-06 06:28:31 -05:00
|
|
|
|
2020-04-28 00:21:23 -05:00
|
|
|
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
|
2018-10-07 17:06:14 -05:00
|
|
|
extern uint16_t singlenozzle_temp[EXTRUDERS];
|
2020-04-28 00:21:23 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if BOTH(HAS_FAN, SINGLENOZZLE_STANDBY_FAN)
|
|
|
|
extern uint8_t singlenozzle_fan_speed[EXTRUDERS];
|
2018-10-07 17:06:14 -05:00
|
|
|
#endif
|
|
|
|
|
2020-04-22 16:35:03 -05:00
|
|
|
TERN_(ELECTROMAGNETIC_SWITCHING_TOOLHEAD, void est_init());
|
2019-07-01 05:55:23 -05:00
|
|
|
|
2020-04-22 16:35:03 -05:00
|
|
|
TERN_(SWITCHING_TOOLHEAD, void swt_init());
|
2020-03-08 16:13:41 -05:00
|
|
|
|
2017-09-06 06:28:31 -05:00
|
|
|
/**
|
|
|
|
* Perform a tool-change, which may result in moving the
|
|
|
|
* previous tool out of the way and the new tool into place.
|
|
|
|
*/
|
2019-06-23 20:00:48 -05:00
|
|
|
void tool_change(const uint8_t tmp_extruder, bool no_move=false);
|