Option to assist thermocouple debug (#18621)

This commit is contained in:
Axel 2020-07-11 01:23:48 -04:00 committed by GitHub
parent c765bb05d7
commit c4dd0082a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,15 +1014,16 @@ void Temperature::manage_heater() {
updateTemperaturesFromRawValues(); // also resets the watchdog updateTemperaturesFromRawValues(); // also resets the watchdog
#if DISABLED(IGNORE_THERMOCOUPLE_ERRORS)
#if ENABLED(HEATER_0_USES_MAX6675) #if ENABLED(HEATER_0_USES_MAX6675)
if (temp_hotend[0].celsius > _MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(H_E0); if (temp_hotend[0].celsius > _MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(H_E0);
if (temp_hotend[0].celsius < _MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(H_E0); if (temp_hotend[0].celsius < _MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(H_E0);
#endif #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,17 +2205,14 @@ 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;
max6675_errors[hindex] = 0; max6675_errors[hindex] = 0;