From 69abfef82e6d076a6f8bcafce373ef0bf156b519 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 20 May 2016 15:45:11 -0700 Subject: [PATCH 1/3] Add "SINGLENOZZLE" extruder option --- Marlin/Configuration.h | 3 +++ Marlin/example_configurations/Felix/Configuration.h | 3 +++ Marlin/example_configurations/Felix/DUAL/Configuration.h | 3 +++ Marlin/example_configurations/Hephestos/Configuration.h | 3 +++ Marlin/example_configurations/Hephestos_2/Configuration.h | 3 +++ Marlin/example_configurations/K8200/Configuration.h | 3 +++ .../RepRapWorld/Megatronics/Configuration.h | 3 +++ Marlin/example_configurations/RigidBot/Configuration.h | 3 +++ Marlin/example_configurations/SCARA/Configuration.h | 3 +++ Marlin/example_configurations/TAZ4/Configuration.h | 3 +++ Marlin/example_configurations/WITBOX/Configuration.h | 3 +++ Marlin/example_configurations/adafruit/ST7565/Configuration.h | 3 +++ Marlin/example_configurations/delta/biv2.5/Configuration.h | 3 +++ Marlin/example_configurations/delta/generic/Configuration.h | 3 +++ .../example_configurations/delta/kossel_mini/Configuration.h | 3 +++ Marlin/example_configurations/delta/kossel_pro/Configuration.h | 3 +++ Marlin/example_configurations/delta/kossel_xl/Configuration.h | 3 +++ Marlin/example_configurations/makibox/Configuration.h | 3 +++ Marlin/example_configurations/tvrrug/Round2/Configuration.h | 3 +++ 19 files changed, 57 insertions(+) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 15bfd5ef47..2fe035f6cb 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/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 36c1239da8..f8c84739d9 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 55e068957a..db8d390c66 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 d5b6ed0b24..e2bb15834a 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 7b9849bacb..daf41cfbf4 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 e99d4dd01a..9037af19f5 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 2d3067c6d7..b145d9a5a7 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 d1522c3fa7..2768283416 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 13c484ac1f..522760893d 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 0da46efdd8..cebbcc137c 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 ae59c5d15c..8553ac7003 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 638ce4032e..b1f19d42a6 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 4560cd8b93..55f99dc410 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 e2e9227b37..b92ee7daec 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 4729e39be3..080268d6b6 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 a37bced783..3f98ab105a 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 c23b546ab2..8af8a844ef 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 db34f1ab00..bc5c1317fe 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 9e85c919d8..eb3759e378 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. From 92ac133f2b6c788636ec3f57bb8dd95d81c14d23 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 20 May 2016 15:48:27 -0700 Subject: [PATCH 2/3] Conditionals and Sanity Check for SINGLENOZZLE --- Marlin/Conditionals.h | 10 ++++++++++ Marlin/SanityCheck.h | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index 4583a0a5fb..386f836d22 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/SanityCheck.h b/Marlin/SanityCheck.h index c499c2c967..3a6e6a895c 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 From 0c7c45063be83d4e01dfb3ed61f3cf8142d10cec Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 20 May 2016 15:57:51 -0700 Subject: [PATCH 3/3] PID_ADD_EXTRUSION_RATE based on MarlinKimbra --- Marlin/temperature.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index ebebc3bd2c..10a5034727 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