Reduce need for UNUSED
This commit is contained in:
@ -85,7 +85,7 @@ class MarlinSettings {
|
||||
static void report(const bool forReplay=false);
|
||||
#else
|
||||
FORCE_INLINE
|
||||
static void report(const bool forReplay=false) { UNUSED(forReplay); }
|
||||
static void report(const bool=false) {}
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -279,12 +279,12 @@ void homeaxis(const AxisEnum axis);
|
||||
#else
|
||||
#define NATIVE_TO_LOGICAL(POS, AXIS) (POS)
|
||||
#define LOGICAL_TO_NATIVE(POS, AXIS) (POS)
|
||||
FORCE_INLINE void toLogical(xy_pos_t &raw) { UNUSED(raw); }
|
||||
FORCE_INLINE void toLogical(xyz_pos_t &raw) { UNUSED(raw); }
|
||||
FORCE_INLINE void toLogical(xyze_pos_t &raw) { UNUSED(raw); }
|
||||
FORCE_INLINE void toNative(xy_pos_t &raw) { UNUSED(raw); }
|
||||
FORCE_INLINE void toNative(xyz_pos_t &raw) { UNUSED(raw); }
|
||||
FORCE_INLINE void toNative(xyze_pos_t &raw) { UNUSED(raw); }
|
||||
FORCE_INLINE void toLogical(xy_pos_t&) {}
|
||||
FORCE_INLINE void toLogical(xyz_pos_t&) {}
|
||||
FORCE_INLINE void toLogical(xyze_pos_t&) {}
|
||||
FORCE_INLINE void toNative(xy_pos_t&) {}
|
||||
FORCE_INLINE void toNative(xyz_pos_t&) {}
|
||||
FORCE_INLINE void toNative(xyze_pos_t&) {}
|
||||
#endif
|
||||
#define LOGICAL_X_POSITION(POS) NATIVE_TO_LOGICAL(POS, X_AXIS)
|
||||
#define LOGICAL_Y_POSITION(POS) NATIVE_TO_LOGICAL(POS, Y_AXIS)
|
||||
|
@ -431,12 +431,9 @@ class Planner {
|
||||
|
||||
#else
|
||||
|
||||
FORCE_INLINE static float fade_scaling_factor_for_z(const float &rz) {
|
||||
UNUSED(rz);
|
||||
return 1;
|
||||
}
|
||||
FORCE_INLINE static float fade_scaling_factor_for_z(const float&) { return 1; }
|
||||
|
||||
FORCE_INLINE static bool leveling_active_at_z(const float &rz) { UNUSED(rz); return true; }
|
||||
FORCE_INLINE static bool leveling_active_at_z(const float&) { return true; }
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -337,7 +337,7 @@ class Stepper {
|
||||
//
|
||||
// Constructor / initializer
|
||||
//
|
||||
Stepper() { };
|
||||
Stepper() {};
|
||||
|
||||
// Initialize stepper hardware
|
||||
static void init();
|
||||
|
@ -813,13 +813,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
|
||||
|
||||
#if HOTENDS
|
||||
|
||||
float Temperature::get_pid_output_hotend(const uint8_t e) {
|
||||
#if HOTENDS == 1
|
||||
#define _HOTEND_TEST true
|
||||
#else
|
||||
#define _HOTEND_TEST (e == active_extruder)
|
||||
#endif
|
||||
E_UNUSED();
|
||||
float Temperature::get_pid_output_hotend(const uint8_t E_NAME) {
|
||||
const uint8_t ee = HOTEND_INDEX;
|
||||
#if ENABLED(PIDTEMP)
|
||||
#if DISABLED(PID_OPENLOOP)
|
||||
@ -860,8 +854,13 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
|
||||
pid_output = work_pid[ee].Kp + work_pid[ee].Ki + work_pid[ee].Kd + float(MIN_POWER);
|
||||
|
||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||
#if HOTENDS == 1
|
||||
constexpr bool this_hotend = true;
|
||||
#else
|
||||
const bool this_hotend = (e == active_extruder);
|
||||
#endif
|
||||
work_pid[ee].Kc = 0;
|
||||
if (_HOTEND_TEST) {
|
||||
if (this_hotend) {
|
||||
const long e_position = stepper.position(E_AXIS);
|
||||
if (e_position > last_e_position) {
|
||||
lpq[lpq_ptr] = e_position - last_e_position;
|
||||
@ -895,6 +894,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
|
||||
MSG_PID_DEBUG_OUTPUT, pid_output
|
||||
);
|
||||
#if DISABLED(PID_OPENLOOP)
|
||||
{
|
||||
SERIAL_ECHOPAIR(
|
||||
MSG_PID_DEBUG_PTERM, work_pid[ee].Kp,
|
||||
MSG_PID_DEBUG_ITERM, work_pid[ee].Ki,
|
||||
@ -903,6 +903,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
|
||||
, MSG_PID_DEBUG_CTERM, work_pid[ee].Kc
|
||||
#endif
|
||||
);
|
||||
}
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
}
|
||||
@ -911,12 +912,11 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
|
||||
#else // No PID enabled
|
||||
|
||||
#if HEATER_IDLE_HANDLER
|
||||
#define _TIMED_OUT_TEST hotend_idle[ee].timed_out
|
||||
const bool is_idling = hotend_idle[ee].timed_out;
|
||||
#else
|
||||
#define _TIMED_OUT_TEST false
|
||||
constexpr bool is_idling = false;
|
||||
#endif
|
||||
const float pid_output = (!_TIMED_OUT_TEST && temp_hotend[ee].celsius < temp_hotend[ee].target) ? BANG_MAX : 0;
|
||||
#undef _TIMED_OUT_TEST
|
||||
const float pid_output = (!is_idling && temp_hotend[ee].celsius < temp_hotend[ee].target) ? BANG_MAX : 0;
|
||||
|
||||
#endif
|
||||
|
||||
@ -971,6 +971,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
|
||||
#endif // PID_OPENLOOP
|
||||
|
||||
#if ENABLED(PID_BED_DEBUG)
|
||||
{
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR(
|
||||
" PID_BED_DEBUG : Input ", temp_bed.celsius, " Output ", pid_output,
|
||||
@ -980,6 +981,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
|
||||
MSG_PID_DEBUG_DTERM, work_pid.Kd,
|
||||
#endif
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
return pid_output;
|
||||
@ -1811,8 +1813,7 @@ void Temperature::init() {
|
||||
* their target temperature by a configurable margin.
|
||||
* This is called when the temperature is set. (M104, M109)
|
||||
*/
|
||||
void Temperature::start_watching_hotend(const uint8_t e) {
|
||||
E_UNUSED();
|
||||
void Temperature::start_watching_hotend(const uint8_t E_NAME) {
|
||||
const uint8_t ee = HOTEND_INDEX;
|
||||
if (degTargetHotend(ee) && degHotend(ee) < degTargetHotend(ee) - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1)) {
|
||||
watch_hotend[ee].target = degHotend(ee) + WATCH_TEMP_INCREASE;
|
||||
|
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user