|
@ -382,7 +382,7 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY, |
|
|
chamber_info_t Temperature::temp_chamber; // = { 0 }
|
|
|
chamber_info_t Temperature::temp_chamber; // = { 0 }
|
|
|
#if HAS_HEATED_CHAMBER |
|
|
#if HAS_HEATED_CHAMBER |
|
|
millis_t next_cool_check_ms_2 = 0; |
|
|
millis_t next_cool_check_ms_2 = 0; |
|
|
float old_temp = 9999; |
|
|
celsius_float_t old_temp = 9999; |
|
|
int16_t Temperature::mintemp_raw_CHAMBER = TEMP_SENSOR_CHAMBER_RAW_LO_TEMP, |
|
|
int16_t Temperature::mintemp_raw_CHAMBER = TEMP_SENSOR_CHAMBER_RAW_LO_TEMP, |
|
|
Temperature::maxtemp_raw_CHAMBER = TEMP_SENSOR_CHAMBER_RAW_HI_TEMP; |
|
|
Temperature::maxtemp_raw_CHAMBER = TEMP_SENSOR_CHAMBER_RAW_HI_TEMP; |
|
|
TERN_(WATCH_CHAMBER, chamber_watch_t Temperature::watch_chamber{0}); |
|
|
TERN_(WATCH_CHAMBER, chamber_watch_t Temperature::watch_chamber{0}); |
|
@ -395,7 +395,7 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY, |
|
|
#if HAS_COOLER |
|
|
#if HAS_COOLER |
|
|
bool flag_cooler_state; |
|
|
bool flag_cooler_state; |
|
|
//bool flag_cooler_excess = false;
|
|
|
//bool flag_cooler_excess = false;
|
|
|
float previous_temp = 9999; |
|
|
celsius_float_t previous_temp = 9999; |
|
|
int16_t Temperature::mintemp_raw_COOLER = TEMP_SENSOR_COOLER_RAW_LO_TEMP, |
|
|
int16_t Temperature::mintemp_raw_COOLER = TEMP_SENSOR_COOLER_RAW_LO_TEMP, |
|
|
Temperature::maxtemp_raw_COOLER = TEMP_SENSOR_COOLER_RAW_HI_TEMP; |
|
|
Temperature::maxtemp_raw_COOLER = TEMP_SENSOR_COOLER_RAW_HI_TEMP; |
|
|
#if WATCH_COOLER |
|
|
#if WATCH_COOLER |
|
@ -421,8 +421,8 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY, |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) |
|
|
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) |
|
|
celsius_t Temperature::redundant_temperature_raw = 0; |
|
|
int16_t Temperature::redundant_temperature_raw = 0; |
|
|
float Temperature::redundant_temperature = 0.0; |
|
|
celsius_float_t Temperature::redundant_temperature = 0.0; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
volatile bool Temperature::raw_temps_ready = false; |
|
|
volatile bool Temperature::raw_temps_ready = false; |
|
@ -508,7 +508,7 @@ volatile bool Temperature::raw_temps_ready = false; |
|
|
long t_high = 0, t_low = 0; |
|
|
long t_high = 0, t_low = 0; |
|
|
|
|
|
|
|
|
PID_t tune_pid = { 0, 0, 0 }; |
|
|
PID_t tune_pid = { 0, 0, 0 }; |
|
|
float maxT = 0, minT = 10000; |
|
|
celsius_float_t maxT = 0, minT = 10000; |
|
|
|
|
|
|
|
|
const bool isbed = (heater_id == H_BED); |
|
|
const bool isbed = (heater_id == H_BED); |
|
|
const bool ischamber = (heater_id == H_CHAMBER); |
|
|
const bool ischamber = (heater_id == H_CHAMBER); |
|
@ -544,9 +544,9 @@ volatile bool Temperature::raw_temps_ready = false; |
|
|
#define GTV(C,B,H) C_GTV(ischamber, C, B_GTV(isbed, B, H)) |
|
|
#define GTV(C,B,H) C_GTV(ischamber, C, B_GTV(isbed, B, H)) |
|
|
const uint16_t watch_temp_period = GTV(WATCH_CHAMBER_TEMP_PERIOD, WATCH_BED_TEMP_PERIOD, WATCH_TEMP_PERIOD); |
|
|
const uint16_t watch_temp_period = GTV(WATCH_CHAMBER_TEMP_PERIOD, WATCH_BED_TEMP_PERIOD, WATCH_TEMP_PERIOD); |
|
|
const uint8_t watch_temp_increase = GTV(WATCH_CHAMBER_TEMP_INCREASE, WATCH_BED_TEMP_INCREASE, WATCH_TEMP_INCREASE); |
|
|
const uint8_t watch_temp_increase = GTV(WATCH_CHAMBER_TEMP_INCREASE, WATCH_BED_TEMP_INCREASE, WATCH_TEMP_INCREASE); |
|
|
const float watch_temp_target = target - float(watch_temp_increase + GTV(TEMP_CHAMBER_HYSTERESIS, TEMP_BED_HYSTERESIS, TEMP_HYSTERESIS) + 1); |
|
|
const celsius_float_t watch_temp_target = celsius_float_t(target - watch_temp_increase + GTV(TEMP_CHAMBER_HYSTERESIS, TEMP_BED_HYSTERESIS, TEMP_HYSTERESIS) + 1); |
|
|
millis_t temp_change_ms = next_temp_ms + SEC_TO_MS(watch_temp_period); |
|
|
millis_t temp_change_ms = next_temp_ms + SEC_TO_MS(watch_temp_period); |
|
|
float next_watch_temp = 0.0; |
|
|
celsius_float_t next_watch_temp = 0.0; |
|
|
bool heated = false; |
|
|
bool heated = false; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
@ -567,7 +567,7 @@ volatile bool Temperature::raw_temps_ready = false; |
|
|
SHV(bias); |
|
|
SHV(bias); |
|
|
|
|
|
|
|
|
#if ENABLED(PRINTER_EVENT_LEDS) |
|
|
#if ENABLED(PRINTER_EVENT_LEDS) |
|
|
const float start_temp = GHV(temp_chamber.celsius, temp_bed.celsius, temp_hotend[heater_id].celsius); |
|
|
const celsius_float_t start_temp = GHV(temp_chamber.celsius, temp_bed.celsius, temp_hotend[heater_id].celsius); |
|
|
LEDColor color = ONHEATINGSTART(); |
|
|
LEDColor color = ONHEATINGSTART(); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
@ -2338,7 +2338,7 @@ void Temperature::init() { |
|
|
* |
|
|
* |
|
|
* TODO: Embed the last 3 parameters during init, if not less optimal |
|
|
* TODO: Embed the last 3 parameters during init, if not less optimal |
|
|
*/ |
|
|
*/ |
|
|
void Temperature::tr_state_machine_t::run(const_float_t current, const_float_t target, const heater_id_t heater_id, const uint16_t period_seconds, const celsius_t hysteresis_degc) { |
|
|
void Temperature::tr_state_machine_t::run(const_celsius_float_t current, const_celsius_float_t target, const heater_id_t heater_id, const uint16_t period_seconds, const celsius_t hysteresis_degc) { |
|
|
|
|
|
|
|
|
#if HEATER_IDLE_HANDLER |
|
|
#if HEATER_IDLE_HANDLER |
|
|
// Convert the given heater_id_t to an idle array index
|
|
|
// Convert the given heater_id_t to an idle array index
|
|
@ -3373,7 +3373,16 @@ void Temperature::isr() { |
|
|
|
|
|
|
|
|
#include "../gcode/gcode.h" |
|
|
#include "../gcode/gcode.h" |
|
|
|
|
|
|
|
|
static void print_heater_state(const_float_t c, const_float_t t |
|
|
/**
|
|
|
|
|
|
* Print a single heater state in the form: |
|
|
|
|
|
* Bed: " B:nnn.nn /nnn.nn" |
|
|
|
|
|
* Chamber: " C:nnn.nn /nnn.nn" |
|
|
|
|
|
* Probe: " P:nnn.nn /nnn.nn" |
|
|
|
|
|
* Cooler: " L:nnn.nn /nnn.nn" |
|
|
|
|
|
* Extruder: " T0:nnn.nn /nnn.nn" |
|
|
|
|
|
* With ADC: " T0:nnn.nn /nnn.nn (nnn.nn)" |
|
|
|
|
|
*/ |
|
|
|
|
|
static void print_heater_state(const_celsius_float_t c, const_celsius_float_t t |
|
|
#if ENABLED(SHOW_TEMP_ADC_VALUES) |
|
|
#if ENABLED(SHOW_TEMP_ADC_VALUES) |
|
|
, const float r |
|
|
, const float r |
|
|
#endif |
|
|
#endif |
|
@ -3557,12 +3566,12 @@ void Temperature::isr() { |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(PRINTER_EVENT_LEDS) |
|
|
#if ENABLED(PRINTER_EVENT_LEDS) |
|
|
const float start_temp = degHotend(target_extruder); |
|
|
const celsius_float_t start_temp = degHotend(target_extruder); |
|
|
printerEventLEDs.onHotendHeatingStart(); |
|
|
printerEventLEDs.onHotendHeatingStart(); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
bool wants_to_cool = false; |
|
|
bool wants_to_cool = false; |
|
|
float target_temp = -1.0, old_temp = 9999.0; |
|
|
celsius_float_t target_temp = -1.0, old_temp = 9999.0; |
|
|
millis_t now, next_temp_ms = 0, next_cool_check_ms = 0; |
|
|
millis_t now, next_temp_ms = 0, next_cool_check_ms = 0; |
|
|
wait_for_heatup = true; |
|
|
wait_for_heatup = true; |
|
|
do { |
|
|
do { |
|
@ -3592,7 +3601,7 @@ void Temperature::isr() { |
|
|
idle(); |
|
|
idle(); |
|
|
gcode.reset_stepper_timeout(); // Keep steppers powered
|
|
|
gcode.reset_stepper_timeout(); // Keep steppers powered
|
|
|
|
|
|
|
|
|
const float temp = degHotend(target_extruder); |
|
|
const celsius_float_t temp = degHotend(target_extruder); |
|
|
|
|
|
|
|
|
#if ENABLED(PRINTER_EVENT_LEDS) |
|
|
#if ENABLED(PRINTER_EVENT_LEDS) |
|
|
// Gradually change LED strip from violet to red as nozzle heats up
|
|
|
// Gradually change LED strip from violet to red as nozzle heats up
|
|
@ -3601,7 +3610,7 @@ void Temperature::isr() { |
|
|
|
|
|
|
|
|
#if TEMP_RESIDENCY_TIME > 0 |
|
|
#if TEMP_RESIDENCY_TIME > 0 |
|
|
|
|
|
|
|
|
const float temp_diff = ABS(target_temp - temp); |
|
|
const celsius_float_t temp_diff = ABS(target_temp - temp); |
|
|
|
|
|
|
|
|
if (!residency_start_ms) { |
|
|
if (!residency_start_ms) { |
|
|
// Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time.
|
|
|
// Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time.
|
|
@ -3695,12 +3704,12 @@ void Temperature::isr() { |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(PRINTER_EVENT_LEDS) |
|
|
#if ENABLED(PRINTER_EVENT_LEDS) |
|
|
const float start_temp = degBed(); |
|
|
const celsius_float_t start_temp = degBed(); |
|
|
printerEventLEDs.onBedHeatingStart(); |
|
|
printerEventLEDs.onBedHeatingStart(); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
bool wants_to_cool = false; |
|
|
bool wants_to_cool = false; |
|
|
float target_temp = -1, old_temp = 9999; |
|
|
celsius_float_t target_temp = -1, old_temp = 9999; |
|
|
millis_t now, next_temp_ms = 0, next_cool_check_ms = 0; |
|
|
millis_t now, next_temp_ms = 0, next_cool_check_ms = 0; |
|
|
wait_for_heatup = true; |
|
|
wait_for_heatup = true; |
|
|
do { |
|
|
do { |
|
@ -3730,7 +3739,7 @@ void Temperature::isr() { |
|
|
idle(); |
|
|
idle(); |
|
|
gcode.reset_stepper_timeout(); // Keep steppers powered
|
|
|
gcode.reset_stepper_timeout(); // Keep steppers powered
|
|
|
|
|
|
|
|
|
const float temp = degBed(); |
|
|
const celsius_float_t temp = degBed(); |
|
|
|
|
|
|
|
|
#if ENABLED(PRINTER_EVENT_LEDS) |
|
|
#if ENABLED(PRINTER_EVENT_LEDS) |
|
|
// Gradually change LED strip from blue to violet as bed heats up
|
|
|
// Gradually change LED strip from blue to violet as bed heats up
|
|
@ -3739,7 +3748,7 @@ void Temperature::isr() { |
|
|
|
|
|
|
|
|
#if TEMP_BED_RESIDENCY_TIME > 0 |
|
|
#if TEMP_BED_RESIDENCY_TIME > 0 |
|
|
|
|
|
|
|
|
const float temp_diff = ABS(target_temp - temp); |
|
|
const celsius_float_t temp_diff = ABS(target_temp - temp); |
|
|
|
|
|
|
|
|
if (!residency_start_ms) { |
|
|
if (!residency_start_ms) { |
|
|
// Start the TEMP_BED_RESIDENCY_TIME timer when we reach target temp for the first time.
|
|
|
// Start the TEMP_BED_RESIDENCY_TIME timer when we reach target temp for the first time.
|
|
@ -4021,11 +4030,11 @@ void Temperature::isr() { |
|
|
idle(); |
|
|
idle(); |
|
|
gcode.reset_stepper_timeout(); // Keep steppers powered
|
|
|
gcode.reset_stepper_timeout(); // Keep steppers powered
|
|
|
|
|
|
|
|
|
const float current_temp = degCooler(); |
|
|
const celsius_float_t current_temp = degCooler(); |
|
|
|
|
|
|
|
|
#if TEMP_COOLER_RESIDENCY_TIME > 0 |
|
|
#if TEMP_COOLER_RESIDENCY_TIME > 0 |
|
|
|
|
|
|
|
|
const float temp_diff = ABS(target_temp - temp); |
|
|
const celsius_float_t temp_diff = ABS(target_temp - temp); |
|
|
|
|
|
|
|
|
if (!residency_start_ms) { |
|
|
if (!residency_start_ms) { |
|
|
// Start the TEMP_COOLER_RESIDENCY_TIME timer when we reach target temp for the first time.
|
|
|
// Start the TEMP_COOLER_RESIDENCY_TIME timer when we reach target temp for the first time.
|
|
|