Move and update heated chamber settings (#13671)

Co-Authored-By: the-real-orca <stephan.veigl@gmail.com>
This commit is contained in:
Stephan
2019-04-12 22:38:10 +02:00
committed by Scott Lahteine
parent 62b4265410
commit 84273557f9
176 changed files with 1255 additions and 756 deletions

View File

@ -391,7 +391,6 @@
#define TEMP_SENSOR_5 0
#define TEMP_SENSOR_BED 0
#define TEMP_SENSOR_CHAMBER 0
#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system
// Dummy thermistor constant temperature readings, for use with 998 and 999
#define DUMMY_THERMISTOR_998_VALUE 25
@ -410,8 +409,6 @@
#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
// Below this temperature the heater will be switched off
// because it probably indicates a broken thermistor wire.
#define HEATER_0_MINTEMP 5
@ -421,7 +418,6 @@
#define HEATER_4_MINTEMP 5
#define HEATER_5_MINTEMP 5
#define BED_MINTEMP 5
#define CHAMBER_MINTEMP 5
// Above this temperature the heater will be switched off.
// This can protect components from overheating, but NOT from shorts and failures.
@ -433,7 +429,6 @@
#define HEATER_4_MAXTEMP 275
#define HEATER_5_MAXTEMP 275
#define BED_MAXTEMP 150
#define CHAMBER_MAXTEMP 100
//===========================================================================
//============================= PID Settings ================================
@ -476,7 +471,7 @@
#endif // PIDTEMP
//===========================================================================
//============================= PID > Bed Temperature Control ===============
//====================== PID > Bed Temperature Control ======================
//===========================================================================
/**

View File

@ -50,6 +50,19 @@
#define HEATER_BED_INVERTING true
#endif
/**
* Heated Chamber settings
*/
#if TEMP_SENSOR_CHAMBER
#define CHAMBER_MINTEMP 5
#define CHAMBER_MAXTEMP 60
#define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target
#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber
//#define CHAMBER_LIMIT_SWITCHING
//#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin
//#define HEATER_CHAMBER_INVERTING false
#endif
#if DISABLED(PIDTEMPBED)
#define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control
#if ENABLED(BED_LIMIT_SWITCHING)
@ -127,8 +140,8 @@
#endif
#if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated.
// Add an experimental additional term to the heater power, proportional to the extrusion speed.
// A well-chosen Kc value should add just enough power to melt the increased material volume.
//#define PID_EXTRUSION_SCALING
#if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed)

View File

@ -918,7 +918,7 @@
#define HAS_TEMP_HOTEND (HAS_TEMP_ADC_0 || ENABLED(HEATER_0_USES_MAX6675))
#define HAS_TEMP_BED HAS_TEMP_ADC_BED
#define HAS_TEMP_CHAMBER HAS_TEMP_ADC_CHAMBER
#define HAS_HEATED_CHAMBER (HAS_TEMP_CHAMBER && PIN_EXISTS(CHAMBER_HEATER))
#define HAS_HEATED_CHAMBER (HAS_TEMP_CHAMBER && PIN_EXISTS(HEATER_CHAMBER))
// Heaters
#define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))

View File

@ -343,6 +343,8 @@
#error "MAX6675_SS2 is now MAX6675_SS2_PIN. Please update your configuration and/or pins."
#elif defined(SPINDLE_LASER_ENABLE_PIN)
#error "SPINDLE_LASER_ENABLE_PIN is now SPINDLE_LASER_ENA_PIN. Please update your configuration and/or pins."
#elif defined(CHAMBER_HEATER_PIN)
#error "CHAMBER_HEATER_PIN is now HEATER_CHAMBER_PIN. Please update your configuration and/or pins."
#elif defined(TMC_Z_CALIBRATION)
#error "TMC_Z_CALIBRATION has been deprecated in favor of Z_STEPPER_AUTO_ALIGN. Please update your configuration."
#elif defined(Z_MIN_PROBE_ENDSTOP)

View File

@ -595,10 +595,23 @@ temp_range_t Temperature::temp_range[HOTENDS] = ARRAY_BY_HOTENDS(sensor_heater_0
Temperature::Temperature() { }
int Temperature::getHeaterPower(const int heater) {
int16_t Temperature::getHeaterPower(const int8_t heater) {
return (
#if HAS_HEATED_CHAMBER
#if HAS_HEATED_BED
heater == -2
#else
heater < 0
#endif
? temp_chamber.soft_pwm_amount :
#endif
#if HAS_HEATED_BED
heater < 0 ? temp_bed.soft_pwm_amount :
#if HAS_HEATED_CHAMBER
heater == -1
#else
heater < 0
#endif
? temp_bed.soft_pwm_amount :
#endif
temp_hotend[heater].soft_pwm_amount
);
@ -1073,11 +1086,11 @@ void Temperature::manage_heater() {
if (WITHIN(temp_chamber.current, CHAMBER_MINTEMP, CHAMBER_MAXTEMP)) {
#if ENABLED(CHAMBER_LIMIT_SWITCHING)
if (temp_chamber.current >= temp_chamber.target + CHAMBER_HYSTERESIS)
if (temp_chamber.current >= temp_chamber.target + TEMP_CHAMBER_HYSTERESIS)
temp_chamber.soft_pwm_amount = 0;
else if (temp_chamber.current <= temp_chamber.target - (CHAMBER_HYSTERESIS))
else if (temp_chamber.current <= temp_chamber.target - (TEMP_CHAMBER_HYSTERESIS))
temp_chamber.soft_pwm_amount = MAX_CHAMBER_POWER >> 1;
#else // !PIDTEMPCHAMBER && !CHAMBER_LIMIT_SWITCHING
#else
temp_chamber.soft_pwm_amount = temp_chamber.current < temp_chamber.target ? MAX_CHAMBER_POWER >> 1 : 0;
#endif
}
@ -2017,11 +2030,7 @@ void Temperature::readings_ready() {
#else
#define CHAMBERCMP(A,B) ((A)>=(B))
#endif
const bool chamber_on = (temp_chamber.target > 0)
#if ENABLED(PIDTEMPCHAMBER)
|| (temp_chamber.soft_pwm_amount > 0)
#endif
;
const bool chamber_on = (temp_chamber.target > 0);
if (CHAMBERCMP(temp_chamber.raw, maxtemp_raw_CHAMBER)) max_temp_error(-2);
if (chamber_on && CHAMBERCMP(mintemp_raw_CHAMBER, temp_chamber.raw)) min_temp_error(-2);
#endif
@ -2602,11 +2611,12 @@ void Temperature::isr() {
, e
);
#endif
SERIAL_ECHOPGM(" @:");
SERIAL_ECHO(getHeaterPower(target_extruder));
SERIAL_ECHOPAIR(" @:", getHeaterPower(target_extruder));
#if HAS_HEATED_BED
SERIAL_ECHOPGM(" B@:");
SERIAL_ECHO(getHeaterPower(-1));
SERIAL_ECHOPAIR(" B@:", getHeaterPower(-1));
#endif
#if HAS_HEATED_CHAMBER
SERIAL_ECHOPAIR(" C@:", getHeaterPower(-2));
#endif
#if HOTENDS > 1
HOTEND_LOOP() {

View File

@ -206,16 +206,10 @@ struct PIDHeaterInfo : public HeaterInfo {
typedef heater_info_t bed_info_t;
#endif
#endif
#if HAS_TEMP_CHAMBER
#if HAS_HEATED_CHAMBER
#if ENABLED(PIDTEMPCHAMBER)
typedef struct PIDHeaterInfo<PID_t> chamber_info_t;
#else
typedef heater_info_t chamber_info_t;
#endif
#else
typedef temp_info_t chamber_info_t;
#endif
#if HAS_HEATED_CHAMBER
typedef heater_info_t chamber_info_t;
#elif HAS_TEMP_CHAMBER
typedef temp_info_t chamber_info_t;
#endif
// Heater idle handling
@ -339,9 +333,7 @@ class Temperature {
#if WATCH_CHAMBER
static heater_watch_t watch_chamber;
#endif
#if DISABLED(PIDTEMPCHAMBER)
static millis_t next_chamber_check_ms;
#endif
static millis_t next_chamber_check_ms;
#ifdef CHAMBER_MINTEMP
static int16_t mintemp_raw_CHAMBER;
#endif
@ -653,7 +645,7 @@ class Temperature {
/**
* The software PWM power for a heater
*/
static int getHeaterPower(const int heater);
static int16_t getHeaterPower(const int8_t heater);
/**
* Switch off all heaters, set all target temperatures to 0