Chamber Fan mode 3 (#21594)

This commit is contained in:
Giuliano Zaro 2021-04-13 03:28:13 +02:00 committed by Scott Lahteine
parent 49fba5a82a
commit 0f7161785e
2 changed files with 6 additions and 1 deletions

View file

@ -163,7 +163,7 @@
//#define CHAMBER_FAN // Enable a fan on the chamber
#if ENABLED(CHAMBER_FAN)
#define CHAMBER_FAN_MODE 2 // Fan control mode: 0=Static; 1=Linear increase when temp is higher than target; 2=V-shaped curve.
#define CHAMBER_FAN_MODE 2 // Fan control mode: 0=Static; 1=Linear increase when temp is higher than target; 2=V-shaped curve; 3=similar to 1 but fan is always on.
#if CHAMBER_FAN_MODE == 0
#define CHAMBER_FAN_BASE 255 // Chamber fan PWM (0-255)
#elif CHAMBER_FAN_MODE == 1
@ -172,6 +172,9 @@
#elif CHAMBER_FAN_MODE == 2
#define CHAMBER_FAN_BASE 128 // Minimum chamber fan PWM (0-255)
#define CHAMBER_FAN_FACTOR 25 // PWM increase per °C difference from target
#elif CHAMBER_FAN_MODE == 3
#define CHAMBER_FAN_BASE 128 // Base chamber fan PWM (0-255)
#define CHAMBER_FAN_FACTOR 25 // PWM increase per °C above target
#endif
#endif

View file

@ -1406,6 +1406,8 @@ void Temperature::manage_heater() {
fan_chamber_pwm = (CHAMBER_FAN_BASE) + (CHAMBER_FAN_FACTOR) * ABS(temp_chamber.celsius - temp_chamber.target);
if (temp_chamber.soft_pwm_amount)
fan_chamber_pwm += (CHAMBER_FAN_FACTOR) * 2;
#elif CHAMBER_FAN_MODE == 3
fan_chamber_pwm = CHAMBER_FAN_BASE + _MAX((CHAMBER_FAN_FACTOR) * (temp_chamber.celsius - temp_chamber.target), 0);
#endif
NOMORE(fan_chamber_pwm, 225);
set_fan_speed(2, fan_chamber_pwm); // TODO: instead of fan 2, set to chamber fan