Skip to content

Commit

Permalink
Option to assist thermocouple debug (MarlinFirmware#18621)
Browse files Browse the repository at this point in the history
  • Loading branch information
chepo92 authored and albertogg committed Aug 31, 2020
1 parent f5e4551 commit 4e183e2
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
* temperature.cpp - temperature control
*/

// Useful when debugging thermocouples
//#define IGNORE_THERMOCOUPLE_ERRORS

#include "temperature.h"
#include "endstops.h"

Expand Down Expand Up @@ -1011,14 +1014,15 @@ void Temperature::manage_heater() {

updateTemperaturesFromRawValues(); // also resets the watchdog

#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 < _MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(H_E0);
#endif

#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 < _MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(H_E1);
#if DISABLED(IGNORE_THERMOCOUPLE_ERRORS)
#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 < _MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(H_E0);
#endif
#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 < _MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(H_E1);
#endif
#endif

millis_t ms = millis();
Expand Down Expand Up @@ -2180,7 +2184,7 @@ void Temperature::disable_all_heaters() {

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;
if (max6675_errors[hindex] > THERMOCOUPLE_MAX_ERRORS) {
SERIAL_ERROR_START();
Expand All @@ -2201,16 +2205,13 @@ void Temperature::disable_all_heaters() {
max6675_temp = 4 * (
#if COUNT_6675 > 1
hindex ? HEATER_1_MAX6675_TMAX : HEATER_0_MAX6675_TMAX
#elif ENABLED(HEATER_1_USES_MAX6675)
HEATER_1_MAX6675_TMAX
#else
HEATER_0_MAX6675_TMAX
TERN(HEATER_1_USES_MAX6675, HEATER_1_MAX6675_TMAX, HEATER_0_MAX6675_TMAX)
#endif
);
}
else {
else
max6675_temp >>= MAX6675_DISCARD_BITS;
}
}
else {
max6675_temp >>= MAX6675_DISCARD_BITS;
Expand Down

0 comments on commit 4e183e2

Please sign in to comment.