Reduce need for UNUSED

This commit is contained in:
Scott Lahteine
2019-09-30 21:44:07 -05:00
parent e3ff27c95a
commit e3fd0519b3
31 changed files with 104 additions and 143 deletions

View File

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