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

@ -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