|
@@ -447,11 +447,11 @@ volatile bool Temperature::raw_temps_ready = false;
|
447
|
447
|
temp_range_t Temperature::temp_range[HOTENDS] = ARRAY_BY_HOTENDS(sensor_heater_0, sensor_heater_1, sensor_heater_2, sensor_heater_3, sensor_heater_4, sensor_heater_5, sensor_heater_6, sensor_heater_7);
|
448
|
448
|
#endif
|
449
|
449
|
|
450
|
|
-#ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
|
|
450
|
+#if MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED > 1
|
451
|
451
|
uint8_t Temperature::consecutive_low_temperature_error[HOTENDS] = { 0 };
|
452
|
452
|
#endif
|
453
|
453
|
|
454
|
|
-#ifdef MILLISECONDS_PREHEAT_TIME
|
|
454
|
+#if MILLISECONDS_PREHEAT_TIME > 0
|
455
|
455
|
millis_t Temperature::preheat_end_time[HOTENDS] = { 0 };
|
456
|
456
|
#endif
|
457
|
457
|
|
|
@@ -472,7 +472,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
472
|
472
|
#endif
|
473
|
473
|
|
474
|
474
|
#if ENABLED(PROBING_HEATERS_OFF)
|
475
|
|
- bool Temperature::paused;
|
|
475
|
+ bool Temperature::paused_for_probing;
|
476
|
476
|
#endif
|
477
|
477
|
|
478
|
478
|
// public:
|
|
@@ -1320,10 +1320,10 @@ void Temperature::manage_heater() {
|
1320
|
1320
|
|
1321
|
1321
|
#if DISABLED(PIDTEMPBED)
|
1322
|
1322
|
if (PENDING(ms, next_bed_check_ms)
|
1323
|
|
- && TERN1(PAUSE_CHANGE_REQD, paused == last_pause_state)
|
|
1323
|
+ && TERN1(PAUSE_CHANGE_REQD, paused_for_probing == last_pause_state)
|
1324
|
1324
|
) break;
|
1325
|
1325
|
next_bed_check_ms = ms + BED_CHECK_INTERVAL;
|
1326
|
|
- TERN_(PAUSE_CHANGE_REQD, last_pause_state = paused);
|
|
1326
|
+ TERN_(PAUSE_CHANGE_REQD, last_pause_state = paused_for_probing);
|
1327
|
1327
|
#endif
|
1328
|
1328
|
|
1329
|
1329
|
TERN_(HEATER_IDLE_HANDLER, heater_idle[IDLE_INDEX_BED].update(ms));
|
|
@@ -1958,9 +1958,30 @@ void Temperature::updateTemperaturesFromRawValues() {
|
1958
|
1958
|
|
1959
|
1959
|
/**
|
1960
|
1960
|
* Initialize the temperature manager
|
|
1961
|
+ *
|
1961
|
1962
|
* The manager is implemented by periodic calls to manage_heater()
|
|
1963
|
+ *
|
|
1964
|
+ * - Init (and disable) SPI thermocouples like MAX6675 and MAX31865
|
|
1965
|
+ * - Disable RUMBA JTAG to accommodate a thermocouple extension
|
|
1966
|
+ * - Read-enable thermistors with a read-enable pin
|
|
1967
|
+ * - Init HEATER and COOLER pins for OUTPUT in OFF state
|
|
1968
|
+ * - Init the FAN pins as PWM or OUTPUT
|
|
1969
|
+ * - Init the SPI interface for SPI thermocouples
|
|
1970
|
+ * - Init ADC according to the HAL
|
|
1971
|
+ * - Set thermistor pins to analog inputs according to the HAL
|
|
1972
|
+ * - Start the Temperature ISR timer
|
|
1973
|
+ * - Init the AUTO FAN pins as PWM or OUTPUT
|
|
1974
|
+ * - Wait 250ms for temperatures to settle
|
|
1975
|
+ * - Init temp_range[], used for catching min/maxtemp
|
1962
|
1976
|
*/
|
1963
|
1977
|
void Temperature::init() {
|
|
1978
|
+
|
|
1979
|
+ TERN_(PROBING_HEATERS_OFF, paused_for_probing = false);
|
|
1980
|
+
|
|
1981
|
+ #if BOTH(PIDTEMP, PID_EXTRUSION_SCALING)
|
|
1982
|
+ last_e_position = 0;
|
|
1983
|
+ #endif
|
|
1984
|
+
|
1964
|
1985
|
// Init (and disable) SPI thermocouples
|
1965
|
1986
|
#if TEMP_SENSOR_0_IS_MAX6675 && PIN_EXISTS(MAX6675_CS)
|
1966
|
1987
|
OUT_WRITE(MAX6675_CS_PIN, HIGH);
|
|
@@ -2017,10 +2038,6 @@ void Temperature::init() {
|
2017
|
2038
|
OUT_WRITE(TEMP_1_TR_ENABLE_PIN, ENABLED(TEMP_SENSOR_1_IS_MAX_TC));
|
2018
|
2039
|
#endif
|
2019
|
2040
|
|
2020
|
|
- #if BOTH(PIDTEMP, PID_EXTRUSION_SCALING)
|
2021
|
|
- last_e_position = 0;
|
2022
|
|
- #endif
|
2023
|
|
-
|
2024
|
2041
|
#if HAS_HEATER_0
|
2025
|
2042
|
#ifdef BOARD_OPENDRAIN_MOSFETS
|
2026
|
2043
|
OUT_WRITE_OD(HEATER_0_PIN, HEATER_0_INVERTING);
|
|
@@ -2276,55 +2293,8 @@ void Temperature::init() {
|
2276
|
2293
|
while (analog_to_celsius_cooler(mintemp_raw_COOLER) > COOLER_MINTEMP) mintemp_raw_COOLER += TEMPDIR(COOLER) * (OVERSAMPLENR);
|
2277
|
2294
|
while (analog_to_celsius_cooler(maxtemp_raw_COOLER) < COOLER_MAXTEMP) maxtemp_raw_COOLER -= TEMPDIR(COOLER) * (OVERSAMPLENR);
|
2278
|
2295
|
#endif
|
2279
|
|
-
|
2280
|
|
- TERN_(PROBING_HEATERS_OFF, paused = false);
|
2281
|
2296
|
}
|
2282
|
2297
|
|
2283
|
|
-#if WATCH_HOTENDS
|
2284
|
|
- /**
|
2285
|
|
- * Start Heating Sanity Check for hotends that are below
|
2286
|
|
- * their target temperature by a configurable margin.
|
2287
|
|
- * This is called when the temperature is set. (M104, M109)
|
2288
|
|
- */
|
2289
|
|
- void Temperature::start_watching_hotend(const uint8_t E_NAME) {
|
2290
|
|
- const uint8_t ee = HOTEND_INDEX;
|
2291
|
|
- watch_hotend[ee].restart(degHotend(ee), degTargetHotend(ee));
|
2292
|
|
- }
|
2293
|
|
-#endif
|
2294
|
|
-
|
2295
|
|
-#if WATCH_BED
|
2296
|
|
- /**
|
2297
|
|
- * Start Heating Sanity Check for hotends that are below
|
2298
|
|
- * their target temperature by a configurable margin.
|
2299
|
|
- * This is called when the temperature is set. (M140, M190)
|
2300
|
|
- */
|
2301
|
|
- void Temperature::start_watching_bed() {
|
2302
|
|
- watch_bed.restart(degBed(), degTargetBed());
|
2303
|
|
- }
|
2304
|
|
-#endif
|
2305
|
|
-
|
2306
|
|
-#if WATCH_CHAMBER
|
2307
|
|
- /**
|
2308
|
|
- * Start Heating Sanity Check for chamber that is below
|
2309
|
|
- * its target temperature by a configurable margin.
|
2310
|
|
- * This is called when the temperature is set. (M141, M191)
|
2311
|
|
- */
|
2312
|
|
- void Temperature::start_watching_chamber() {
|
2313
|
|
- watch_chamber.restart(degChamber(), degTargetChamber());
|
2314
|
|
- }
|
2315
|
|
-#endif
|
2316
|
|
-
|
2317
|
|
-#if WATCH_COOLER
|
2318
|
|
- /**
|
2319
|
|
- * Start Cooling Sanity Check for cooler that is above
|
2320
|
|
- * its target temperature by a configurable margin.
|
2321
|
|
- * This is called when the temperature is set. (M143, M193)
|
2322
|
|
- */
|
2323
|
|
- void Temperature::start_watching_cooler() {
|
2324
|
|
- watch_cooler.restart(degCooler(), degTargetCooler());
|
2325
|
|
- }
|
2326
|
|
-#endif
|
2327
|
|
-
|
2328
|
2298
|
#if HAS_THERMAL_PROTECTION
|
2329
|
2299
|
|
2330
|
2300
|
Temperature::tr_state_machine_t Temperature::tr_state_machine[NR_HEATER_RUNAWAY]; // = { { TRInactive, 0 } };
|
|
@@ -2487,8 +2457,8 @@ void Temperature::disable_all_heaters() {
|
2487
|
2457
|
#if ENABLED(PROBING_HEATERS_OFF)
|
2488
|
2458
|
|
2489
|
2459
|
void Temperature::pause(const bool p) {
|
2490
|
|
- if (p != paused) {
|
2491
|
|
- paused = p;
|
|
2460
|
+ if (p != paused_for_probing) {
|
|
2461
|
+ paused_for_probing = p;
|
2492
|
2462
|
if (p) {
|
2493
|
2463
|
HOTEND_LOOP() heater_idle[e].expire(); // Timeout immediately
|
2494
|
2464
|
TERN_(HAS_HEATED_BED, heater_idle[IDLE_INDEX_BED].expire()); // Timeout immediately
|
|
@@ -2773,17 +2743,16 @@ void Temperature::readings_ready() {
|
2773
|
2743
|
const int8_t tdir = temp_dir[e];
|
2774
|
2744
|
if (tdir) {
|
2775
|
2745
|
const int16_t rawtemp = temp_hotend[e].raw * tdir; // normal direction, +rawtemp, else -rawtemp
|
2776
|
|
- const bool heater_on = (temp_hotend[e].target > 0
|
2777
|
|
- || TERN0(PIDTEMP, temp_hotend[e].soft_pwm_amount) > 0
|
2778
|
|
- );
|
2779
|
2746
|
if (rawtemp > temp_range[e].raw_max * tdir) max_temp_error((heater_id_t)e);
|
|
2747
|
+
|
|
2748
|
+ const bool heater_on = (temp_hotend[e].target > 0 || TERN0(PIDTEMP, temp_hotend[e].soft_pwm_amount > 0));
|
2780
|
2749
|
if (heater_on && rawtemp < temp_range[e].raw_min * tdir && !is_preheating(e)) {
|
2781
|
|
- #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
|
|
2750
|
+ #if MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED > 1
|
2782
|
2751
|
if (++consecutive_low_temperature_error[e] >= MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED)
|
2783
|
2752
|
#endif
|
2784
|
2753
|
min_temp_error((heater_id_t)e);
|
2785
|
2754
|
}
|
2786
|
|
- #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
|
|
2755
|
+ #if MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED > 1
|
2787
|
2756
|
else
|
2788
|
2757
|
consecutive_low_temperature_error[e] = 0;
|
2789
|
2758
|
#endif
|