Skip to content

Commit

Permalink
Chamber vent/fan followup
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Oct 16, 2020
1 parent 9cc6297 commit 6f69011
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1210,13 +1210,13 @@ void Temperature::manage_heater() {
#if CHAMBER_FAN_MODE == 0
fan_chamber_pwm = CHAMBER_FAN_BASE
#elif CHAMBER_FAN_MODE == 1
fan_chamber_pwm = temp_chamber.celsius > temp_chamber.target ? CHAMBER_FAN_BASE + ((temp_chamber.celsius - temp_chamber.target) * CHAMBER_FAN_FACTOR ) : 0;
fan_chamber_pwm = (temp_chamber.celsius > temp_chamber.target) ? (CHAMBER_FAN_BASE) + (CHAMBER_FAN_FACTOR) * (temp_chamber.celsius - temp_chamber.target) : 0;
#elif CHAMBER_FAN_MODE == 2
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;
#endif
fan_chamber_pwm = _MIN(225, fan_chamber_pwm);
NOMORE(fan_chamber_pwm, 225);
thermalManager.set_fan_speed(2, fan_chamber_pwm); // TODO: instead of fan 2, set to chamber fan
#endif

Expand Down Expand Up @@ -1261,7 +1261,13 @@ void Temperature::manage_heater() {
next_chamber_check_ms = ms + CHAMBER_CHECK_INTERVAL;

if (WITHIN(temp_chamber.celsius, CHAMBER_MINTEMP, CHAMBER_MAXTEMP)) {
if (!flag_chamber_excess_heat){
if (flag_chamber_excess_heat) {
temp_chamber.soft_pwm_amount = 0;
#if ENABLED(CHAMBER_VENT)
if (!flag_chamber_off) MOVE_SERVO(CHAMBER_VENT_SERVO_NR, temp_chamber.celsius <= temp_chamber.target ? 0 : 90);
#endif
}
else {
#if ENABLED(CHAMBER_LIMIT_SWITCHING)
if (temp_chamber.celsius >= temp_chamber.target + TEMP_CHAMBER_HYSTERESIS)
temp_chamber.soft_pwm_amount = 0;
Expand All @@ -1274,12 +1280,6 @@ void Temperature::manage_heater() {
if (!flag_chamber_off) MOVE_SERVO(CHAMBER_VENT_SERVO_NR, 0);
#endif
}
else {
temp_chamber.soft_pwm_amount = 0;
#if ENABLED(CHAMBER_VENT)
if (!flag_chamber_off) MOVE_SERVO(CHAMBER_VENT_SERVO_NR, temp_chamber.celsius <= temp_chamber.target ? 0 : 90);
#endif
}
}
else {
temp_chamber.soft_pwm_amount = 0;
Expand Down

0 comments on commit 6f69011

Please sign in to comment.