From e55e65d1e430355a971df027fc3245f84ecc2c77 Mon Sep 17 00:00:00 2001 From: CONSULitAS Date: Mon, 18 May 2015 22:26:17 +0200 Subject: [PATCH 1/3] =?UTF-8?q?planner.cpp:=20Add=20FAN=5FMIN=5FPWM=20for?= =?UTF-8?q?=20slow=20fan=20stopping=20issue=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @CONSULitAS planner.cpp: Add FAN_MIN_PWM for slow fan stopping issue (V2.1 with macro and linear scaling) @thinkyhead thanks for idea on linear scaling --- Marlin/planner.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index 0a45ff38d9..4ecd459999 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -440,12 +440,17 @@ void check_axes_activity() { } else { fan_kick_end = 0; } - #endif//FAN_KICKSTART_TIME - #ifdef FAN_SOFT_PWM - fanSpeedSoftPwm = tail_fan_speed; + #endif //FAN_KICKSTART_TIME + #ifdef FAN_MIN_PWM + #define CALC_FAN_SPEED (tail_fan_speed ? ( FAN_MIN_PWM + (tail_fan_speed * (255 - FAN_MIN_PWM)) / 255 ) : 0) #else - analogWrite(FAN_PIN, tail_fan_speed); - #endif //!FAN_SOFT_PWM + #define CALC_FAN_SPEED tail_fan_speed + #endif // FAN_MIN_PWM + #ifdef FAN_SOFT_PWM + fanSpeedSoftPwm = CALC_FAN_SPEED; + #else + analogWrite(FAN_PIN, CALC_FAN_SPEED); + #endif // FAN_SOFT_PWM #endif // HAS_FAN #ifdef AUTOTEMP From 3a5963c0e7db86c775855438c08da588a3cba03f Mon Sep 17 00:00:00 2001 From: CONSULitAS Date: Mon, 18 May 2015 22:31:51 +0200 Subject: [PATCH 2/3] =?UTF-8?q?Configuration=5Fadv.h:=20Add=20FAN=5FMIN=5F?= =?UTF-8?q?PWM=20for=20slow=20fan=20stopping=20issue=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * all Configuration_adv.h: Add #define FAN_MIN_PWM for slow fan stopping issue * for K8200: uncommented with tested (and working) values --- Marlin/Configuration_adv.h | 5 +++++ Marlin/example_configurations/Felix/Configuration_adv.h | 5 +++++ Marlin/example_configurations/Hephestos/Configuration_adv.h | 5 +++++ Marlin/example_configurations/K8200/Configuration_adv.h | 5 +++++ Marlin/example_configurations/SCARA/Configuration_adv.h | 5 +++++ Marlin/example_configurations/WITBOX/Configuration_adv.h | 5 +++++ .../example_configurations/delta/biv2.5/Configuration_adv.h | 5 +++++ .../example_configurations/delta/generic/Configuration_adv.h | 5 +++++ .../delta/kossel_mini/Configuration_adv.h | 5 +++++ Marlin/example_configurations/makibox/Configuration_adv.h | 5 +++++ .../example_configurations/tvrrug/Round2/Configuration_adv.h | 5 +++++ 11 files changed, 55 insertions(+) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 2d510941eb..1e63007e57 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -94,6 +94,11 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// This defines the minimal speed for the main fan, run in PWM mode +// to enable uncomment and set minimal PWM speed for reliable running (1-255) +// if fan speed is [1 - (FAN_MIN_PWM-1)] it is set to FAN_MIN_PWM +//#define FAN_MIN_PWM 50 + // @section extruder // Extruder cooling fans diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index a2f8f4b2aa..50d08513f4 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -102,6 +102,11 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// This defines the minimal speed for the main fan, run in PWM mode +// to enable uncomment and set minimal PWM speed for reliable running (1-255) +// if fan speed is [1 - (FAN_MIN_PWM-1)] it is set to FAN_MIN_PWM +//#define FAN_MIN_PWM 50 + // @section extruder // Extruder cooling fans diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index d6ae0f3f83..9e15f9670a 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -102,6 +102,11 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// This defines the minimal speed for the main fan, run in PWM mode +// to enable uncomment and set minimal PWM speed for reliable running (1-255) +// if fan speed is [1 - (FAN_MIN_PWM-1)] it is set to FAN_MIN_PWM +//#define FAN_MIN_PWM 50 + // @section extruder // Extruder cooling fans diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index a2f8f4b2aa..1a01063850 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -102,6 +102,11 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// This defines the minimal speed for the main fan, run in PWM mode +// to enable uncomment and set minimal PWM speed for reliable running (1-255) +// if fan speed is [1 - (FAN_MIN_PWM-1)] it is set to FAN_MIN_PWM +#define FAN_MIN_PWM 50 // K8200: fan stops running at about 35 to 40 (of 255) + // @section extruder // Extruder cooling fans diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 863148e70e..0405aaa2f5 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -102,6 +102,11 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// This defines the minimal speed for the main fan, run in PWM mode +// to enable uncomment and set minimal PWM speed for reliable running (1-255) +// if fan speed is [1 - (FAN_MIN_PWM-1)] it is set to FAN_MIN_PWM +//#define FAN_MIN_PWM 50 + // @section extruder // Extruder cooling fans diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index ca3c783bc7..597cf4aca1 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -102,6 +102,11 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// This defines the minimal speed for the main fan, run in PWM mode +// to enable uncomment and set minimal PWM speed for reliable running (1-255) +// if fan speed is [1 - (FAN_MIN_PWM-1)] it is set to FAN_MIN_PWM +//#define FAN_MIN_PWM 50 + // @section extruder // Extruder cooling fans diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index 2b2acc81f6..aaa0f796a3 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -102,6 +102,11 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// This defines the minimal speed for the main fan, run in PWM mode +// to enable uncomment and set minimal PWM speed for reliable running (1-255) +// if fan speed is [1 - (FAN_MIN_PWM-1)] it is set to FAN_MIN_PWM +//#define FAN_MIN_PWM 50 + // @section extruder // Extruder cooling fans diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index 3848f97617..30d9720227 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -102,6 +102,11 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// This defines the minimal speed for the main fan, run in PWM mode +// to enable uncomment and set minimal PWM speed for reliable running (1-255) +// if fan speed is [1 - (FAN_MIN_PWM-1)] it is set to FAN_MIN_PWM +//#define FAN_MIN_PWM 50 + // @section extruder // Extruder cooling fans diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index 5f262c2ada..f70c6cd6cb 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -102,6 +102,11 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// This defines the minimal speed for the main fan, run in PWM mode +// to enable uncomment and set minimal PWM speed for reliable running (1-255) +// if fan speed is [1 - (FAN_MIN_PWM-1)] it is set to FAN_MIN_PWM +//#define FAN_MIN_PWM 50 + // @section extruder // Extruder cooling fans diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 8b50750750..4769e028f9 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -102,6 +102,11 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// This defines the minimal speed for the main fan, run in PWM mode +// to enable uncomment and set minimal PWM speed for reliable running (1-255) +// if fan speed is [1 - (FAN_MIN_PWM-1)] it is set to FAN_MIN_PWM +//#define FAN_MIN_PWM 50 + // @section extruder // Extruder cooling fans diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 962a853dd5..03cb8b19d0 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -102,6 +102,11 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// This defines the minimal speed for the main fan, run in PWM mode +// to enable uncomment and set minimal PWM speed for reliable running (1-255) +// if fan speed is [1 - (FAN_MIN_PWM-1)] it is set to FAN_MIN_PWM +//#define FAN_MIN_PWM 50 + // @section extruder // Extruder cooling fans From 788eb6e64753806bfc326a78c0e272941ec6cc4d Mon Sep 17 00:00:00 2001 From: CONSULitAS Date: Tue, 19 May 2015 08:09:38 +0200 Subject: [PATCH 3/3] planner.cpp: remove tab planner.cpp: single evil and hidden tab removed :recycle: :smirk: --- Marlin/planner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index 4ecd459999..35753a7735 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -441,7 +441,7 @@ void check_axes_activity() { fan_kick_end = 0; } #endif //FAN_KICKSTART_TIME - #ifdef FAN_MIN_PWM + #ifdef FAN_MIN_PWM #define CALC_FAN_SPEED (tail_fan_speed ? ( FAN_MIN_PWM + (tail_fan_speed * (255 - FAN_MIN_PWM)) / 255 ) : 0) #else #define CALC_FAN_SPEED tail_fan_speed