Configuration_adv.h

Created Diff never expires
/**
/**
* Marlin 3D Printer Firmware
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
*
* Based on Sprinter and grbl.
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
*
* This program is free software: you can redistribute it and/or modify
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
*/
#pragma once
#pragma once


/**
/**
* Configuration_adv.h
* Configuration_adv.h
*
*
* Advanced settings.
* Advanced settings.
* Only change these if you know exactly what you're doing.
* Only change these if you know exactly what you're doing.
* Some of these settings can damage your printer if improperly set!
* Some of these settings can damage your printer if improperly set!
*
*
* Basic settings can be found in Configuration.h
* Basic settings can be found in Configuration.h
*
*
*/
*/
#define CONFIGURATION_ADV_H_VERSION 020005
#define CONFIGURATION_ADV_H_VERSION 020005


// @section temperature
// @section temperature


//===========================================================================
//===========================================================================
//=============================Thermal Settings ============================
//=============================Thermal Settings ============================
//===========================================================================
//===========================================================================


//
//
// Custom Thermistor 1000 parameters
// Custom Thermistor 1000 parameters
//
//
#if TEMP_SENSOR_0 == 1000
#if TEMP_SENSOR_0 == 1000
#define HOTEND0_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define HOTEND0_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define HOTEND0_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define HOTEND0_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define HOTEND0_BETA 3950 // Beta value
#define HOTEND0_BETA 3950 // Beta value
#endif
#endif


#if TEMP_SENSOR_1 == 1000
#if TEMP_SENSOR_1 == 1000
#define HOTEND1_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define HOTEND1_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define HOTEND1_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define HOTEND1_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define HOTEND1_BETA 3950 // Beta value
#define HOTEND1_BETA 3950 // Beta value
#endif
#endif


#if TEMP_SENSOR_2 == 1000
#if TEMP_SENSOR_2 == 1000
#define HOTEND2_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define HOTEND2_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define HOTEND2_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define HOTEND2_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define HOTEND2_BETA 3950 // Beta value
#define HOTEND2_BETA 3950 // Beta value
#endif
#endif


#if TEMP_SENSOR_3 == 1000
#if TEMP_SENSOR_3 == 1000
#define HOTEND3_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define HOTEND3_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define HOTEND3_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define HOTEND3_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define HOTEND3_BETA 3950 // Beta value
#define HOTEND3_BETA 3950 // Beta value
#endif
#endif


#if TEMP_SENSOR_4 == 1000
#if TEMP_SENSOR_4 == 1000
#define HOTEND4_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define HOTEND4_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define HOTEND4_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define HOTEND4_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define HOTEND4_BETA 3950 // Beta value
#define HOTEND4_BETA 3950 // Beta value
#endif
#endif


#if TEMP_SENSOR_5 == 1000
#if TEMP_SENSOR_5 == 1000
#define HOTEND5_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define HOTEND5_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define HOTEND5_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define HOTEND5_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define HOTEND5_BETA 3950 // Beta value
#define HOTEND5_BETA 3950 // Beta value
#endif
#endif


#if TEMP_SENSOR_6 == 1000
#if TEMP_SENSOR_6 == 1000
#define HOTEND6_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define HOTEND6_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define HOTEND6_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define HOTEND6_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define HOTEND6_BETA 3950 // Beta value
#define HOTEND6_BETA 3950 // Beta value
#endif
#endif


#if TEMP_SENSOR_7 == 1000
#if TEMP_SENSOR_7 == 1000
#define HOTEND7_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define HOTEND7_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define HOTEND7_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define HOTEND7_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define HOTEND7_BETA 3950 // Beta value
#define HOTEND7_BETA 3950 // Beta value
#endif
#endif


#if TEMP_SENSOR_BED == 1000
#if TEMP_SENSOR_BED == 1000
#define BED_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define BED_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define BED_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define BED_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define BED_BETA 3950 // Beta value
#define BED_BETA 3950 // Beta value
#endif
#endif


#if TEMP_SENSOR_CHAMBER == 1000
#if TEMP_SENSOR_CHAMBER == 1000
#define CHAMBER_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define CHAMBER_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define CHAMBER_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define CHAMBER_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define CHAMBER_BETA 3950 // Beta value
#define CHAMBER_BETA 3950 // Beta value
#endif
#endif


//
//
// Hephestos 2 24V heated bed upgrade kit.
// Hephestos 2 24V heated bed upgrade kit.
// https://store.bq.com/en/heated-bed-kit-hephestos2
// https://store.bq.com/en/heated-bed-kit-hephestos2
//
//
//#define HEPHESTOS2_HEATED_BED_KIT
//#define HEPHESTOS2_HEATED_BED_KIT
#if ENABLED(HEPHESTOS2_HEATED_BED_KIT)
#if ENABLED(HEPHESTOS2_HEATED_BED_KIT)
#undef TEMP_SENSOR_BED
#undef TEMP_SENSOR_BED
#define TEMP_SENSOR_BED 70
#define TEMP_SENSOR_BED 70
#define HEATER_BED_INVERTING true
#define HEATER_BED_INVERTING true
#endif
#endif


/**
/**
* Heated Chamber settings
* Heated Chamber settings
*/
*/
#if TEMP_SENSOR_CHAMBER
#if TEMP_SENSOR_CHAMBER
#define CHAMBER_MINTEMP 5
#define CHAMBER_MINTEMP 5
#define CHAMBER_MAXTEMP 60
#define CHAMBER_MAXTEMP 60
#define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target
#define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target
//#define CHAMBER_LIMIT_SWITCHING
//#define CHAMBER_LIMIT_SWITCHING
//#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin
//#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin
//#define HEATER_CHAMBER_INVERTING false
//#define HEATER_CHAMBER_INVERTING false
#endif
#endif


#if DISABLED(PIDTEMPBED)
#if DISABLED(PIDTEMPBED)
#define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control
#define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control
#if ENABLED(BED_LIMIT_SWITCHING)
#if ENABLED(BED_LIMIT_SWITCHING)
#define BED_HYSTERESIS 2 // Only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
#define BED_HYSTERESIS 2 // Only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
#endif
#endif
#endif
#endif


/**
/**
* Thermal Protection provides additional protection to your printer from damage
* Thermal Protection provides additional protection to your printer from damage
* and fire. Marlin always includes safe min and max temperature ranges which
* and fire. Marlin always includes safe min and max temperature ranges which
* protect against a broken or disconnected thermistor wire.
* protect against a broken or disconnected thermistor wire.
*
*
* The issue: If a thermistor falls out, it will report the much lower
* The issue: If a thermistor falls out, it will report the much lower
* temperature of the air in the room, and the the firmware will keep
* temperature of the air in the room, and the the firmware will keep
* the heater on.
* the heater on.
*
*
* The solution: Once the temperature reaches the target, start observing.
* The solution: Once the temperature reaches the target, start observing.
* If the temperature stays too far below the target (hysteresis) for too
* If the temperature stays too far below the target (hysteresis) for too
* long (period), the firmware will halt the machine as a safety precaution.
* long (period), the firmware will halt the machine as a safety precaution.
*
*
* If you get false positives for "Thermal Runaway", increase
* If you get false positives for "Thermal Runaway", increase
* THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD
* THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD
*/
*/
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius


//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
#if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP)
#if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP)
//#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303
//#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303
#endif
#endif


/**
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature
* hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted and
* hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted and
* requires a hard reset. This test restarts with any M104/M109/M303, but only
* requires a hard reset. This test restarts with any M104/M109/M303, but only
* if the current temperature is far enough below the target for a reliable
* if the current temperature is far enough below the target for a reliable
* test.
* test.
*
*
* If you get false positives for "Heating failed", increase WATCH_TEMP_PERIOD
* If you get false positives for "Heating failed", increase WATCH_TEMP_PERIOD
* and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set
* and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set
* below 2.
* below 2.
*/
*/
#define WATCH_TEMP_PERIOD 20 // Seconds
#define WATCH_TEMP_PERIOD 20 // Seconds
#define WATCH_TEMP_INCREASE 2 // Degrees Celsius
#define WATCH_TEMP_INCREASE 2 // Degrees Celsius
#endif
#endif


/**
/**
* Thermal Protection parameters for the bed are just as above for hotends.
* Thermal Protection parameters for the bed are just as above for hotends.
*/
*/
#if ENABLED(THERMAL_PROTECTION_BED)
#if ENABLED(THERMAL_PROTECTION_BED)
#define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds
#define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds
#define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
#define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius


/**
/**
* As described above, except for the bed (M140/M190/M303).
* As described above, except for the bed (M140/M190/M303).
*/
*/
#define WATCH_BED_TEMP_PERIOD 60 // Seconds
#define WATCH_BED_TEMP_PERIOD 60 // Seconds
#define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius
#define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius
#endif
#endif


/**
/**
* Thermal Protection parameters for the heated chamber.
* Thermal Protection parameters for the heated chamber.
*/
*/
#if ENABLED(THERMAL_PROTECTION_CHAMBER)
#if ENABLED(THERMAL_PROTECTION_CHAMBER)
#define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds
#define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds
#define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius
#define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius


/**
/**
* Heated chamber watch settings (M141/M191).
* Heated chamber watch settings (M141/M191).
*/
*/
#define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds
#define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds
#define WATCH_CHAMBER_TEMP_INCREASE 2 // Degrees Celsius
#define WATCH_CHAMBER_TEMP_INCREASE 2 // Degrees Celsius
#endif
#endif


#if ENABLED(PIDTEMP)
#if ENABLED(PIDTEMP)
// Add an experimental additional term to the heater power, proportional to the extrusion speed.
// Add an experimental additional term to the heater power, proportional to the extrusion speed.
// A well-chosen Kc value should add just enough power to melt the increased material volume.
// A well-chosen Kc value should add just enough power to melt the increased material volume.
//#define PID_EXTRUSION_SCALING
//#define PID_EXTRUSION_SCALING
#if ENABLED(PID_EXTRUSION_SCALING)
#if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50
#define LPQ_MAX_LEN 50
#endif
#endif


/**
/**
* Add an experimental additional term to the heater power, proportional to the fan speed.
* Add an experimental additional term to the heater power, proportional to the fan speed.
* A well-chosen Kf value should add just enough power to compensate for power-loss from the cooling fan.
* A well-chosen Kf value should add just enough power to compensate for power-loss from the cooling fan.
* You can either just add a constant compensation with the DEFAULT_Kf value
* You can either just add a constant compensation with the DEFAULT_Kf value
* or follow the instruction below to get speed-dependent compensation.
* or follow the instruction below to get speed-dependent compensation.
*
*
* Constant compensation (use only with fanspeeds of 0% and 100%)
* Constant compensation (use only with fanspeeds of 0% and 100%)
* ---------------------------------------------------------------------
* ---------------------------------------------------------------------
* A good starting point for the Kf-value comes from the calculation:
* A good starting point for the Kf-value comes from the calculation:
* kf = (power_fan * eff_fan) / power_heater * 255
* kf = (power_fan * eff_fan) / power_heater * 255
* where eff_fan is between 0.0 and 1.0, based on fan-efficiency and airflow to the nozzle / heater.
* where eff_fan is between 0.0 and 1.0, based on fan-efficiency and airflow to the nozzle / heater.
*
*
* Example:
* Example:
* Heater: 40W, Fan: 0.1A * 24V = 2.4W, eff_fan = 0.8
* Heater: 40W, Fan: 0.1A * 24V = 2.4W, eff_fan = 0.8
* Kf = (2.4W * 0.8) / 40W * 255 = 12.24
* Kf = (2.4W * 0.8) / 40W * 255 = 12.24
*
*
* Fan-speed dependent compensation
* Fan-speed dependent compensation
* --------------------------------
* --------------------------------
* 1. To find a good Kf value, set the hotend temperature, wait for it to settle, and enable the fan (100%).
* 1. To find a good Kf value, set the hotend temperature, wait for it to settle, and enable the fan (100%).
* Make sure PID_FAN_SCALING_LIN_FACTOR is 0 and PID_FAN_SCALING_ALTERNATIVE_DEFINITION is not enabled.
* Make sure PID_FAN_SCALING_LIN_FACTOR is 0 and PID_FAN_SCALING_ALTERNATIVE_DEFINITION is not enabled.
* If you see the temperature drop repeat the test, increasing the Kf value slowly, until the temperature
* If you see the temperature drop repeat the test, increasing the Kf value slowly, until the temperature
* drop goes away. If the temperature overshoots after enabling the fan, the Kf value is too big.
* drop goes away. If the temperature overshoots after enabling the fan, the Kf value is too big.
* 2. Note the Kf-value for fan-speed at 100%
* 2. Note the Kf-value for fan-speed at 100%
* 3. Determine a good value for PID_FAN_SCALING_MIN_SPEED, which is around the speed, where the fan starts moving.
* 3. Determine a good value for PID_FAN_SCALING_MIN_SPEED, which is around the speed, where the fan starts moving.
* 4. Repeat step 1. and 2. for this fan speed.
* 4. Repeat step 1. and 2. for this fan speed.
* 5. Enable PID_FAN_SCALING_ALTERNATIVE_DEFINITION and enter the two identified Kf-values in
* 5. Enable PID_FAN_SCALING_ALTERNATIVE_DEFINITION and enter the two identified Kf-values in
* PID_FAN_SCALING_AT_FULL_SPEED and PID_FAN_SCALING_AT_MIN_SPEED. Enter the minimum speed in PID_FAN_SCALING_MIN_SPEED
* PID_FAN_SCALING_AT_FULL_SPEED and PID_FAN_SCALING_AT_MIN_SPEED. Enter the minimum speed in PID_FAN_SCALING_MIN_SPEED
*/
*/
//#define PID_FAN_SCALING
//#define PID_FAN_SCALING
#if ENABLED(PID_FAN_SCALING)
#if ENABLED(PID_FAN_SCALING)
//#define PID_FAN_SCALING_ALTERNATIVE_DEFINITION
//#define PID_FAN_SCALING_ALTERNATIVE_DEFINITION
#if ENABLED(PID_FAN_SCALING_ALTERNATIVE_DEFINITION)
#if ENABLED(PID_FAN_SCALING_ALTERNATIVE_DEFINITION)
// The alternative definition is used for an easier configuration.
// The alternative definition is used for an easier configuration.
// Just figure out Kf at fullspeed (255) and PID_FAN_SCALING_MIN_SPEED.
// Just figure out Kf at fullspeed (255) and PID_FAN_SCALING_MIN_SPEED.
// DEFAULT_Kf and PID_FAN_SCALING_LIN_FACTOR are calculated accordingly.
// DEFAULT_Kf and PID_FAN_SCALING_LIN_FACTOR are calculated accordingly.


#define PID_FAN_SCALING_AT_FULL_SPEED 13.0 //=PID_FAN_SCALING_LIN_FACTOR*255+DEFAULT_Kf
#define PID_FAN_SCALING_AT_FULL_SPEED 13.0 //=PID_FAN_SCALING_LIN_FACTOR*255+DEFAULT_Kf
#define PID_FAN_SCALING_AT_MIN_SPEED 6.0 //=PID_FAN_SCALING_LIN_FACTOR*PID_FAN_SCALING_MIN_SPEED+DEFAULT_Kf
#define PID_FAN_SCALING_AT_MIN_SPEED 6.0 //=PID_FAN_SCALING_LIN_FACTOR*PID_FAN_SCALING_MIN_SPEED+DEFAULT_Kf
#define PID_FAN_SCALING_MIN_SPEED 10.0 // Minimum fan speed at which to enable PID_FAN_SCALING
#define PID_FAN_SCALING_MIN_SPEED 10.0 // Minimum fan speed at which to enable PID_FAN_SCALING


#define DEFAULT_Kf (255.0*PID_FAN_SCALING_AT_MIN_SPEED-PID_FAN_SCALING_AT_FULL_SPEED*PID_FAN_SCALING_MIN_SPEED)/(255.0-PID_FAN_SCALING_MIN_SPEED)
#define DEFAULT_Kf (255.0*PID_FAN_SCALING_AT_MIN_SPEED-PID_FAN_SCALING_AT_FULL_SPEED*PID_FAN_SCALING_MIN_SPEED)/(255.0-PID_FAN_SCALING_MIN_SPEED)
#define PID_FAN_SCALING_LIN_FACTOR (PID_FAN_SCALING_AT_FULL_SPEED-DEFAULT_Kf)/255.0
#define PID_FAN_SCALING_LIN_FACTOR (PID_FAN_SCALING_AT_FULL_SPEED-DEFAULT_Kf)/255.0


#else
#else
#define PID_FAN_SCALING_LIN_FACTOR (0) // Power loss due to cooling = Kf * (fan_speed)
#define PID_FAN_SCALING_LIN_FACTOR (0) // Power loss due to cooling = Kf * (fan_speed)
#define DEFAULT_Kf 10 // A constant value added to the PID-tuner
#define DEFAULT_Kf 10 // A constant value added to the PID-tuner
#define PID_FAN_SCALING_MIN_SPEED 10 // Minimum fan speed at which to enable PID_FAN_SCALING
#define PID_FAN_SCALING_MIN_SPEED 10 // Minimum fan speed at which to enable PID_FAN_SCALING
#endif
#endif
#endif
#endif
#endif
#endif


/**
/**
* Automatic Temperature:
* Automatic Temperature:
* The hotend target temperature is calculated by all the buffered lines of gcode.
* The hotend target temperature is calculated by all the buffered lines of gcode.
* The maximum buffered steps/sec of the extruder motor is called "se".
* The maximum buffered steps/sec of the extruder motor is called "se".
* Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor>
* Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor>
* The target temperature is set to mintemp+factor*se[steps/sec] and is limited by
* The target temperature is set to mintemp+factor*se[steps/sec] and is limited by
* mintemp and maxtemp. Turn this off by executing M109 without F*
* mintemp and maxtemp. Turn this off by executing M109 without F*
* Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp.
* Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp.
* On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
* On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
*/
*/
#define AUTOTEMP
#define AUTOTEMP
#if ENABLED(AUTOTEMP)
#if ENABLED(AUTOTEMP)
#define AUTOTEMP_OLDWEIGHT 0.98
#define AUTOTEMP_OLDWEIGHT 0.98
#endif
#endif


// Extra options for the M114 "Current Position" report
// Extra options for the M114 "Current Position" report
//#define M114_DETAIL // Use 'M114` for details to check planner calculations
//#define M114_DETAIL // Use 'M114` for details to check planner calculations
//#define M114_REALTIME // Real current position based on forward kinematics
//#define M114_REALTIME // Real current position based on forward kinematics
//#define M114_LEGACY // M114 used to synchronize on every call. Enable if needed.
//#define M114_LEGACY // M114 used to synchronize on every call. Enable if needed.


// Show Temperature ADC value
// Show Temperature ADC value
// Enable for M105 to include ADC values read from temperature sensors.
// Enable for M105 to include ADC values read from temperature sensors.
//#define SHOW_TEMP_ADC_VALUES
//#define SHOW_TEMP_ADC_VALUES


/**
/**
* High Temperature Thermistor Support
* High Temperature Thermistor Support
*
*
* Thermistors able to support high temperature tend to have a hard time getting
* Thermistors able to support high temperature tend to have a hard time getting
* good readings at room and lower temperatures. This means HEATER_X_RAW_LO_TEMP
* good readings at room and lower temperatures. This means HEATER_X_RAW_LO_TEMP
* will probably be caught when the heating element first turns on during the
* will probably be caught when the heating element first turns on during the
* preheating process, which will trigger a min_temp_error as a safety measure
* preheating process, which will trigger a min_temp_error as a safety measure
* and force stop everything.
* and force stop everything.
* To circumvent this limitation, we allow for a preheat time (during which,
* To circumvent this limitation, we allow for a preheat time (during which,
* min_temp_error won't be triggered) and add a min_temp buffer to handle
* min_temp_error won't be triggered) and add a min_temp buffer to handle
* aberrant readings.
* aberrant readings.
*
*
* If you want to enable this feature for your hotend thermistor(s)
* If you want to enable this feature for your hotend thermistor(s)
* uncomment and set values > 0 in the constants below
* uncomment and set values > 0 in the constants below
*/
*/


// The number of consecutive low temperature errors that can occur
// The number of consecutive low temperature errors that can occur
// before a min_temp_error is triggered. (Shouldn't be more than 10.)
// before a min_temp_error is triggered. (Shouldn't be more than 10.)
//#define MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED 0
//#define MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED 0


// The number of milliseconds a hotend will preheat before starting to check
// The number of milliseconds a hotend will preheat before starting to check
// the temperature. This value should NOT be set to the time it takes the
// the temperature. This value should NOT be set to the time it takes the
// hot end to reach the target temperature, but the time it takes to reach
// hot end to reach the target temperature, but the time it takes to reach
// the minimum temperature your thermistor can read. The lower the better/safer.
// the minimum temperature your thermistor can read. The lower the better/safer.
// This shouldn't need to be more than 30 seconds (30000)
// This shouldn't need to be more than 30 seconds (30000)
//#define MILLISECONDS_PREHEAT_TIME 0
//#define MILLISECONDS_PREHEAT_TIME 0


// @section extruder
// @section extruder


// Extruder runout prevention.
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
//#define EXTRUDER_RUNOUT_PREVENT
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m)
#define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m)
#define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm)
#define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm)
#endif
#endif


// @section temperature
// @section temperature


// Calibration for AD595 / AD8495 sensor to adjust temperature measurements.
// Calibration for AD595 / AD8495 sensor to adjust temperature measurements.
// The final temperature is calculated as (measuredTemp * GAIN) + OFFSET.
// The final temperature is calculated as (measuredTemp * GAIN) + OFFSET.
#define TEMP_SENSOR_AD595_OFFSET 0.0
#define TEMP_SENSOR_AD595_OFFSET 0.0
#define TEMP_SENSOR_AD595_GAIN 1.0
#define TEMP_SENSOR_AD595_GAIN 1.0
#define TEMP_SENSOR_AD8495_OFFSET 0.0
#define TEMP_SENSOR_AD8495_OFFSET 0.0
#define TEMP_SENSOR_AD8495_GAIN 1.0
#define TEMP_SENSOR_AD8495_GAIN 1.0


/**
/**
* Controller Fan
* Controller Fan
* To cool down the stepper drivers and MOSFETs.
* To cool down the stepper drivers and MOSFETs.
*
*
* The fan turns on automatically whenever any driver is enabled and turns
* The fan turns on automatically whenever any driver is enabled and turns
* off (or reduces to idle speed) shortly after drivers are turned off.
* off (or reduces to idle speed) shortly after drivers are turned off.
*
*/
*/
//#define USE_CONTROLLER_FAN
//#define USE_CONTROLLER_FAN
#if ENABLED(USE_CONTROLLER_FAN)
#if ENABLED(USE_CONTROLLER_FAN)
//#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan
//#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan
//#define CONTROLLER_FAN_USE_Z_ONLY // With this option only the Z axis is considered
//#define CONTROLLER_FAN_USE_Z_ONLY // With this option only the Z axis is considered
#define CONTROLLERFAN_SPEED_MIN 0 // (0-255) Minimum speed. (If set below this value the fan is turned off.)
#define CONTROLLERFAN_SPEED_MIN 0 // (0-255) Minimum speed. (If set below this value the fan is turned off.)
#define CONTROLLERFAN_SPEED_ACTIVE 255 // (0-255) Active speed, used when any motor is enabled
#define CONTROLLERFAN_SPEED_ACTIVE 255 // (0-255) Active speed, used when any motor is enabled
#define CONTROLLERFAN_SPEED_IDLE 0 // (0-255) Idle speed, used when motors are disabled
#define CONTROLLERFAN_SPEED_IDLE 0 // (0-255) Idle speed, used when motors are disabled
#define CONTROLLERFAN_IDLE_TIME 60 // (seconds) Extra time to keep the fan running after disabling motors
#define CONTROLLERFAN_IDLE_TIME 60 // (seconds) Extra time to keep the fan running after disabling motors
//#define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings
//#define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings
#if ENABLED(CONTROLLER_FAN_EDITABLE)
#if ENABLED(CONTROLLER_FAN_EDITABLE)
#define CONTROLLER_FAN_MENU // Enable the Controller Fan submenu
#define CONTROLLER_FAN_MENU // Enable the Controller Fan submenu
#endif
#endif
#endif
#endif


// When first starting the main fan, run it at full speed for the
// When first starting the main fan, run it at full speed for the
// given number of milliseconds. This gets the fan spinning reliably
// given number of milliseconds. This gets the fan spinning reliably
// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
//#define FAN_KICKSTART_TIME 100
//#define FAN_KICKSTART_TIME 100


// Some coolers may require a non-zero "off" state.
// Some coolers may require a non-zero "off" state.
//#define FAN_OFF_PWM 1
//#define FAN_OFF_PWM 1


/**
/**
* PWM Fan Scaling
* PWM Fan Scaling
*
*
* Define the min/max speeds for PWM fans (as set with M106).
* Define the min/max speeds for PWM fans (as set with M106).
*
*
* With these options the M106 0-255 value range is scaled to a subset
* With these options the M106 0-255 value range is scaled to a subset
* to ensure that the fan has enough power to spin, or to run lower
* to ensure that the fan has enough power to spin, or to run lower
* current fans with higher current. (e.g., 5V/12V fans with 12V/24V)
* current fans with higher current. (e.g., 5V/12V fans with 12V/24V)
* Value 0 always turns off the fan.
* Value 0 always turns off the fan.
*
*
* Define one or both of these to override the default 0-255 range.
* Define one or both of these to override the default 0-255 range.
*/
*/
//#define FAN_MIN_PWM 50
//#define FAN_MIN_PWM 50
//#define FAN_MAX_PWM 128
//#define FAN_MAX_PWM 128


/**
/**
* FAST PWM FAN Settings
* FAST PWM FAN Settings
*
*
* Use to change the FAST FAN PWM frequency (if enabled in Configuration.h)
* Use to change the FAST FAN PWM frequency (if enabled in Configuration.h)
* Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a
* Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a
* frequency as close as possible to the desired frequency.
* frequency as close as possible to the desired frequency.
*
*
* FAST_PWM_FAN_FREQUENCY [undefined by default]
* FAST_PWM_FAN_FREQUENCY [undefined by default]
* Set this to your desired frequency.
* Set this to your desired frequency.
* If left undefined this defaults to F = F_CPU/(2*255*1)
* If left undefined this defaults to F = F_CPU/(2*255*1)
* i.e., F = 31.4kHz on 16MHz microcontrollers or F = 39.2kHz on 20MHz microcontrollers.
* i.e., F = 31.4kHz on 16MHz microcontrollers or F = 39.2kHz on 20MHz microcontrollers.
* These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required
* These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required
* NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behavior.
* NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behavior.
*
*
* USE_OCR2A_AS_TOP [undefined by default]
* USE_OCR2A_AS_TOP [undefined by default]
* Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2:
* Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2:
* 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz]
* 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz]
* 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz]
* 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz]
* A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of
* A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of
* PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.)
* PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.)
* USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies.
* USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies.
*/
*/
#if ENABLED(FAST_PWM_FAN)
#if ENABLED(FAST_PWM_FAN)
//#define FAST_PWM_FAN_FREQUENCY 31400
//#define FAST_PWM_FAN_FREQUENCY 31400
//#define USE_OCR2A_AS_TOP
//#define USE_OCR2A_AS_TOP
#endif
#endif


// @section extruder
// @section extruder


/**
/**
* Extruder cooling fans
* Extruder cooling fans
*
*
* Extruder auto fans automatically turn on when their extruders'
* Extruder auto fans automatically turn on when their extruders'
* temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE.
* temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE.
*
*
* Your board's pins file specifies the recommended pins. Override those here
* Your board's pins file specifies the recommended pins. Override those here
* or set to -1 to disable completely.
* or set to -1 to disable completely.
*
*
* Multiple extruders can be assigned to the same pin in which case
* Multiple extruders can be assigned to the same pin in which case
* the fan will turn on when any selected extruder is above the threshold.
* the fan will turn on when any selected extruder is above the threshold.
*/
*/
#define E0_AUTO_FAN_PIN 7
#define E0_AUTO_FAN_PIN 7
#define E1_AUTO_FAN_PIN -1
#define E1_AUTO_FAN_PIN -1
#define E2_AUTO_FAN_PIN -1
#define E2_AUTO_FAN_PIN -1
#define E3_AUTO_FAN_PIN -1
#define E3_AUTO_FAN_PIN -1
#define E4_AUTO_FAN_PIN -1
#define E4_AUTO_FAN_PIN -1
#define E5_AUTO_FAN_PIN -1
#define E5_AUTO_FAN_PIN -1
#define CHAMBER_AUTO_FAN_PIN -1
#define CHAMBER_AUTO_FAN_PIN -1


#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed
#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed
#define CHAMBER_AUTO_FAN_TEMPERATURE 30
#define CHAMBER_AUTO_FAN_TEMPERATURE 30
#define CHAMBER_AUTO_FAN_SPEED 255
#define CHAMBER_AUTO_FAN_SPEED 255


/**
/**
* Part-Cooling Fan Multiplexer
* Part-Cooling Fan Multiplexer
*
*
* This feature allows you to digitally multiplex the fan output.
* This feature allows you to digitally multiplex the fan output.
* The multiplexer is automatically switched at tool-change.
* The multiplexer is automatically switched at tool-change.
* Set FANMUX[012]_PINs below for up to 2, 4, or 8 multiplexed fans.
* Set FANMUX[012]_PINs below for up to 2, 4, or 8 multiplexed fans.
*/
*/
#define FANMUX0_PIN -1
#define FANMUX0_PIN -1
#define FANMUX1_PIN -1
#define FANMUX1_PIN -1
#define FANMUX2_PIN -1
#define FANMUX2_PIN -1


/**
/**
* M355 Case Light on-off / brightness
* M355 Case Light on-off / brightness
*/
*/
//#define CASE_LIGHT_ENABLE
//#define CASE_LIGHT_ENABLE
#if ENABLED(CASE_LIGHT_ENABLE)
#if ENABLED(CASE_LIGHT_ENABLE)
//#define CASE_LIGHT_PIN 4 // Override the default pin if needed
//#define CASE_LIGHT_PIN 4 // Override the default pin if needed
#define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW
#define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW
#define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on
#define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on
#define CASE_LIGHT_DEFAULT_BRIGHTNESS 105 // Set default power-up brightness (0-255, requires PWM pin)
#define CASE_LIGHT_DEFAULT_BRIGHTNESS 105 // Set default power-up brightness (0-255, requires PWM pin)
//#define CASE_LIGHT_MAX_PWM 128 // Limit pwm
//#define CASE_LIGHT_MAX_PWM 128 // Limit pwm
//#define CASE_LIGHT_MENU // Add Case Light options to the LCD menu
//#define CASE_LIGHT_MENU // Add Case Light options to the LCD menu
//#define CASE_LIGHT_NO_BRIGHTNESS // Disable brightness control. Enable for non-PWM lighting.
//#define CASE_LIGHT_NO_BRIGHTNESS // Disable brightness control. Enable for non-PWM lighting.
//#define CASE_LIGHT_USE_NEOPIXEL // Use Neopixel LED as case light, requires NEOPIXEL_LED.
//#define CASE_LIGHT_USE_NEOPIXEL // Use Neopixel LED as case light, requires NEOPIXEL_LED.
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
#define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White }
#define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White }
#endif
#endif
#endif
#endif


// @section homing
// @section homing


// If you want endstops to stay on (by default) even when not homing
// If you want endstops to stay on (by default) even when not homing
// enable this option. Override at any time with M120, M121.
// enable this option. Override at any time with M120, M121.
//#define ENDSTOPS_ALWAYS_ON_DEFAULT
//#define ENDSTOPS_ALWAYS_ON_DEFAULT


// @section extras
// @section extras


//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.


// Employ an external closed loop controller. Override pins here if needed.
// Employ an external closed loop controller. Override pins here if needed.
//#define EXTERNAL_CLOSED_LOOP_CONTROLLER
//#define EXTERNAL_CLOSED_LOOP_CONTROLLER
#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
//#define CLOSED_LOOP_ENABLE_PIN -1
//#define CLOSED_LOOP_ENABLE_PIN -1
//#define CLOSED_LOOP_MOVE_COMPLETE_PIN -1
//#define CLOSED_LOOP_MOVE_COMPLETE_PIN -1
#endif
#endif


/**
/**
* Dual Steppers / Dual Endstops
* Dual Steppers / Dual Endstops
*
*
* This section will allow you to use extra E drivers to drive a second motor for X, Y, or Z axes.
* This section will allow you to use extra E drivers to drive a second motor for X, Y, or Z axes.
*
*
* For example, set X_DUAL_STEPPER_DRIVERS setting to use a second motor. If the motors need to
* For example, set X_DUAL_STEPPER_DRIVERS setting to use a second motor. If the motors need to
* spin in opposite directions set INVERT_X2_VS_X_DIR. If the second motor needs its own endstop
* spin in opposite directions set INVERT_X2_VS_X_DIR. If the second motor needs its own endstop
* set X_DUAL_ENDSTOPS. This can adjust for "racking." Use X2_USE_ENDSTOP to set the endstop plug
* set X_DUAL_ENDSTOPS. This can adjust for "racking." Use X2_USE_ENDSTOP to set the endstop plug
* that should be used for the second endstop. Extra endstops will appear in the output of 'M119'.
* that should be used for the second endstop. Extra endstops will appear in the output of 'M119'.
*
*
* Use X_DUAL_ENDSTOP_ADJUSTMENT to adjust for mechanical imperfection. After homing both motors
* Use X_DUAL_ENDSTOP_ADJUSTMENT to adjust for mechanical imperfection. After homing both motors
* this offset is applied to the X2 motor. To find the offset home the X axis, and measure the error
* this offset is applied to the X2 motor. To find the offset home the X axis, and measure the error
* in X2. Dual endstop offsets can be set at runtime with 'M666 X<offset> Y<offset> Z<offset>'.
* in X2. Dual endstop offsets can be set at runtime with 'M666 X<offset> Y<offset> Z<offset>'.
*/
*/


//#define X_DUAL_STEPPER_DRIVERS
//#define X_DUAL_STEPPER_DRIVERS
#if ENABLED(X_DUAL_STEPPER_DRIVERS)
#if ENABLED(X_DUAL_STEPPER_DRIVERS)
#define INVERT_X2_VS_X_DIR true // Set 'true' if X motors should rotate in opposite directions
#define INVERT_X2_VS_X_DIR true // Set 'true' if X motors should rotate in opposite directions
//#define X_DUAL_ENDSTOPS
//#define X_DUAL_ENDSTOPS
#if ENABLED(X_DUAL_ENDSTOPS)
#if ENABLED(X_DUAL_ENDSTOPS)
#define X2_USE_ENDSTOP _XMAX_
#define X2_USE_ENDSTOP _XMAX_
#define X2_ENDSTOP_ADJUSTMENT 0
#define X2_ENDSTOP_ADJUSTMENT 0
#endif
#endif
#endif
#endif


//#define Y_DUAL_STEPPER_DRIVERS
//#define Y_DUAL_STEPPER_DRIVERS
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#define INVERT_Y2_VS_Y_DIR true // Set 'true' if Y motors should rotate in opposite directions
#define INVERT_Y2_VS_Y_DIR true // Set 'true' if Y motors should rotate in opposite directions
//#define Y_DUAL_ENDSTOPS
//#define Y_DUAL_ENDSTOPS
#if ENABLED(Y_DUAL_ENDSTOPS)
#if ENABLED(Y_DUAL_ENDSTOPS)
#define Y2_USE_ENDSTOP _YMAX_
#define Y2_USE_ENDSTOP _YMAX_
#define Y2_ENDSTOP_ADJUSTMENT 0
#define Y2_ENDSTOP_ADJUSTMENT 0
#endif
#endif
#endif
#endif


//
//
// For Z set the number of stepper drivers
// For Z set the number of stepper drivers
//
//
#define NUM_Z_STEPPER_DRIVERS 2 // (1-4) Z options change based on how many
#define NUM_Z_STEPPER_DRIVERS 2 // (1-4) Z options change based on how many


#if NUM_Z_STEPPER_DRIVERS > 1
#if NUM_Z_STEPPER_DRIVERS > 1
//#define Z_MULTI_ENDSTOPS
//#define Z_MULTI_ENDSTOPS
#if ENABLED(Z_MULTI_ENDSTOPS)
#if ENABLED(Z_MULTI_ENDSTOPS)
#define Z2_USE_ENDSTOP _XMAX_
#define Z2_USE_ENDSTOP _XMAX_
#define Z2_ENDSTOP_ADJUSTMENT 0
#define Z2_ENDSTOP_ADJUSTMENT 0
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPER_DRIVERS >= 3
#define Z3_USE_ENDSTOP _YMAX_
#define Z3_USE_ENDSTOP _YMAX_
#define Z3_ENDSTOP_ADJUSTMENT 0
#define Z3_ENDSTOP_ADJUSTMENT 0
#endif
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPER_DRIVERS >= 4
#define Z4_USE_ENDSTOP _ZMAX_
#define Z4_USE_ENDSTOP _ZMAX_
#define Z4_ENDSTOP_ADJUSTMENT 0
#define Z4_ENDSTOP_ADJUSTMENT 0
#endif
#endif
#endif
#endif
#endif
#endif


/**
/**
* Dual X Carriage
* Dual X Carriage
*
*
* This setup has two X carriages that can move independently, each with its own hotend.
* This setup has two X carriages that can move independently, each with its own hotend.
* The carriages can be used to print an object with two colors or materials, or in
* The carriages can be used to print an object with two colors or materials, or in
* "duplication mode" it can print two identical or X-mirrored objects simultaneously.
* "duplication mode" it can print two identical or X-mirrored objects simultaneously.
* The inactive carriage is parked automatically to prevent oozing.
* The inactive carriage is parked automatically to prevent oozing.
* X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis.
* X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis.
* By default the X2 stepper is assigned to the first unused E plug on the board.
* By default the X2 stepper is assigned to the first unused E plug on the board.
*
*
* The following Dual X Carriage modes can be selected with M605 S<mode>:
* The following Dual X Carriage modes can be selected with M605 S<mode>:
*
*
* 0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel
* 0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel
* results as long as it supports dual X-carriages. (M605 S0)
* results as long as it supports dual X-carriages. (M605 S0)
*
*
* 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so
* 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so
* that additional slicer support is not required. (M605 S1)
* that additional slicer support is not required. (M605 S1)
*
*
* 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with
* 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with
* the first X-carriage and extruder, to print 2 copies of the same object at the same time.
* the first X-carriage and extruder, to print 2 copies of the same object at the same time.
* Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and
* Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and
* follow with M605 S2 to initiate duplicated movement.
* follow with M605 S2 to initiate duplicated movement.
*
*
* 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates
* 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates
* the movement of the first except the second extruder is reversed in the X axis.
* the movement of the first except the second extruder is reversed in the X axis.
* Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and
* Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and
* follow with M605 S3 to initiate mirrored movement.
* follow with M605 S3 to initiate mirrored movement.
*/
*/
//#define DUAL_X_CARRIAGE
//#define DUAL_X_CARRIAGE
#if ENABLED(DUAL_X_CARRIAGE)
#if ENABLED(DUAL_X_CARRIAGE)
#define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS
#define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS
#define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage
#define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage
#define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage
#define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage
#define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed
#define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position
#define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS.
#define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS.
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-
// Remember: you should set the second extruder x-