|
|
@ -111,6 +111,9 @@
|
|
|
|
#include "../libs/buzzer.h"
|
|
|
|
#include "../libs/buzzer.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_SERVOS
|
|
|
|
|
|
|
|
#include "./servo.h"
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#if HOTEND_USES_THERMISTOR
|
|
|
|
#if HOTEND_USES_THERMISTOR
|
|
|
|
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
|
|
|
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
|
|
|
static const temp_entry_t* heater_ttbl_map[2] = { HEATER_0_TEMPTABLE, HEATER_1_TEMPTABLE };
|
|
|
|
static const temp_entry_t* heater_ttbl_map[2] = { HEATER_0_TEMPTABLE, HEATER_1_TEMPTABLE };
|
|
|
@ -271,6 +274,11 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
|
|
|
|
#if HAS_TEMP_CHAMBER
|
|
|
|
#if HAS_TEMP_CHAMBER
|
|
|
|
chamber_info_t Temperature::temp_chamber; // = { 0 }
|
|
|
|
chamber_info_t Temperature::temp_chamber; // = { 0 }
|
|
|
|
#if HAS_HEATED_CHAMBER
|
|
|
|
#if HAS_HEATED_CHAMBER
|
|
|
|
|
|
|
|
int16_t fan_chamber_pwm;
|
|
|
|
|
|
|
|
bool flag_chamber_off;
|
|
|
|
|
|
|
|
bool flag_chamber_excess_heat = false;
|
|
|
|
|
|
|
|
millis_t next_cool_check_ms_2 = 0;
|
|
|
|
|
|
|
|
float old_temp = 9999;
|
|
|
|
#ifdef CHAMBER_MINTEMP
|
|
|
|
#ifdef CHAMBER_MINTEMP
|
|
|
|
int16_t Temperature::mintemp_raw_CHAMBER = HEATER_CHAMBER_RAW_LO_TEMP;
|
|
|
|
int16_t Temperature::mintemp_raw_CHAMBER = HEATER_CHAMBER_RAW_LO_TEMP;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -1194,18 +1202,84 @@ void Temperature::manage_heater() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if EITHER(CHAMBER_FAN, CHAMBER_VENT)
|
|
|
|
|
|
|
|
if (temp_chamber.target > CHAMBER_MINTEMP) {
|
|
|
|
|
|
|
|
flag_chamber_off = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(CHAMBER_FAN)
|
|
|
|
|
|
|
|
#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;
|
|
|
|
|
|
|
|
#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);
|
|
|
|
|
|
|
|
thermalManager.set_fan_speed(2, fan_chamber_pwm); // TODO: instead of fan 2, set to chamber fan
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(CHAMBER_VENT)
|
|
|
|
|
|
|
|
#ifndef MIN_COOLING_SLOPE_TIME_CHAMBER_VENT
|
|
|
|
|
|
|
|
#define MIN_COOLING_SLOPE_TIME_CHAMBER_VENT 20
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MIN_COOLING_SLOPE_DEG_CHAMBER_VENT
|
|
|
|
|
|
|
|
#define MIN_COOLING_SLOPE_DEG_CHAMBER_VENT 1.5
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if( (temp_chamber.celsius - temp_chamber.target >= HIGH_EXCESS_HEAT_LIMIT) && !flag_chamber_excess_heat) {
|
|
|
|
|
|
|
|
// open vent after MIN_COOLING_SLOPE_TIME_CHAMBER_VENT seconds
|
|
|
|
|
|
|
|
// if the temperature did not drop at least MIN_COOLING_SLOPE_DEG_CHAMBER_VENT
|
|
|
|
|
|
|
|
if (next_cool_check_ms_2 == 0 || ELAPSED(ms, next_cool_check_ms_2)) {
|
|
|
|
|
|
|
|
if (old_temp - temp_chamber.celsius < float(MIN_COOLING_SLOPE_DEG_CHAMBER_VENT)) flag_chamber_excess_heat = true; //the bed is heating the chamber too much
|
|
|
|
|
|
|
|
next_cool_check_ms_2 = ms + 1000UL * MIN_COOLING_SLOPE_TIME_CHAMBER_VENT;
|
|
|
|
|
|
|
|
old_temp = temp_chamber.celsius;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
next_cool_check_ms_2 = 0;
|
|
|
|
|
|
|
|
old_temp = 9999;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag_chamber_excess_heat && (temp_chamber.celsius - temp_chamber.target <= -LOW_EXCESS_HEAT_LIMIT) ) {
|
|
|
|
|
|
|
|
flag_chamber_excess_heat = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (!flag_chamber_off) {
|
|
|
|
|
|
|
|
#if ENABLED(CHAMBER_FAN)
|
|
|
|
|
|
|
|
flag_chamber_off = true;
|
|
|
|
|
|
|
|
thermalManager.set_fan_speed(2, 0);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(CHAMBER_VENT)
|
|
|
|
|
|
|
|
flag_chamber_excess_heat = false;
|
|
|
|
|
|
|
|
MOVE_SERVO(CHAMBER_VENT_SERVO_NR, 90);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (ELAPSED(ms, next_chamber_check_ms)) {
|
|
|
|
if (ELAPSED(ms, next_chamber_check_ms)) {
|
|
|
|
next_chamber_check_ms = ms + CHAMBER_CHECK_INTERVAL;
|
|
|
|
next_chamber_check_ms = ms + CHAMBER_CHECK_INTERVAL;
|
|
|
|
|
|
|
|
|
|
|
|
if (WITHIN(temp_chamber.celsius, CHAMBER_MINTEMP, CHAMBER_MAXTEMP)) {
|
|
|
|
if (WITHIN(temp_chamber.celsius, CHAMBER_MINTEMP, CHAMBER_MAXTEMP)) {
|
|
|
|
#if ENABLED(CHAMBER_LIMIT_SWITCHING)
|
|
|
|
if (!flag_chamber_excess_heat){
|
|
|
|
if (temp_chamber.celsius >= temp_chamber.target + TEMP_CHAMBER_HYSTERESIS)
|
|
|
|
#if ENABLED(CHAMBER_LIMIT_SWITCHING)
|
|
|
|
temp_chamber.soft_pwm_amount = 0;
|
|
|
|
if (temp_chamber.celsius >= temp_chamber.target + TEMP_CHAMBER_HYSTERESIS)
|
|
|
|
else if (temp_chamber.celsius <= temp_chamber.target - (TEMP_CHAMBER_HYSTERESIS))
|
|
|
|
temp_chamber.soft_pwm_amount = 0;
|
|
|
|
temp_chamber.soft_pwm_amount = MAX_CHAMBER_POWER >> 1;
|
|
|
|
else if (temp_chamber.celsius <= temp_chamber.target - (TEMP_CHAMBER_HYSTERESIS))
|
|
|
|
#else
|
|
|
|
temp_chamber.soft_pwm_amount = (MAX_CHAMBER_POWER) >> 1;
|
|
|
|
temp_chamber.soft_pwm_amount = temp_chamber.celsius < temp_chamber.target ? MAX_CHAMBER_POWER >> 1 : 0;
|
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
temp_chamber.soft_pwm_amount = temp_chamber.celsius < temp_chamber.target ? (MAX_CHAMBER_POWER) >> 1 : 0;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(CHAMBER_VENT)
|
|
|
|
|
|
|
|
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 {
|
|
|
|
else {
|
|
|
|
temp_chamber.soft_pwm_amount = 0;
|
|
|
|
temp_chamber.soft_pwm_amount = 0;
|
|
|
@ -3370,7 +3444,7 @@ void Temperature::tick() {
|
|
|
|
#define MIN_COOLING_SLOPE_DEG_CHAMBER 1.50
|
|
|
|
#define MIN_COOLING_SLOPE_DEG_CHAMBER 1.50
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifndef MIN_COOLING_SLOPE_TIME_CHAMBER
|
|
|
|
#ifndef MIN_COOLING_SLOPE_TIME_CHAMBER
|
|
|
|
#define MIN_COOLING_SLOPE_TIME_CHAMBER 60
|
|
|
|
#define MIN_COOLING_SLOPE_TIME_CHAMBER 120
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
bool Temperature::wait_for_chamber(const bool no_wait_for_cooling/*=true*/) {
|
|
|
|
bool Temperature::wait_for_chamber(const bool no_wait_for_cooling/*=true*/) {
|
|
|
|