Clarify thermal_runaway_protection

- Add comments documenting `thermal_runaway_protection`
- Add an enum for the thermal runaway states
- Add macros for temperature helper functions
- Fix a glitch with the z probe sled in homeaxis
This commit is contained in:
Scott Lahteine 2015-04-02 05:10:14 -07:00
parent 93fdc2951b
commit e96df67630
4 changed files with 118 additions and 143 deletions

View file

@ -1460,7 +1460,7 @@ static void homeaxis(int axis) {
sync_plan_position(); sync_plan_position();
// Engage Servo endstop if enabled // Engage Servo endstop if enabled
#ifdef SERVO_ENDSTOPS && !defined(Z_PROBE_SLED) #if defined(SERVO_ENDSTOPS) && !defined(Z_PROBE_SLED)
#if SERVO_LEVELING #if SERVO_LEVELING
if (axis == Z_AXIS) engage_z_probe(); else if (axis == Z_AXIS) engage_z_probe(); else
@ -2781,7 +2781,7 @@ inline void gcode_M42() {
} }
} }
#if defined(FAN_PIN) && FAN_PIN > -1 #if HAS_FAN
if (pin_number == FAN_PIN) fanSpeed = pin_status; if (pin_number == FAN_PIN) fanSpeed = pin_status;
#endif #endif
@ -3067,17 +3067,17 @@ inline void gcode_M104() {
inline void gcode_M105() { inline void gcode_M105() {
if (setTargetedHotend(105)) return; if (setTargetedHotend(105)) return;
#if defined(TEMP_0_PIN) && TEMP_0_PIN > -1 #if HAS_TEMP_0
SERIAL_PROTOCOLPGM("ok T:"); SERIAL_PROTOCOLPGM("ok T:");
SERIAL_PROTOCOL_F(degHotend(tmp_extruder),1); SERIAL_PROTOCOL_F(degHotend(tmp_extruder),1);
SERIAL_PROTOCOLPGM(" /"); SERIAL_PROTOCOLPGM(" /");
SERIAL_PROTOCOL_F(degTargetHotend(tmp_extruder),1); SERIAL_PROTOCOL_F(degTargetHotend(tmp_extruder),1);
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 #if HAS_TEMP_BED
SERIAL_PROTOCOLPGM(" B:"); SERIAL_PROTOCOLPGM(" B:");
SERIAL_PROTOCOL_F(degBed(),1); SERIAL_PROTOCOL_F(degBed(),1);
SERIAL_PROTOCOLPGM(" /"); SERIAL_PROTOCOLPGM(" /");
SERIAL_PROTOCOL_F(degTargetBed(),1); SERIAL_PROTOCOL_F(degTargetBed(),1);
#endif //TEMP_BED_PIN #endif
for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) { for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) {
SERIAL_PROTOCOLPGM(" T"); SERIAL_PROTOCOLPGM(" T");
SERIAL_PROTOCOL(cur_extruder); SERIAL_PROTOCOL(cur_extruder);
@ -3108,7 +3108,7 @@ inline void gcode_M105() {
#endif #endif
#ifdef SHOW_TEMP_ADC_VALUES #ifdef SHOW_TEMP_ADC_VALUES
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 #if HAS_TEMP_BED
SERIAL_PROTOCOLPGM(" ADC B:"); SERIAL_PROTOCOLPGM(" ADC B:");
SERIAL_PROTOCOL_F(degBed(),1); SERIAL_PROTOCOL_F(degBed(),1);
SERIAL_PROTOCOLPGM("C->"); SERIAL_PROTOCOLPGM("C->");
@ -3124,10 +3124,10 @@ inline void gcode_M105() {
} }
#endif #endif
SERIAL_PROTOCOLLN(""); SERIAL_EOL;
} }
#if defined(FAN_PIN) && FAN_PIN > -1 #if HAS_FAN
/** /**
* M106: Set Fan Speed * M106: Set Fan Speed
@ -3139,7 +3139,7 @@ inline void gcode_M105() {
*/ */
inline void gcode_M107() { fanSpeed = 0; } inline void gcode_M107() { fanSpeed = 0; }
#endif //FAN_PIN #endif // HAS_FAN
/** /**
* M109: Wait for extruder(s) to reach temperature * M109: Wait for extruder(s) to reach temperature
@ -3197,10 +3197,10 @@ inline void gcode_M109() {
SERIAL_PROTOCOLLN( timetemp ); SERIAL_PROTOCOLLN( timetemp );
} }
else { else {
SERIAL_PROTOCOLLN( "?" ); SERIAL_PROTOCOLLNPGM("?");
} }
#else #else
SERIAL_PROTOCOLLN(""); SERIAL_EOL;
#endif #endif
timetemp = millis(); timetemp = millis();
} }
@ -3223,7 +3223,7 @@ inline void gcode_M109() {
starttime = previous_millis_cmd = millis(); starttime = previous_millis_cmd = millis();
} }
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 #if HAS_TEMP_BED
/** /**
* M190: Sxxx Wait for bed current temp to reach target temp. Waits only when heating * M190: Sxxx Wait for bed current temp to reach target temp. Waits only when heating
@ -3251,7 +3251,7 @@ inline void gcode_M109() {
SERIAL_PROTOCOL((int)active_extruder); SERIAL_PROTOCOL((int)active_extruder);
SERIAL_PROTOCOLPGM(" B:"); SERIAL_PROTOCOLPGM(" B:");
SERIAL_PROTOCOL_F(degBed(), 1); SERIAL_PROTOCOL_F(degBed(), 1);
SERIAL_PROTOCOLLN(""); SERIAL_EOL;
} }
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
@ -3452,27 +3452,26 @@ inline void gcode_M114() {
SERIAL_PROTOCOLPGM(" Z:"); SERIAL_PROTOCOLPGM(" Z:");
SERIAL_PROTOCOL(float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS]); SERIAL_PROTOCOL(float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS]);
SERIAL_PROTOCOLLN(""); SERIAL_EOL;
#ifdef SCARA #ifdef SCARA
SERIAL_PROTOCOLPGM("SCARA Theta:"); SERIAL_PROTOCOLPGM("SCARA Theta:");
SERIAL_PROTOCOL(delta[X_AXIS]); SERIAL_PROTOCOL(delta[X_AXIS]);
SERIAL_PROTOCOLPGM(" Psi+Theta:"); SERIAL_PROTOCOLPGM(" Psi+Theta:");
SERIAL_PROTOCOL(delta[Y_AXIS]); SERIAL_PROTOCOL(delta[Y_AXIS]);
SERIAL_PROTOCOLLN(""); SERIAL_EOL;
SERIAL_PROTOCOLPGM("SCARA Cal - Theta:"); SERIAL_PROTOCOLPGM("SCARA Cal - Theta:");
SERIAL_PROTOCOL(delta[X_AXIS]+home_offset[X_AXIS]); SERIAL_PROTOCOL(delta[X_AXIS]+home_offset[X_AXIS]);
SERIAL_PROTOCOLPGM(" Psi+Theta (90):"); SERIAL_PROTOCOLPGM(" Psi+Theta (90):");
SERIAL_PROTOCOL(delta[Y_AXIS]-delta[X_AXIS]-90+home_offset[Y_AXIS]); SERIAL_PROTOCOL(delta[Y_AXIS]-delta[X_AXIS]-90+home_offset[Y_AXIS]);
SERIAL_PROTOCOLLN(""); SERIAL_EOL;
SERIAL_PROTOCOLPGM("SCARA step Cal - Theta:"); SERIAL_PROTOCOLPGM("SCARA step Cal - Theta:");
SERIAL_PROTOCOL(delta[X_AXIS]/90*axis_steps_per_unit[X_AXIS]); SERIAL_PROTOCOL(delta[X_AXIS]/90*axis_steps_per_unit[X_AXIS]);
SERIAL_PROTOCOLPGM(" Psi+Theta:"); SERIAL_PROTOCOLPGM(" Psi+Theta:");
SERIAL_PROTOCOL((delta[Y_AXIS]-delta[X_AXIS])/90*axis_steps_per_unit[Y_AXIS]); SERIAL_PROTOCOL((delta[Y_AXIS]-delta[X_AXIS])/90*axis_steps_per_unit[Y_AXIS]);
SERIAL_PROTOCOLLN(""); SERIAL_EOL; SERIAL_EOL;
SERIAL_PROTOCOLLN("");
#endif #endif
} }
@ -3915,7 +3914,7 @@ inline void gcode_M226() {
SERIAL_PROTOCOL(servo_index); SERIAL_PROTOCOL(servo_index);
SERIAL_PROTOCOL(": "); SERIAL_PROTOCOL(": ");
SERIAL_PROTOCOL(servos[servo_index].read()); SERIAL_PROTOCOL(servos[servo_index].read());
SERIAL_PROTOCOLLN(""); SERIAL_EOL;
} }
} }
@ -3983,7 +3982,7 @@ inline void gcode_M226() {
//Kc does not have scaling applied above, or in resetting defaults //Kc does not have scaling applied above, or in resetting defaults
SERIAL_PROTOCOL(PID_PARAM(Kc, e)); SERIAL_PROTOCOL(PID_PARAM(Kc, e));
#endif #endif
SERIAL_PROTOCOLLN(""); SERIAL_EOL;
} }
else { else {
SERIAL_ECHO_START; SERIAL_ECHO_START;
@ -4008,7 +4007,7 @@ inline void gcode_M226() {
SERIAL_PROTOCOL(unscalePID_i(bedKi)); SERIAL_PROTOCOL(unscalePID_i(bedKi));
SERIAL_PROTOCOL(" d:"); SERIAL_PROTOCOL(" d:");
SERIAL_PROTOCOL(unscalePID_d(bedKd)); SERIAL_PROTOCOL(unscalePID_d(bedKd));
SERIAL_PROTOCOLLN(""); SERIAL_EOL;
} }
#endif // PIDTEMPBED #endif // PIDTEMPBED
@ -4058,7 +4057,7 @@ inline void gcode_M226() {
if (code_seen('C')) lcd_setcontrast(code_value_long() & 0x3F); if (code_seen('C')) lcd_setcontrast(code_value_long() & 0x3F);
SERIAL_PROTOCOLPGM("lcd contrast value: "); SERIAL_PROTOCOLPGM("lcd contrast value: ");
SERIAL_PROTOCOL(lcd_contrast); SERIAL_PROTOCOL(lcd_contrast);
SERIAL_PROTOCOLLN(""); SERIAL_EOL;
} }
#endif // DOGLCD #endif // DOGLCD
@ -4331,7 +4330,7 @@ inline void gcode_M503() {
zprobe_zoffset = -value; // compare w/ line 278 of ConfigurationStore.cpp zprobe_zoffset = -value; // compare w/ line 278 of ConfigurationStore.cpp
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_ZPROBE_ZOFFSET " " MSG_OK); SERIAL_ECHOLNPGM(MSG_ZPROBE_ZOFFSET " " MSG_OK);
SERIAL_PROTOCOLLN(""); SERIAL_EOL;
} }
else { else {
SERIAL_ECHO_START; SERIAL_ECHO_START;
@ -4340,14 +4339,14 @@ inline void gcode_M503() {
SERIAL_ECHO(Z_PROBE_OFFSET_RANGE_MIN); SERIAL_ECHO(Z_PROBE_OFFSET_RANGE_MIN);
SERIAL_ECHOPGM(MSG_Z_MAX); SERIAL_ECHOPGM(MSG_Z_MAX);
SERIAL_ECHO(Z_PROBE_OFFSET_RANGE_MAX); SERIAL_ECHO(Z_PROBE_OFFSET_RANGE_MAX);
SERIAL_PROTOCOLLN(""); SERIAL_EOL;
} }
} }
else { else {
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_ZPROBE_ZOFFSET " : "); SERIAL_ECHOLNPGM(MSG_ZPROBE_ZOFFSET " : ");
SERIAL_ECHO(-zprobe_zoffset); SERIAL_ECHO(-zprobe_zoffset);
SERIAL_PROTOCOLLN(""); SERIAL_EOL;
} }
} }
@ -4852,20 +4851,20 @@ void process_commands() {
gcode_M109(); gcode_M109();
break; break;
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 #if HAS_TEMP_BED
case 190: // M190 - Wait for bed heater to reach target. case 190: // M190 - Wait for bed heater to reach target.
gcode_M190(); gcode_M190();
break; break;
#endif //TEMP_BED_PIN #endif // HAS_TEMP_BED
#if defined(FAN_PIN) && FAN_PIN > -1 #if HAS_FAN
case 106: //M106 Fan On case 106: //M106 Fan On
gcode_M106(); gcode_M106();
break; break;
case 107: //M107 Fan Off case 107: //M107 Fan Off
gcode_M107(); gcode_M107();
break; break;
#endif //FAN_PIN #endif // HAS_FAN
#ifdef BARICUDA #ifdef BARICUDA
// PWM for HEATER_1_PIN // PWM for HEATER_1_PIN
@ -5704,7 +5703,7 @@ void handle_status_leds(void) {
max_temp = max(max_temp, degHotend(cur_extruder)); max_temp = max(max_temp, degHotend(cur_extruder));
max_temp = max(max_temp, degTargetHotend(cur_extruder)); max_temp = max(max_temp, degTargetHotend(cur_extruder));
} }
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 #if HAS_TEMP_BED
max_temp = max(max_temp, degTargetBed()); max_temp = max(max_temp, degTargetBed());
max_temp = max(max_temp, degBed()); max_temp = max(max_temp, degBed());
#endif #endif

View file

@ -427,7 +427,7 @@ void check_axes_activity() {
disable_e3(); disable_e3();
} }
#if defined(FAN_PIN) && FAN_PIN > -1 // HAS_FAN #if HAS_FAN
#ifdef FAN_KICKSTART_TIME #ifdef FAN_KICKSTART_TIME
static unsigned long fan_kick_end; static unsigned long fan_kick_end;
if (tail_fan_speed) { if (tail_fan_speed) {
@ -447,7 +447,7 @@ void check_axes_activity() {
#else #else
analogWrite(FAN_PIN, tail_fan_speed); analogWrite(FAN_PIN, tail_fan_speed);
#endif //!FAN_SOFT_PWM #endif //!FAN_SOFT_PWM
#endif //FAN_PIN > -1 #endif // HAS_FAN
#ifdef AUTOTEMP #ifdef AUTOTEMP
getHighESpeed(); getHighESpeed();

View file

@ -1,5 +1,5 @@
/* /*
temperature.c - temperature control temperature.cpp - temperature control
Part of Marlin Part of Marlin
Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
@ -18,17 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/*
This firmware is a mashup between Sprinter and grbl.
(https://github.com/kliment/Sprinter)
(https://github.com/simen/grbl/tree)
It has preliminary support for Matthew Roberts advance algorithm
http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
*/
#include "Marlin.h" #include "Marlin.h"
#include "ultralcd.h" #include "ultralcd.h"
#include "temperature.h" #include "temperature.h"
@ -87,14 +76,15 @@ unsigned char soft_pwm_bed;
#define HAS_HEATER_THERMAL_PROTECTION (defined(THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0) #define HAS_HEATER_THERMAL_PROTECTION (defined(THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0)
#define HAS_BED_THERMAL_PROTECTION (defined(THERMAL_RUNAWAY_PROTECTION_BED_PERIOD) && THERMAL_RUNAWAY_PROTECTION_BED_PERIOD > 0 && TEMP_SENSOR_BED != 0) #define HAS_BED_THERMAL_PROTECTION (defined(THERMAL_RUNAWAY_PROTECTION_BED_PERIOD) && THERMAL_RUNAWAY_PROTECTION_BED_PERIOD > 0 && TEMP_SENSOR_BED != 0)
#if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION #if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION
enum TRState { TRInactive, TRFirstHeating, TRStable };
static bool thermal_runaway = false; static bool thermal_runaway = false;
void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc); void thermal_runaway_protection(TRState *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc);
#if HAS_HEATER_THERMAL_PROTECTION #if HAS_HEATER_THERMAL_PROTECTION
static int thermal_runaway_state_machine[4]; // = {0,0,0,0}; static TRState thermal_runaway_state_machine[4] = { TRInactive, TRInactive, TRInactive, TRInactive };
static unsigned long thermal_runaway_timer[4]; // = {0,0,0,0}; static unsigned long thermal_runaway_timer[4]; // = {0,0,0,0};
#endif #endif
#if HAS_BED_THERMAL_PROTECTION #if HAS_BED_THERMAL_PROTECTION
static int thermal_runaway_bed_state_machine; static TRState thermal_runaway_bed_state_machine = { TRInactive, TRInactive, TRInactive, TRInactive };
static unsigned long thermal_runaway_bed_timer; static unsigned long thermal_runaway_bed_timer;
#endif #endif
#endif #endif
@ -609,7 +599,7 @@ void manage_heater() {
// Loop through all extruders // Loop through all extruders
for (int e = 0; e < EXTRUDERS; e++) { for (int e = 0; e < EXTRUDERS; e++) {
#if defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0 #if HAS_HEATER_THERMAL_PROTECTION
thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_RUNAWAY_PROTECTION_PERIOD, THERMAL_RUNAWAY_PROTECTION_HYSTERESIS); thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_RUNAWAY_PROTECTION_PERIOD, THERMAL_RUNAWAY_PROTECTION_HYSTERESIS);
#endif #endif
@ -1014,8 +1004,8 @@ void setWatch() {
} }
#if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION #if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION
void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc)
{ void thermal_runaway_protection(TRState *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) {
/* /*
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHO("Thermal Thermal Runaway Running. Heater ID:"); SERIAL_ECHO("Thermal Thermal Runaway Running. Heater ID:");
@ -1030,36 +1020,36 @@ void thermal_runaway_protection(int *state, unsigned long *timer, float temperat
SERIAL_ECHO(target_temperature); SERIAL_ECHO(target_temperature);
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
*/ */
if ((target_temperature == 0) || thermal_runaway) if (target_temperature == 0 || thermal_runaway) {
{ *state = TRInactive;
*state = 0;
*timer = 0; *timer = 0;
return; return;
} }
switch (*state)
{ switch (*state) {
case 0: // "Heater Inactive" state // Inactive state waits for a target temperature, then
if (target_temperature > 0) *state = 1; case TRInactive:
if (target_temperature > 0) *state = TRFirstHeating;
break; break;
case 1: // "First Heating" state // When first heating, wait for the temperature to be reached then go to Stable state
if (temperature >= target_temperature) *state = 2; case TRFirstHeating:
if (temperature >= target_temperature) *state = TRStable;
break; break;
case 2: // "Temperature Stable" state // While the temperature is stable watch for a bad temperature
case TRStable:
{ {
unsigned long ms = millis(); // Whenever the current temperature is over the target (-hysteresis) restart the timer
if (temperature >= (target_temperature - hysteresis_degc)) if (temperature >= target_temperature - hysteresis_degc) {
{ *timer = millis();
*timer = ms;
} }
else if ( (ms - *timer) > ((unsigned long) period_seconds) * 1000) // If the timer goes too long without a reset, trigger shutdown
{ else if (millis() > *timer + period_seconds * 1000UL) {
SERIAL_ERROR_START; SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_THERMAL_RUNAWAY_STOP); SERIAL_ERRORLNPGM(MSG_THERMAL_RUNAWAY_STOP);
SERIAL_ERRORLN((int)heater_id); SERIAL_ERRORLN((int)heater_id);
LCD_ALERTMESSAGEPGM(MSG_THERMAL_RUNAWAY); // translatable LCD_ALERTMESSAGEPGM(MSG_THERMAL_RUNAWAY);
thermal_runaway = true; thermal_runaway = true;
while(1) for (;;) {
{
disable_heater(); disable_heater();
disable_x(); disable_x();
disable_y(); disable_y();
@ -1075,8 +1065,8 @@ void thermal_runaway_protection(int *state, unsigned long *timer, float temperat
} break; } break;
} }
} }
#endif //THERMAL_RUNAWAY_PROTECTION_PERIOD
#endif // HAS_HEATER_THERMAL_PROTECTION
void disable_heater() { void disable_heater() {
for (int i=0; i<EXTRUDERS; i++) setTargetHotend(0, i); for (int i=0; i<EXTRUDERS; i++) setTargetHotend(0, i);

View file

@ -18,8 +18,8 @@
along with Grbl. If not, see <http://www.gnu.org/licenses/>. along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef temperature_h #ifndef TEMPERATURE_H
#define temperature_h #define TEMPERATURE_H
#include "Marlin.h" #include "Marlin.h"
#include "planner.h" #include "planner.h"
@ -105,40 +105,27 @@ FORCE_INLINE bool isHeatingBed() { return target_temperature_bed > current_tempe
FORCE_INLINE bool isCoolingHotend(uint8_t extruder) { return target_temperature[extruder] < current_temperature[extruder]; } FORCE_INLINE bool isCoolingHotend(uint8_t extruder) { return target_temperature[extruder] < current_temperature[extruder]; }
FORCE_INLINE bool isCoolingBed() { return target_temperature_bed < current_temperature_bed; } FORCE_INLINE bool isCoolingBed() { return target_temperature_bed < current_temperature_bed; }
#define degHotend0() degHotend(0) #define HOTEND_ROUTINES(NR) \
#define degTargetHotend0() degTargetHotend(0) FORCE_INLINE float degHotend##NR() { return degHotend(NR); } \
#define setTargetHotend0(_celsius) setTargetHotend((_celsius), 0) FORCE_INLINE float degTargetHotend##NR() { return degTargetHotend(NR); } \
#define isHeatingHotend0() isHeatingHotend(0) FORCE_INLINE void setTargetHotend##NR(const float c) { setTargetHotend(c, NR); } \
#define isCoolingHotend0() isCoolingHotend(0) FORCE_INLINE bool isHeatingHotend##NR() { return isHeatingHotend(NR); } \
FORCE_INLINE bool isCoolingHotend##NR() { return isCoolingHotend(NR); }
HOTEND_ROUTINES(0);
#if EXTRUDERS > 1 #if EXTRUDERS > 1
#define degHotend1() degHotend(1) HOTEND_ROUTINES(1);
#define degTargetHotend1() degTargetHotend(1)
#define setTargetHotend1(_celsius) setTargetHotend((_celsius), 1)
#define isHeatingHotend1() isHeatingHotend(1)
#define isCoolingHotend1() isCoolingHotend(1)
#else #else
#define setTargetHotend1(_celsius) do{}while(0) #define setTargetHotend1(c) do{}while(0)
#endif #endif
#if EXTRUDERS > 2 #if EXTRUDERS > 2
#define degHotend2() degHotend(2) HOTEND_ROUTINES(2);
#define degTargetHotend2() degTargetHotend(2)
#define setTargetHotend2(_celsius) setTargetHotend((_celsius), 2)
#define isHeatingHotend2() isHeatingHotend(2)
#define isCoolingHotend2() isCoolingHotend(2)
#else #else
#define setTargetHotend2(_celsius) do{}while(0) #define setTargetHotend2(c) do{}while(0)
#endif #endif
#if EXTRUDERS > 3 #if EXTRUDERS > 3
#define degHotend3() degHotend(3) HOTEND_ROUTINES(3);
#define degTargetHotend3() degTargetHotend(3)
#define setTargetHotend3(_celsius) setTargetHotend((_celsius), 3)
#define isHeatingHotend3() isHeatingHotend(3)
#define isCoolingHotend3() isCoolingHotend(3)
#else #else
#define setTargetHotend3(_celsius) do{}while(0) #define setTargetHotend3(c) do{}while(0)
#endif
#if EXTRUDERS > 4
#error Invalid number of extruders
#endif #endif
int getHeaterPower(int heater); int getHeaterPower(int heater);
@ -161,5 +148,4 @@ FORCE_INLINE void autotempShutdown() {
#endif #endif
} }
#endif // TEMPERATURE_H
#endif