Browse Source

Option to assist thermocouple debug (#18621)

vanilla_fb_2.0.x
Axel 4 years ago
committed by GitHub
parent
commit
c4dd0082a1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 29
      Marlin/src/module/temperature.cpp

29
Marlin/src/module/temperature.cpp

@ -24,6 +24,9 @@
* temperature.cpp - temperature control * temperature.cpp - temperature control
*/ */
// Useful when debugging thermocouples
//#define IGNORE_THERMOCOUPLE_ERRORS
#include "temperature.h" #include "temperature.h"
#include "endstops.h" #include "endstops.h"
@ -1011,14 +1014,15 @@ void Temperature::manage_heater() {
updateTemperaturesFromRawValues(); // also resets the watchdog updateTemperaturesFromRawValues(); // also resets the watchdog
#if ENABLED(HEATER_0_USES_MAX6675) #if DISABLED(IGNORE_THERMOCOUPLE_ERRORS)
if (temp_hotend[0].celsius > _MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(H_E0); #if ENABLED(HEATER_0_USES_MAX6675)
if (temp_hotend[0].celsius < _MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(H_E0); if (temp_hotend[0].celsius > _MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(H_E0);
#endif if (temp_hotend[0].celsius < _MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(H_E0);
#endif
#if ENABLED(HEATER_1_USES_MAX6675) #if ENABLED(HEATER_1_USES_MAX6675)
if (temp_hotend[1].celsius > _MIN(HEATER_1_MAXTEMP, HEATER_1_MAX6675_TMAX - 1.0)) max_temp_error(H_E1); if (temp_hotend[1].celsius > _MIN(HEATER_1_MAXTEMP, HEATER_1_MAX6675_TMAX - 1.0)) max_temp_error(H_E1);
if (temp_hotend[1].celsius < _MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(H_E1); if (temp_hotend[1].celsius < _MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(H_E1);
#endif
#endif #endif
millis_t ms = millis(); millis_t ms = millis();
@ -2180,7 +2184,7 @@ void Temperature::disable_all_heaters() {
WRITE_MAX6675(HIGH); // disable TT_MAX6675 WRITE_MAX6675(HIGH); // disable TT_MAX6675
if (max6675_temp & MAX6675_ERROR_MASK) { if (DISABLED(IGNORE_THERMOCOUPLE_ERRORS) && (max6675_temp & MAX6675_ERROR_MASK)) {
max6675_errors[hindex] += 1; max6675_errors[hindex] += 1;
if (max6675_errors[hindex] > THERMOCOUPLE_MAX_ERRORS) { if (max6675_errors[hindex] > THERMOCOUPLE_MAX_ERRORS) {
SERIAL_ERROR_START(); SERIAL_ERROR_START();
@ -2201,16 +2205,13 @@ void Temperature::disable_all_heaters() {
max6675_temp = 4 * ( max6675_temp = 4 * (
#if COUNT_6675 > 1 #if COUNT_6675 > 1
hindex ? HEATER_1_MAX6675_TMAX : HEATER_0_MAX6675_TMAX hindex ? HEATER_1_MAX6675_TMAX : HEATER_0_MAX6675_TMAX
#elif ENABLED(HEATER_1_USES_MAX6675)
HEATER_1_MAX6675_TMAX
#else #else
HEATER_0_MAX6675_TMAX TERN(HEATER_1_USES_MAX6675, HEATER_1_MAX6675_TMAX, HEATER_0_MAX6675_TMAX)
#endif #endif
); );
} }
else { else
max6675_temp >>= MAX6675_DISCARD_BITS; max6675_temp >>= MAX6675_DISCARD_BITS;
}
} }
else { else {
max6675_temp >>= MAX6675_DISCARD_BITS; max6675_temp >>= MAX6675_DISCARD_BITS;

Loading…
Cancel
Save