Merge pull request #6215 from thinkyhead/rc_bed_false_alarm
Fix thermal runaway when nonexistent bed temp is set
This commit is contained in:
commit
289e3d6844
|
@ -522,6 +522,9 @@
|
|||
|
||||
#define HAS_THERMALLY_PROTECTED_BED (HAS_TEMP_BED && HAS_HEATER_BED && ENABLED(THERMAL_PROTECTION_BED))
|
||||
|
||||
#define WATCH_HOTENDS (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0)
|
||||
#define WATCH_THE_BED (HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0)
|
||||
|
||||
/**
|
||||
* This setting is also used by M109 when trying to calculate
|
||||
* a ballpark safe margin to prevent wait-forever situation.
|
||||
|
|
|
@ -104,12 +104,12 @@ uint8_t Temperature::soft_pwm_bed;
|
|||
volatile int Temperature::babystepsTodo[XYZ] = { 0 };
|
||||
#endif
|
||||
|
||||
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
|
||||
#if WATCH_HOTENDS
|
||||
int Temperature::watch_target_temp[HOTENDS] = { 0 };
|
||||
millis_t Temperature::watch_heater_next_ms[HOTENDS] = { 0 };
|
||||
#endif
|
||||
|
||||
#if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
|
||||
#if WATCH_THE_BED
|
||||
int Temperature::watch_target_bed_temp = 0;
|
||||
millis_t Temperature::watch_bed_next_ms = 0;
|
||||
#endif
|
||||
|
@ -690,7 +690,7 @@ void Temperature::manage_heater() {
|
|||
if (current_temperature[0] < max(HEATER_0_MINTEMP, MAX6675_TMIN + 0.01)) min_temp_error(0);
|
||||
#endif
|
||||
|
||||
#if (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0) || (ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0) || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN
|
||||
#if WATCH_HOTENDS || WATCH_THE_BED || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN
|
||||
millis_t ms = millis();
|
||||
#endif
|
||||
|
||||
|
@ -707,7 +707,7 @@ void Temperature::manage_heater() {
|
|||
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
|
||||
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
|
||||
#if WATCH_HOTENDS
|
||||
|
||||
// Is it time to check this extruder's heater?
|
||||
if (watch_heater_next_ms[e] && ELAPSED(ms, watch_heater_next_ms[e])) {
|
||||
|
@ -725,7 +725,7 @@ void Temperature::manage_heater() {
|
|||
#endif // THERMAL_PROTECTION_HOTENDS
|
||||
|
||||
// Check if the temperature is failing to increase
|
||||
#if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
|
||||
#if WATCH_THE_BED
|
||||
|
||||
// Is it time to check the bed?
|
||||
if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) {
|
||||
|
@ -1157,7 +1157,7 @@ void Temperature::init() {
|
|||
#endif //BED_MAXTEMP
|
||||
}
|
||||
|
||||
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
|
||||
#if WATCH_HOTENDS
|
||||
/**
|
||||
* Start Heating Sanity Check for hotends that are below
|
||||
* their target temperature by a configurable margin.
|
||||
|
@ -1176,7 +1176,7 @@ void Temperature::init() {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
|
||||
#if WATCH_THE_BED
|
||||
/**
|
||||
* Start Heating Sanity Check for hotends that are below
|
||||
* their target temperature by a configurable margin.
|
||||
|
|
|
@ -113,12 +113,12 @@ class Temperature {
|
|||
static volatile int babystepsTodo[3];
|
||||
#endif
|
||||
|
||||
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
|
||||
#if WATCH_HOTENDS
|
||||
static int watch_target_temp[HOTENDS];
|
||||
static millis_t watch_heater_next_ms[HOTENDS];
|
||||
#endif
|
||||
|
||||
#if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
|
||||
#if WATCH_THE_BED
|
||||
static int watch_target_bed_temp;
|
||||
static millis_t watch_bed_next_ms;
|
||||
#endif
|
||||
|
@ -306,11 +306,11 @@ class Temperature {
|
|||
}
|
||||
static float degTargetBed() { return target_temperature_bed; }
|
||||
|
||||
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
|
||||
#if WATCH_HOTENDS
|
||||
static void start_watching_heater(uint8_t e = 0);
|
||||
#endif
|
||||
|
||||
#if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
|
||||
#if WATCH_THE_BED
|
||||
static void start_watching_bed();
|
||||
#endif
|
||||
|
||||
|
@ -325,14 +325,14 @@ class Temperature {
|
|||
start_preheat_time(HOTEND_INDEX);
|
||||
#endif
|
||||
target_temperature[HOTEND_INDEX] = celsius;
|
||||
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
|
||||
#if WATCH_HOTENDS
|
||||
start_watching_heater(HOTEND_INDEX);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void setTargetBed(const float& celsius) {
|
||||
target_temperature_bed = celsius;
|
||||
#if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
|
||||
#if WATCH_THE_BED
|
||||
start_watching_bed();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -918,7 +918,7 @@ void kill_screen(const char* lcd_msg) {
|
|||
/**
|
||||
* Watch temperature callbacks
|
||||
*/
|
||||
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
|
||||
#if WATCH_HOTENDS
|
||||
#if TEMP_SENSOR_0 != 0
|
||||
void watch_temp_callback_E0() { thermalManager.start_watching_heater(0); }
|
||||
#endif
|
||||
|
@ -946,15 +946,9 @@ void kill_screen(const char* lcd_msg) {
|
|||
#endif // HOTENDS > 3
|
||||
#endif
|
||||
|
||||
#if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
|
||||
#if TEMP_SENSOR_BED != 0
|
||||
#if WATCH_THE_BED
|
||||
void watch_temp_callback_bed() { thermalManager.start_watching_bed(); }
|
||||
#endif
|
||||
#else
|
||||
#if TEMP_SENSOR_BED != 0
|
||||
void watch_temp_callback_bed() {}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(FILAMENT_CHANGE_FEATURE)
|
||||
void lcd_enqueue_filament_change() {
|
||||
|
@ -1021,7 +1015,7 @@ void kill_screen(const char* lcd_msg) {
|
|||
//
|
||||
// Bed:
|
||||
//
|
||||
#if TEMP_SENSOR_BED != 0
|
||||
#if WATCH_THE_BED
|
||||
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
|
||||
#endif
|
||||
|
||||
|
@ -2180,7 +2174,7 @@ void kill_screen(const char* lcd_msg) {
|
|||
//
|
||||
// Bed:
|
||||
//
|
||||
#if TEMP_SENSOR_BED != 0
|
||||
#if WATCH_THE_BED
|
||||
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue