|
@@ -82,10 +82,6 @@
|
82
|
82
|
#endif
|
83
|
83
|
#endif
|
84
|
84
|
|
85
|
|
-#ifndef THERMAL_PROTECTION_GRACE_PERIOD
|
86
|
|
- #define THERMAL_PROTECTION_GRACE_PERIOD 0 // No grace period needed on well-behaved boards
|
87
|
|
-#endif
|
88
|
|
-
|
89
|
85
|
Temperature thermalManager;
|
90
|
86
|
|
91
|
87
|
/**
|
|
@@ -1036,18 +1032,9 @@ void Temperature::manage_heater() {
|
1036
|
1032
|
millis_t ms = millis();
|
1037
|
1033
|
#endif
|
1038
|
1034
|
|
1039
|
|
- #if HAS_THERMAL_PROTECTION
|
1040
|
|
- #if THERMAL_PROTECTION_GRACE_PERIOD > 0
|
1041
|
|
- static millis_t grace_period = ms + THERMAL_PROTECTION_GRACE_PERIOD;
|
1042
|
|
- if (ELAPSED(ms, grace_period)) grace_period = 0UL;
|
1043
|
|
- #else
|
1044
|
|
- static constexpr millis_t grace_period = 0UL;
|
1045
|
|
- #endif
|
1046
|
|
- #endif
|
1047
|
|
-
|
1048
|
1035
|
HOTEND_LOOP() {
|
1049
|
1036
|
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
|
1050
|
|
- if (!grace_period && degHotend(e) > temp_range[e].maxtemp)
|
|
1037
|
+ if (degHotend(e) > temp_range[e].maxtemp)
|
1051
|
1038
|
_temp_error((heater_ind_t)e, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, e));
|
1052
|
1039
|
#endif
|
1053
|
1040
|
|
|
@@ -1103,7 +1090,7 @@ void Temperature::manage_heater() {
|
1103
|
1090
|
#if HAS_HEATED_BED
|
1104
|
1091
|
|
1105
|
1092
|
#if ENABLED(THERMAL_PROTECTION_BED)
|
1106
|
|
- if (!grace_period && degBed() > BED_MAXTEMP)
|
|
1093
|
+ if (degBed() > BED_MAXTEMP)
|
1107
|
1094
|
_temp_error(H_BED, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, H_BED));
|
1108
|
1095
|
#endif
|
1109
|
1096
|
|
|
@@ -1181,7 +1168,7 @@ void Temperature::manage_heater() {
|
1181
|
1168
|
#endif
|
1182
|
1169
|
|
1183
|
1170
|
#if ENABLED(THERMAL_PROTECTION_CHAMBER)
|
1184
|
|
- if (!grace_period && degChamber() > CHAMBER_MAXTEMP)
|
|
1171
|
+ if (degChamber() > CHAMBER_MAXTEMP)
|
1185
|
1172
|
_temp_error(H_CHAMBER, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, H_CHAMBER));
|
1186
|
1173
|
#endif
|
1187
|
1174
|
|
|
@@ -2224,14 +2211,6 @@ void Temperature::set_current_temp_raw() {
|
2224
|
2211
|
|
2225
|
2212
|
void Temperature::readings_ready() {
|
2226
|
2213
|
|
2227
|
|
- #if THERMAL_PROTECTION_GRACE_PERIOD > 0
|
2228
|
|
- const millis_t ms = millis();
|
2229
|
|
- static millis_t grace_period = ms + THERMAL_PROTECTION_GRACE_PERIOD; // NOTE: millis() == 0 on reset
|
2230
|
|
- if (ELAPSED(ms, grace_period)) grace_period = 0;
|
2231
|
|
- #else
|
2232
|
|
- static constexpr millis_t grace_period = 0;
|
2233
|
|
- #endif
|
2234
|
|
-
|
2235
|
2214
|
// Update the raw values if they've been read. Else we could be updating them during reading.
|
2236
|
2215
|
if (!temp_meas_ready) set_current_temp_raw();
|
2237
|
2216
|
|
|
@@ -2250,6 +2229,9 @@ void Temperature::readings_ready() {
|
2250
|
2229
|
temp_chamber.acc = 0;
|
2251
|
2230
|
#endif
|
2252
|
2231
|
|
|
2232
|
+ // Give ADC temperature readings time to settle at boot-up before testing
|
|
2233
|
+ if (grace_period) return;
|
|
2234
|
+
|
2253
|
2235
|
static constexpr int8_t temp_dir[] = {
|
2254
|
2236
|
#if ENABLED(HEATER_0_USES_MAX6675)
|
2255
|
2237
|
0
|
|
@@ -2277,9 +2259,6 @@ void Temperature::readings_ready() {
|
2277
|
2259
|
#endif // HOTENDS > 1
|
2278
|
2260
|
};
|
2279
|
2261
|
|
2280
|
|
- // Give ADC temperature readings time to settle at boot-up before testing
|
2281
|
|
- if (grace_period) return;
|
2282
|
|
-
|
2283
|
2262
|
for (uint8_t e = 0; e < COUNT(temp_dir); e++) {
|
2284
|
2263
|
const int8_t tdir = temp_dir[e];
|
2285
|
2264
|
if (tdir) {
|