|
@ -39,10 +39,10 @@ |
|
|
|
|
|
|
|
|
#if HOTENDS <= 1 |
|
|
#if HOTENDS <= 1 |
|
|
#define HOTEND_INDEX 0 |
|
|
#define HOTEND_INDEX 0 |
|
|
#define E_UNUSED() UNUSED(e) |
|
|
#define E_NAME |
|
|
#else |
|
|
#else |
|
|
#define HOTEND_INDEX e |
|
|
#define HOTEND_INDEX e |
|
|
#define E_UNUSED() |
|
|
#define E_NAME e |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
// Identifiers for other heaters
|
|
|
// Identifiers for other heaters
|
|
@ -304,17 +304,15 @@ class Temperature { |
|
|
static bool allow_cold_extrude; |
|
|
static bool allow_cold_extrude; |
|
|
static int16_t extrude_min_temp; |
|
|
static int16_t extrude_min_temp; |
|
|
FORCE_INLINE static bool tooCold(const int16_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp; } |
|
|
FORCE_INLINE static bool tooCold(const int16_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp; } |
|
|
FORCE_INLINE static bool tooColdToExtrude(const uint8_t e) { |
|
|
FORCE_INLINE static bool tooColdToExtrude(const uint8_t E_NAME) { |
|
|
E_UNUSED(); |
|
|
|
|
|
return tooCold(degHotend(HOTEND_INDEX)); |
|
|
return tooCold(degHotend(HOTEND_INDEX)); |
|
|
} |
|
|
} |
|
|
FORCE_INLINE static bool targetTooColdToExtrude(const uint8_t e) { |
|
|
FORCE_INLINE static bool targetTooColdToExtrude(const uint8_t E_NAME) { |
|
|
E_UNUSED(); |
|
|
|
|
|
return tooCold(degTargetHotend(HOTEND_INDEX)); |
|
|
return tooCold(degTargetHotend(HOTEND_INDEX)); |
|
|
} |
|
|
} |
|
|
#else |
|
|
#else |
|
|
FORCE_INLINE static bool tooColdToExtrude(const uint8_t e) { UNUSED(e); return false; } |
|
|
FORCE_INLINE static bool tooColdToExtrude(const uint8_t) { return false; } |
|
|
FORCE_INLINE static bool targetTooColdToExtrude(const uint8_t e) { UNUSED(e); return false; } |
|
|
FORCE_INLINE static bool targetTooColdToExtrude(const uint8_t) { return false; } |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
FORCE_INLINE static bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); } |
|
|
FORCE_INLINE static bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); } |
|
@ -546,16 +544,13 @@ class Temperature { |
|
|
* Preheating hotends |
|
|
* Preheating hotends |
|
|
*/ |
|
|
*/ |
|
|
#ifdef MILLISECONDS_PREHEAT_TIME |
|
|
#ifdef MILLISECONDS_PREHEAT_TIME |
|
|
static bool is_preheating(const uint8_t e) { |
|
|
static bool is_preheating(const uint8_t E_NAME) { |
|
|
E_UNUSED(); |
|
|
|
|
|
return preheat_end_time[HOTEND_INDEX] && PENDING(millis(), preheat_end_time[HOTEND_INDEX]); |
|
|
return preheat_end_time[HOTEND_INDEX] && PENDING(millis(), preheat_end_time[HOTEND_INDEX]); |
|
|
} |
|
|
} |
|
|
static void start_preheat_time(const uint8_t e) { |
|
|
static void start_preheat_time(const uint8_t E_NAME) { |
|
|
E_UNUSED(); |
|
|
|
|
|
preheat_end_time[HOTEND_INDEX] = millis() + MILLISECONDS_PREHEAT_TIME; |
|
|
preheat_end_time[HOTEND_INDEX] = millis() + MILLISECONDS_PREHEAT_TIME; |
|
|
} |
|
|
} |
|
|
static void reset_preheat_time(const uint8_t e) { |
|
|
static void reset_preheat_time(const uint8_t E_NAME) { |
|
|
E_UNUSED(); |
|
|
|
|
|
preheat_end_time[HOTEND_INDEX] = 0; |
|
|
preheat_end_time[HOTEND_INDEX] = 0; |
|
|
} |
|
|
} |
|
|
#else |
|
|
#else |
|
@ -566,39 +561,36 @@ class Temperature { |
|
|
//inline so that there is no performance decrease.
|
|
|
//inline so that there is no performance decrease.
|
|
|
//deg=degreeCelsius
|
|
|
//deg=degreeCelsius
|
|
|
|
|
|
|
|
|
FORCE_INLINE static float degHotend(const uint8_t e) { |
|
|
FORCE_INLINE static float degHotend(const uint8_t E_NAME) { |
|
|
E_UNUSED(); |
|
|
return (0 |
|
|
#if HOTENDS |
|
|
#if HOTENDS |
|
|
return temp_hotend[HOTEND_INDEX].celsius; |
|
|
+ temp_hotend[HOTEND_INDEX].celsius |
|
|
#else |
|
|
|
|
|
return 0; |
|
|
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#if ENABLED(SHOW_TEMP_ADC_VALUES) |
|
|
#if ENABLED(SHOW_TEMP_ADC_VALUES) |
|
|
FORCE_INLINE static int16_t rawHotendTemp(const uint8_t e) { |
|
|
FORCE_INLINE static int16_t rawHotendTemp(const uint8_t E_NAME) { |
|
|
E_UNUSED(); |
|
|
return (0 |
|
|
#if HOTENDS |
|
|
#if HOTENDS |
|
|
return temp_hotend[HOTEND_INDEX].raw; |
|
|
+ temp_hotend[HOTEND_INDEX].raw |
|
|
#else |
|
|
|
|
|
return 0; |
|
|
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
); |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
FORCE_INLINE static int16_t degTargetHotend(const uint8_t e) { |
|
|
FORCE_INLINE static int16_t degTargetHotend(const uint8_t E_NAME) { |
|
|
E_UNUSED(); |
|
|
return (0 |
|
|
#if HOTENDS |
|
|
#if HOTENDS |
|
|
return temp_hotend[HOTEND_INDEX].target; |
|
|
+ temp_hotend[HOTEND_INDEX].target |
|
|
#else |
|
|
|
|
|
return 0; |
|
|
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#if WATCH_HOTENDS |
|
|
#if WATCH_HOTENDS |
|
|
static void start_watching_hotend(const uint8_t e=0); |
|
|
static void start_watching_hotend(const uint8_t e=0); |
|
|
#else |
|
|
#else |
|
|
static inline void start_watching_hotend(const uint8_t e=0) { UNUSED(e); } |
|
|
static inline void start_watching_hotend(const uint8_t=0) {} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if HOTENDS |
|
|
#if HOTENDS |
|
@ -612,8 +604,7 @@ class Temperature { |
|
|
static inline void start_watching_E5() { start_watching_hotend(5); } |
|
|
static inline void start_watching_E5() { start_watching_hotend(5); } |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
static void setTargetHotend(const int16_t celsius, const uint8_t e) { |
|
|
static void setTargetHotend(const int16_t celsius, const uint8_t E_NAME) { |
|
|
E_UNUSED(); |
|
|
|
|
|
const uint8_t ee = HOTEND_INDEX; |
|
|
const uint8_t ee = HOTEND_INDEX; |
|
|
#ifdef MILLISECONDS_PREHEAT_TIME |
|
|
#ifdef MILLISECONDS_PREHEAT_TIME |
|
|
if (celsius == 0) |
|
|
if (celsius == 0) |
|
@ -628,13 +619,11 @@ class Temperature { |
|
|
start_watching_hotend(ee); |
|
|
start_watching_hotend(ee); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
FORCE_INLINE static bool isHeatingHotend(const uint8_t e) { |
|
|
FORCE_INLINE static bool isHeatingHotend(const uint8_t E_NAME) { |
|
|
E_UNUSED(); |
|
|
|
|
|
return temp_hotend[HOTEND_INDEX].target > temp_hotend[HOTEND_INDEX].celsius; |
|
|
return temp_hotend[HOTEND_INDEX].target > temp_hotend[HOTEND_INDEX].celsius; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
FORCE_INLINE static bool isCoolingHotend(const uint8_t e) { |
|
|
FORCE_INLINE static bool isCoolingHotend(const uint8_t E_NAME) { |
|
|
E_UNUSED(); |
|
|
|
|
|
return temp_hotend[HOTEND_INDEX].target < temp_hotend[HOTEND_INDEX].celsius; |
|
|
return temp_hotend[HOTEND_INDEX].target < temp_hotend[HOTEND_INDEX].celsius; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -765,8 +754,7 @@ class Temperature { |
|
|
|
|
|
|
|
|
#if HEATER_IDLE_HANDLER |
|
|
#if HEATER_IDLE_HANDLER |
|
|
|
|
|
|
|
|
static void reset_heater_idle_timer(const uint8_t e) { |
|
|
static void reset_heater_idle_timer(const uint8_t E_NAME) { |
|
|
E_UNUSED(); |
|
|
|
|
|
hotend_idle[HOTEND_INDEX].reset(); |
|
|
hotend_idle[HOTEND_INDEX].reset(); |
|
|
start_watching_hotend(HOTEND_INDEX); |
|
|
start_watching_hotend(HOTEND_INDEX); |
|
|
} |
|
|
} |
|
|