THERMAL_PROTECTION_GRACE_PERIOD is obsolete (#14798)

This commit is contained in:
Robby Candra 2019-08-06 08:33:15 +07:00 committed by Scott Lahteine
parent 534c105a7a
commit 5bc2fb022c
3 changed files with 8 additions and 33 deletions

View file

@ -146,11 +146,6 @@ using FilteredADC = LPC176x::ADC<ADC_LOWPASS_K_VALUE, ADC_MEDIAN_FILTER_SIZE>;
#define HAL_READ_ADC() FilteredADC::get_result() #define HAL_READ_ADC() FilteredADC::get_result()
#define HAL_ADC_READY() FilteredADC::finished_conversion() #define HAL_ADC_READY() FilteredADC::finished_conversion()
// A grace period to allow ADC readings to stabilize, preventing false alarms
#ifndef THERMAL_PROTECTION_GRACE_PERIOD
#define THERMAL_PROTECTION_GRACE_PERIOD 1000
#endif
// Parse a G-code word into a pin index // Parse a G-code word into a pin index
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval); int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
// P0.6 thru P0.9 are for the onboard SD card // P0.6 thru P0.9 are for the onboard SD card

View file

@ -1137,6 +1137,8 @@ void loop() {
for (;;) { for (;;) {
idle(); // Do an idle first so boot is slightly faster
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
card.checkautostart(); card.checkautostart();
@ -1168,6 +1170,5 @@ void loop() {
if (queue.length < BUFSIZE) queue.get_available_commands(); if (queue.length < BUFSIZE) queue.get_available_commands();
queue.advance(); queue.advance();
endstops.event_handler(); endstops.event_handler();
idle();
} }
} }

View file

@ -82,10 +82,6 @@
#endif #endif
#endif #endif
#ifndef THERMAL_PROTECTION_GRACE_PERIOD
#define THERMAL_PROTECTION_GRACE_PERIOD 0 // No grace period needed on well-behaved boards
#endif
Temperature thermalManager; Temperature thermalManager;
/** /**
@ -1036,18 +1032,9 @@ void Temperature::manage_heater() {
millis_t ms = millis(); millis_t ms = millis();
#endif #endif
#if HAS_THERMAL_PROTECTION
#if THERMAL_PROTECTION_GRACE_PERIOD > 0
static millis_t grace_period = ms + THERMAL_PROTECTION_GRACE_PERIOD;
if (ELAPSED(ms, grace_period)) grace_period = 0UL;
#else
static constexpr millis_t grace_period = 0UL;
#endif
#endif
HOTEND_LOOP() { HOTEND_LOOP() {
#if ENABLED(THERMAL_PROTECTION_HOTENDS) #if ENABLED(THERMAL_PROTECTION_HOTENDS)
if (!grace_period && degHotend(e) > temp_range[e].maxtemp) if (degHotend(e) > temp_range[e].maxtemp)
_temp_error((heater_ind_t)e, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, e)); _temp_error((heater_ind_t)e, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, e));
#endif #endif
@ -1103,7 +1090,7 @@ void Temperature::manage_heater() {
#if HAS_HEATED_BED #if HAS_HEATED_BED
#if ENABLED(THERMAL_PROTECTION_BED) #if ENABLED(THERMAL_PROTECTION_BED)
if (!grace_period && degBed() > BED_MAXTEMP) if (degBed() > BED_MAXTEMP)
_temp_error(H_BED, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, H_BED)); _temp_error(H_BED, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, H_BED));
#endif #endif
@ -1181,7 +1168,7 @@ void Temperature::manage_heater() {
#endif #endif
#if ENABLED(THERMAL_PROTECTION_CHAMBER) #if ENABLED(THERMAL_PROTECTION_CHAMBER)
if (!grace_period && degChamber() > CHAMBER_MAXTEMP) if (degChamber() > CHAMBER_MAXTEMP)
_temp_error(H_CHAMBER, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, H_CHAMBER)); _temp_error(H_CHAMBER, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, H_CHAMBER));
#endif #endif
@ -2224,14 +2211,6 @@ void Temperature::set_current_temp_raw() {
void Temperature::readings_ready() { void Temperature::readings_ready() {
#if THERMAL_PROTECTION_GRACE_PERIOD > 0
const millis_t ms = millis();
static millis_t grace_period = ms + THERMAL_PROTECTION_GRACE_PERIOD; // NOTE: millis() == 0 on reset
if (ELAPSED(ms, grace_period)) grace_period = 0;
#else
static constexpr millis_t grace_period = 0;
#endif
// Update the raw values if they've been read. Else we could be updating them during reading. // Update the raw values if they've been read. Else we could be updating them during reading.
if (!temp_meas_ready) set_current_temp_raw(); if (!temp_meas_ready) set_current_temp_raw();
@ -2250,6 +2229,9 @@ void Temperature::readings_ready() {
temp_chamber.acc = 0; temp_chamber.acc = 0;
#endif #endif
// Give ADC temperature readings time to settle at boot-up before testing
if (grace_period) return;
static constexpr int8_t temp_dir[] = { static constexpr int8_t temp_dir[] = {
#if ENABLED(HEATER_0_USES_MAX6675) #if ENABLED(HEATER_0_USES_MAX6675)
0 0
@ -2277,9 +2259,6 @@ void Temperature::readings_ready() {
#endif // HOTENDS > 1 #endif // HOTENDS > 1
}; };
// Give ADC temperature readings time to settle at boot-up before testing
if (grace_period) return;
for (uint8_t e = 0; e < COUNT(temp_dir); e++) { for (uint8_t e = 0; e < COUNT(temp_dir); e++) {
const int8_t tdir = temp_dir[e]; const int8_t tdir = temp_dir[e];
if (tdir) { if (tdir) {