|
|
@ -161,6 +161,14 @@ int Temperature::maxttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_HI_TEMP ,
|
|
|
|
int Temperature::minttemp[HOTENDS] = { 0 };
|
|
|
|
int Temperature::minttemp[HOTENDS] = { 0 };
|
|
|
|
int Temperature::maxttemp[HOTENDS] = ARRAY_BY_HOTENDS1(16383);
|
|
|
|
int Temperature::maxttemp[HOTENDS] = ARRAY_BY_HOTENDS1(16383);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
|
|
|
|
|
|
|
|
int Temperature::consecutive_low_temperature_error[HOTENDS] = { 0 };
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef MILLISECONDS_PREHEAT_TIME
|
|
|
|
|
|
|
|
unsigned long Temperature::preheat_end_time[HOTENDS] = { 0 };
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef BED_MINTEMP
|
|
|
|
#ifdef BED_MINTEMP
|
|
|
|
int Temperature::bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP;
|
|
|
|
int Temperature::bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -685,7 +693,7 @@ void Temperature::manage_heater() {
|
|
|
|
float pid_output = get_pid_output(e);
|
|
|
|
float pid_output = get_pid_output(e);
|
|
|
|
|
|
|
|
|
|
|
|
// Check if temperature is within the correct range
|
|
|
|
// Check if temperature is within the correct range
|
|
|
|
soft_pwm[e] = current_temperature[e] > minttemp[e] && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0;
|
|
|
|
soft_pwm[e] = (current_temperature[e] > minttemp[e] || is_preheating(e)) && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0;
|
|
|
|
|
|
|
|
|
|
|
|
// Check if the temperature is failing to increase
|
|
|
|
// Check if the temperature is failing to increase
|
|
|
|
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
|
|
|
|
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
|
|
|
@ -1746,7 +1754,16 @@ void Temperature::isr() {
|
|
|
|
#define GE0 >=
|
|
|
|
#define GE0 >=
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
if (current_temperature_raw[0] GE0 maxttemp_raw[0]) max_temp_error(0);
|
|
|
|
if (current_temperature_raw[0] GE0 maxttemp_raw[0]) max_temp_error(0);
|
|
|
|
if (minttemp_raw[0] GE0 current_temperature_raw[0]) min_temp_error(0);
|
|
|
|
if (minttemp_raw[0] GE0 current_temperature_raw[0] && !is_preheating(0) && target_temperature[0] > 0.0f) {
|
|
|
|
|
|
|
|
#ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
|
|
|
|
|
|
|
|
if (++consecutive_low_temperature_error[0] >= MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
min_temp_error(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
consecutive_low_temperature_error[0] = 0;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_TEMP_1 && HOTENDS > 1
|
|
|
|
#if HAS_TEMP_1 && HOTENDS > 1
|
|
|
@ -1756,7 +1773,16 @@ void Temperature::isr() {
|
|
|
|
#define GE1 >=
|
|
|
|
#define GE1 >=
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
if (current_temperature_raw[1] GE1 maxttemp_raw[1]) max_temp_error(1);
|
|
|
|
if (current_temperature_raw[1] GE1 maxttemp_raw[1]) max_temp_error(1);
|
|
|
|
if (minttemp_raw[1] GE1 current_temperature_raw[1]) min_temp_error(1);
|
|
|
|
if (minttemp_raw[1] GE1 current_temperature_raw[1] && !is_preheating(1) && target_temperature[1] > 0.0f) {
|
|
|
|
|
|
|
|
#ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
|
|
|
|
|
|
|
|
if (++consecutive_low_temperature_error[1] >= MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
min_temp_error(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
consecutive_low_temperature_error[1] = 0;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif // TEMP_SENSOR_1
|
|
|
|
#endif // TEMP_SENSOR_1
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_TEMP_2 && HOTENDS > 2
|
|
|
|
#if HAS_TEMP_2 && HOTENDS > 2
|
|
|
@ -1766,7 +1792,16 @@ void Temperature::isr() {
|
|
|
|
#define GE2 >=
|
|
|
|
#define GE2 >=
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
if (current_temperature_raw[2] GE2 maxttemp_raw[2]) max_temp_error(2);
|
|
|
|
if (current_temperature_raw[2] GE2 maxttemp_raw[2]) max_temp_error(2);
|
|
|
|
if (minttemp_raw[2] GE2 current_temperature_raw[2]) min_temp_error(2);
|
|
|
|
if (minttemp_raw[2] GE2 current_temperature_raw[2] && !is_preheating(2) && target_temperature[2] > 0.0f) {
|
|
|
|
|
|
|
|
#ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
|
|
|
|
|
|
|
|
if (++consecutive_low_temperature_error[2] >= MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
min_temp_error(2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
consecutive_low_temperature_error[2] = 0;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif // TEMP_SENSOR_2
|
|
|
|
#endif // TEMP_SENSOR_2
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_TEMP_3 && HOTENDS > 3
|
|
|
|
#if HAS_TEMP_3 && HOTENDS > 3
|
|
|
@ -1776,7 +1811,16 @@ void Temperature::isr() {
|
|
|
|
#define GE3 >=
|
|
|
|
#define GE3 >=
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
if (current_temperature_raw[3] GE3 maxttemp_raw[3]) max_temp_error(3);
|
|
|
|
if (current_temperature_raw[3] GE3 maxttemp_raw[3]) max_temp_error(3);
|
|
|
|
if (minttemp_raw[3] GE3 current_temperature_raw[3]) min_temp_error(3);
|
|
|
|
if (minttemp_raw[3] GE3 current_temperature_raw[3] && !is_preheating(3) && target_temperature[3] > 0.0f) {
|
|
|
|
|
|
|
|
#ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
|
|
|
|
|
|
|
|
if (++consecutive_low_temperature_error[3] >= MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
min_temp_error(3);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
consecutive_low_temperature_error[3] = 0;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif // TEMP_SENSOR_3
|
|
|
|
#endif // TEMP_SENSOR_3
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_TEMP_BED
|
|
|
|
#if HAS_TEMP_BED
|
|
|
|