diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index 4583a0a5f..386f836d2 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -539,6 +539,16 @@ #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_BY_EXTRUDERS(v1, v1, v1, v1) + /** + * With SINGLENOZZLE all "extruders" are in the same place + */ + #if ENABLED(SINGLENOZZLE) + #undef EXTRUDER_OFFSET_X + #undef EXTRUDER_OFFSET_Y + #define EXTRUDER_OFFSET_X { 0 } + #define EXTRUDER_OFFSET_Y { 0 } + #endif + /** * Z_DUAL_ENDSTOPS endstop reassignment */ diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 87c72790b..a79b38e5a 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -120,6 +120,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index c499c2c96..3a6e6a895 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -149,7 +149,9 @@ #error "EXTRUDERS must be 1 with Z_DUAL_STEPPER_DRIVERS." #endif -#endif // EXTRUDERS > 1 +#elif ENABLED(SINGLENOZZLE) + #error "SINGLENOZZLE requires 2 or more EXTRUDERS." +#endif /** * Limited number of servos diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 1092bf335..3a9a93acd 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -120,6 +120,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/Felix/DUAL/Configuration.h b/Marlin/example_configurations/Felix/DUAL/Configuration.h index 1c16d5ca0..4d05e471a 100644 --- a/Marlin/example_configurations/Felix/DUAL/Configuration.h +++ b/Marlin/example_configurations/Felix/DUAL/Configuration.h @@ -120,6 +120,9 @@ // :[1,2,3,4] #define EXTRUDERS 2 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index e25ea5bd8..279c7ed20 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -123,6 +123,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/Hephestos_2/Configuration.h b/Marlin/example_configurations/Hephestos_2/Configuration.h index 5f2e0d533..48d41042a 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration.h @@ -120,6 +120,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index 00fa13f35..8cbf115d7 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -127,6 +127,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h index 6f1ee7d2e..0a9ca7313 100644 --- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h @@ -120,6 +120,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/RigidBot/Configuration.h b/Marlin/example_configurations/RigidBot/Configuration.h index 09166c229..85a1332c8 100644 --- a/Marlin/example_configurations/RigidBot/Configuration.h +++ b/Marlin/example_configurations/RigidBot/Configuration.h @@ -120,6 +120,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 // Single extruder. Set to 2 for dual extruders +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index b16745e51..e401ae888 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -145,6 +145,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/TAZ4/Configuration.h b/Marlin/example_configurations/TAZ4/Configuration.h index 6bc969327..6cb82b661 100644 --- a/Marlin/example_configurations/TAZ4/Configuration.h +++ b/Marlin/example_configurations/TAZ4/Configuration.h @@ -120,6 +120,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index 1c87153c7..ae2cb6a21 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -123,6 +123,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/adafruit/ST7565/Configuration.h b/Marlin/example_configurations/adafruit/ST7565/Configuration.h index 96619e79c..5d50a8061 100644 --- a/Marlin/example_configurations/adafruit/ST7565/Configuration.h +++ b/Marlin/example_configurations/adafruit/ST7565/Configuration.h @@ -120,6 +120,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration.h b/Marlin/example_configurations/delta/biv2.5/Configuration.h index f041c17ff..aa4765218 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration.h @@ -120,6 +120,9 @@ // :[1,2,3,4] #define EXTRUDERS 2 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index c2dd7084f..4300ccc53 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -120,6 +120,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index b12418733..79a3ea82b 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -120,6 +120,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index 1608e36b7..197aa574c 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -126,6 +126,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration.h b/Marlin/example_configurations/delta/kossel_xl/Configuration.h index 9ac551915..1fb903aba 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration.h @@ -113,6 +113,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index 2fc005342..67faff3fb 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -120,6 +120,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 02c6e6c4d..5498e5540 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -120,6 +120,9 @@ // :[1,2,3,4] #define EXTRUDERS 1 +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index ebebc3bd2..10a503472 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -417,19 +417,29 @@ float Temperature::get_pid_output(int e) { pid_output = pTerm[e] + iTerm[e] - dTerm[e]; + #if ENABLED(SINGLENOZZLE) + #define _NOZZLE_TEST true + #define _NOZZLE_EXTRUDER active_extruder + #define _CTERM_INDEX 0 + #else + #define _NOZZLE_TEST e == active_extruder + #define _NOZZLE_EXTRUDER e + #define _CTERM_INDEX e + #endif + #if ENABLED(PID_ADD_EXTRUSION_RATE) - cTerm[e] = 0; - if (e == active_extruder) { + cTerm[_CTERM_INDEX] = 0; + if (_NOZZLE_TEST) { long e_position = stepper.position(E_AXIS); - if (e_position > last_position[e]) { - lpq[lpq_ptr++] = e_position - last_position[e]; - last_position[e] = e_position; + if (e_position > last_position[_NOZZLE_EXTRUDER]) { + lpq[lpq_ptr++] = e_position - last_position[_NOZZLE_EXTRUDER]; + last_position[_NOZZLE_EXTRUDER] = e_position; } else { lpq[lpq_ptr++] = 0; } if (lpq_ptr >= lpq_len) lpq_ptr = 0; - cTerm[e] = (lpq[lpq_ptr] / planner.axis_steps_per_unit[E_AXIS]) * PID_PARAM(Kc, e); + cTerm[_CTERM_INDEX] = (lpq[lpq_ptr] / planner.axis_steps_per_unit[E_AXIS]) * PID_PARAM(Kc, e); pid_output += cTerm[e]; } #endif //PID_ADD_EXTRUSION_RATE