Browse Source

Merge pull request #3339 from thinkyhead/rc_has_temp_hotend

Add HAS_TEMP_HOTEND, account for MAX31855 in conditionals
pull/1/head
Scott Lahteine 9 years ago
parent
commit
22a43980e8
  1. 28
      Marlin/Conditionals.h
  2. 2
      Marlin/Marlin.h
  3. 10
      Marlin/Marlin_main.cpp
  4. 4
      Marlin/temperature.cpp

28
Marlin/Conditionals.h

@ -440,7 +440,9 @@
#define HEATER_0_USES_THERMISTOR #define HEATER_0_USES_THERMISTOR
#endif #endif
#if TEMP_SENSOR_1 == -1 #if TEMP_SENSOR_1 <= -2
#error MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_1
#elif TEMP_SENSOR_1 == -1
#define HEATER_1_USES_AD595 #define HEATER_1_USES_AD595
#elif TEMP_SENSOR_1 == 0 #elif TEMP_SENSOR_1 == 0
#undef HEATER_1_MINTEMP #undef HEATER_1_MINTEMP
@ -450,7 +452,9 @@
#define HEATER_1_USES_THERMISTOR #define HEATER_1_USES_THERMISTOR
#endif #endif
#if TEMP_SENSOR_2 == -1 #if TEMP_SENSOR_2 <= -2
#error MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_2
#elif TEMP_SENSOR_2 == -1
#define HEATER_2_USES_AD595 #define HEATER_2_USES_AD595
#elif TEMP_SENSOR_2 == 0 #elif TEMP_SENSOR_2 == 0
#undef HEATER_2_MINTEMP #undef HEATER_2_MINTEMP
@ -460,7 +464,9 @@
#define HEATER_2_USES_THERMISTOR #define HEATER_2_USES_THERMISTOR
#endif #endif
#if TEMP_SENSOR_3 == -1 #if TEMP_SENSOR_3 <= -2
#error MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_3
#elif TEMP_SENSOR_3 == -1
#define HEATER_3_USES_AD595 #define HEATER_3_USES_AD595
#elif TEMP_SENSOR_3 == 0 #elif TEMP_SENSOR_3 == 0
#undef HEATER_3_MINTEMP #undef HEATER_3_MINTEMP
@ -470,7 +476,9 @@
#define HEATER_3_USES_THERMISTOR #define HEATER_3_USES_THERMISTOR
#endif #endif
#if TEMP_SENSOR_BED == -1 #if TEMP_SENSOR_BED <= -2
#error MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_BED
#elif TEMP_SENSOR_BED == -1
#define BED_USES_AD595 #define BED_USES_AD595
#elif TEMP_SENSOR_BED == 0 #elif TEMP_SENSOR_BED == 0
#undef BED_MINTEMP #undef BED_MINTEMP
@ -498,11 +506,11 @@
/** /**
* Shorthand for pin tests, used wherever needed * Shorthand for pin tests, used wherever needed
*/ */
#define HAS_TEMP_0 (PIN_EXISTS(TEMP_0) && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 != -2) #define HAS_TEMP_0 (PIN_EXISTS(TEMP_0) && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 > -2)
#define HAS_TEMP_1 (PIN_EXISTS(TEMP_1) && TEMP_SENSOR_1 != 0) #define HAS_TEMP_1 (PIN_EXISTS(TEMP_1) && TEMP_SENSOR_1 != 0 && TEMP_SENSOR_1 > -2)
#define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0) #define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0 && TEMP_SENSOR_2 > -2)
#define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0) #define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0 && TEMP_SENSOR_3 > -2)
#define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0) #define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0 && TEMP_SENSOR_BED > -2)
#define HAS_HEATER_0 (PIN_EXISTS(HEATER_0)) #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
#define HAS_HEATER_1 (PIN_EXISTS(HEATER_1)) #define HAS_HEATER_1 (PIN_EXISTS(HEATER_1))
#define HAS_HEATER_2 (PIN_EXISTS(HEATER_2)) #define HAS_HEATER_2 (PIN_EXISTS(HEATER_2))
@ -581,6 +589,8 @@
#define HAS_MOTOR_CURRENT_PWM (PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_Z) || PIN_EXISTS(MOTOR_CURRENT_PWM_E)) #define HAS_MOTOR_CURRENT_PWM (PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_Z) || PIN_EXISTS(MOTOR_CURRENT_PWM_E))
#define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675))
/** /**
* Helper Macros for heaters and extruder fan * Helper Macros for heaters and extruder fan
*/ */

2
Marlin/Marlin.h

@ -368,7 +368,7 @@ extern uint8_t active_extruder;
extern void digipot_i2c_init(); extern void digipot_i2c_init();
#endif #endif
#if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675) #if HAS_TEMP_HOTEND || HAS_TEMP_BED
void print_heaterstates(); void print_heaterstates();
#endif #endif

10
Marlin/Marlin_main.cpp

@ -4100,10 +4100,10 @@ inline void gcode_M104() {
if (print_job_stop()) LCD_MESSAGEPGM(WELCOME_MSG); if (print_job_stop()) LCD_MESSAGEPGM(WELCOME_MSG);
} }
#if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675) #if HAS_TEMP_HOTEND || HAS_TEMP_BED
void print_heaterstates() { void print_heaterstates() {
#if HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675) #if HAS_TEMP_HOTEND
SERIAL_PROTOCOLPGM(" T:"); SERIAL_PROTOCOLPGM(" T:");
SERIAL_PROTOCOL_F(degHotend(target_extruder), 1); SERIAL_PROTOCOL_F(degHotend(target_extruder), 1);
SERIAL_PROTOCOLPGM(" /"); SERIAL_PROTOCOLPGM(" /");
@ -4179,10 +4179,10 @@ inline void gcode_M104() {
inline void gcode_M105() { inline void gcode_M105() {
if (setTargetedHotend(105)) return; if (setTargetedHotend(105)) return;
#if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675) #if HAS_TEMP_HOTEND || HAS_TEMP_BED
SERIAL_PROTOCOLPGM(MSG_OK); SERIAL_PROTOCOLPGM(MSG_OK);
print_heaterstates(); print_heaterstates();
#else // !HAS_TEMP_0 && !HAS_TEMP_BED #else // !HAS_TEMP_HOTEND && !HAS_TEMP_BED
SERIAL_ERROR_START; SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_ERR_NO_THERMISTORS); SERIAL_ERRORLNPGM(MSG_ERR_NO_THERMISTORS);
#endif #endif
@ -4271,7 +4271,7 @@ inline void gcode_M109() {
now = millis(); now = millis();
if (now > next_temp_ms) { //Print temp & remaining time every 1s while waiting if (now > next_temp_ms) { //Print temp & remaining time every 1s while waiting
next_temp_ms = now + 1000UL; next_temp_ms = now + 1000UL;
#if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675) #if HAS_TEMP_HOTEND || HAS_TEMP_BED
print_heaterstates(); print_heaterstates();
#endif #endif
#ifdef TEMP_RESIDENCY_TIME #ifdef TEMP_RESIDENCY_TIME

4
Marlin/temperature.cpp

@ -350,7 +350,7 @@ void PID_autotune(float temp, int extruder, int ncycles, bool set_result/*=false
} }
// Every 2 seconds... // Every 2 seconds...
if (ms > temp_ms + 2000) { if (ms > temp_ms + 2000) {
#if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675) #if HAS_TEMP_HOTEND || HAS_TEMP_BED
print_heaterstates(); print_heaterstates();
SERIAL_EOL; SERIAL_EOL;
#endif #endif
@ -1183,7 +1183,7 @@ void disable_all_heaters() {
WRITE_HEATER_ ## NR (LOW); \ WRITE_HEATER_ ## NR (LOW); \
} }
#if HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675) #if HAS_TEMP_HOTEND
setTargetHotend(0, 0); setTargetHotend(0, 0);
soft_pwm[0] = 0; soft_pwm[0] = 0;
WRITE_HEATER_0P(LOW); // Should HEATERS_PARALLEL apply here? Then change to DISABLE_HEATER(0) WRITE_HEATER_0P(LOW); // Should HEATERS_PARALLEL apply here? Then change to DISABLE_HEATER(0)

Loading…
Cancel
Save