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

@ -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;