From 5c44f6c434073180b10859d24bcec45e64b98fcd Mon Sep 17 00:00:00 2001 From: Alex Borro Date: Wed, 27 Nov 2013 23:23:06 -0200 Subject: [PATCH] Bed Heater monitoring in Controller Fan In some cases the Bed Heater FET heats up more then stepper drivers, so this change add the bed monitoring to the controller fan. As soon as the bed heater is turned on, the controller fan will run as well. --- Marlin/Marlin_main.cpp | 2 +- Marlin/temperature.cpp | 4 +++- Marlin/temperature.h | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 1537d3199..8993ca695 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3065,7 +3065,7 @@ void controllerFan() { lastMotorCheck = millis(); - if(!READ(X_ENABLE_PIN) || !READ(Y_ENABLE_PIN) || !READ(Z_ENABLE_PIN) + if(!READ(X_ENABLE_PIN) || !READ(Y_ENABLE_PIN) || !READ(Z_ENABLE_PIN) || (soft_pwm_bed > 0) #if EXTRUDERS > 2 || !READ(E2_ENABLE_PIN) #endif diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 48960488b..29050b84f 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -65,6 +65,8 @@ float current_temperature_bed = 0.0; #ifdef FAN_SOFT_PWM unsigned char fanSpeedSoftPwm; #endif + +unsigned char soft_pwm_bed; #ifdef BABYSTEPPING volatile int babystepsTodo[3]={0,0,0}; @@ -105,7 +107,7 @@ static volatile bool temp_meas_ready = false; static unsigned long previous_millis_bed_heater; #endif //PIDTEMPBED static unsigned char soft_pwm[EXTRUDERS]; - static unsigned char soft_pwm_bed; + #ifdef FAN_SOFT_PWM static unsigned char soft_pwm_fan; #endif diff --git a/Marlin/temperature.h b/Marlin/temperature.h index 1bf47e02e..82de2402f 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -45,6 +45,10 @@ extern float current_temperature_bed; extern float redundant_temperature; #endif +#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1 + extern unsigned char soft_pwm_bed; +#endif + #ifdef PIDTEMP extern float Kp,Ki,Kd,Kc; float scalePID_i(float i);