From d80a79eb77865dd4d32a975d35d44b536f3a3208 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 2 Oct 2016 00:18:41 -0500 Subject: [PATCH] Use right-shift instead of / 2, why not? --- Marlin/temperature.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 26932e455b..6562768e4f 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -234,13 +234,13 @@ uint8_t Temperature::soft_pwm[HOTENDS]; #if HAS_PID_FOR_BOTH if (hotend < 0) - soft_pwm_bed = bias = d = (MAX_BED_POWER) / 2; + soft_pwm_bed = bias = d = (MAX_BED_POWER) >> 1; else - soft_pwm[hotend] = bias = d = (PID_MAX) / 2; + soft_pwm[hotend] = bias = d = (PID_MAX) >> 1; #elif ENABLED(PIDTEMP) - soft_pwm[hotend] = bias = d = (PID_MAX) / 2; + soft_pwm[hotend] = bias = d = (PID_MAX) >> 1; #else - soft_pwm_bed = bias = d = (MAX_BED_POWER) / 2; + soft_pwm_bed = bias = d = (MAX_BED_POWER) >> 1; #endif wait_for_heatup = true; @@ -964,7 +964,7 @@ void Temperature::init() { setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 #endif #if ENABLED(FAN_SOFT_PWM) - soft_pwm_fan[0] = fanSpeedSoftPwm[0] / 2; + soft_pwm_fan[0] = fanSpeedSoftPwm[0] >> 1; #endif #endif @@ -974,7 +974,7 @@ void Temperature::init() { setPwmFrequency(FAN1_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 #endif #if ENABLED(FAN_SOFT_PWM) - soft_pwm_fan[1] = fanSpeedSoftPwm[1] / 2; + soft_pwm_fan[1] = fanSpeedSoftPwm[1] >> 1; #endif #endif @@ -984,7 +984,7 @@ void Temperature::init() { setPwmFrequency(FAN2_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 #endif #if ENABLED(FAN_SOFT_PWM) - soft_pwm_fan[2] = fanSpeedSoftPwm[2] / 2; + soft_pwm_fan[2] = fanSpeedSoftPwm[2] >> 1; #endif #endif @@ -1444,15 +1444,15 @@ void Temperature::isr() { #if ENABLED(FAN_SOFT_PWM) #if HAS_FAN0 - soft_pwm_fan[0] = fanSpeedSoftPwm[0] / 2; + soft_pwm_fan[0] = fanSpeedSoftPwm[0] >> 1; WRITE_FAN(soft_pwm_fan[0] > 0 ? 1 : 0); #endif #if HAS_FAN1 - soft_pwm_fan[1] = fanSpeedSoftPwm[1] / 2; + soft_pwm_fan[1] = fanSpeedSoftPwm[1] >> 1; WRITE_FAN1(soft_pwm_fan[1] > 0 ? 1 : 0); #endif #if HAS_FAN2 - soft_pwm_fan[2] = fanSpeedSoftPwm[2] / 2; + soft_pwm_fan[2] = fanSpeedSoftPwm[2] >> 1; WRITE_FAN2(soft_pwm_fan[2] > 0 ? 1 : 0); #endif #endif @@ -1563,15 +1563,15 @@ void Temperature::isr() { #if ENABLED(FAN_SOFT_PWM) if (pwm_count == 0) { #if HAS_FAN0 - soft_pwm_fan[0] = fanSpeedSoftPwm[0] / 2; + soft_pwm_fan[0] = fanSpeedSoftPwm[0] >> 1; WRITE_FAN(soft_pwm_fan[0] > 0 ? 1 : 0); #endif #if HAS_FAN1 - soft_pwm_fan[1] = fanSpeedSoftPwm[1] / 2; + soft_pwm_fan[1] = fanSpeedSoftPwm[1] >> 1; WRITE_FAN1(soft_pwm_fan[1] > 0 ? 1 : 0); #endif #if HAS_FAN2 - soft_pwm_fan[2] = fanSpeedSoftPwm[2] / 2; + soft_pwm_fan[2] = fanSpeedSoftPwm[2] >> 1; WRITE_FAN2(soft_pwm_fan[2] > 0 ? 1 : 0); #endif }