Chamber Fan mode 3 (#21594)

This commit is contained in:
Giuliano Zaro 2021-04-13 03:28:13 +02:00 committed by GitHub
parent 4044ed8783
commit 7f56538602
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -163,7 +163,7 @@
//#define CHAMBER_FAN // Enable a fan on the chamber //#define CHAMBER_FAN // Enable a fan on the chamber
#if ENABLED(CHAMBER_FAN) #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 #if CHAMBER_FAN_MODE == 0
#define CHAMBER_FAN_BASE 255 // Chamber fan PWM (0-255) #define CHAMBER_FAN_BASE 255 // Chamber fan PWM (0-255)
#elif CHAMBER_FAN_MODE == 1 #elif CHAMBER_FAN_MODE == 1
@ -172,6 +172,9 @@
#elif CHAMBER_FAN_MODE == 2 #elif CHAMBER_FAN_MODE == 2
#define CHAMBER_FAN_BASE 128 // Minimum chamber fan PWM (0-255) #define CHAMBER_FAN_BASE 128 // Minimum chamber fan PWM (0-255)
#define CHAMBER_FAN_FACTOR 25 // PWM increase per °C difference from target #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
#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); fan_chamber_pwm = (CHAMBER_FAN_BASE) + (CHAMBER_FAN_FACTOR) * ABS(temp_chamber.celsius - temp_chamber.target);
if (temp_chamber.soft_pwm_amount) if (temp_chamber.soft_pwm_amount)
fan_chamber_pwm += (CHAMBER_FAN_FACTOR) * 2; 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 #endif
NOMORE(fan_chamber_pwm, 225); NOMORE(fan_chamber_pwm, 225);
set_fan_speed(2, fan_chamber_pwm); // TODO: instead of fan 2, set to chamber fan set_fan_speed(2, fan_chamber_pwm); // TODO: instead of fan 2, set to chamber fan