SOFT_PWM: Do not switch off heaters twice on pwm_count wraparound

After wraparound, pwm_count <= pwm_mask holds, thus soft_pwm_X <= pwm_count
guarantees soft_pwm_X < pwm_mask is true, and the heater will be switched
off in the first branch.
Do not evaluate the pwm conditions a second time, this reduces the
instruction count (4 instructions per PWM) and text size (6 byte).

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
This commit is contained in:
Stefan Brüns 2017-03-18 20:28:57 +01:00 committed by Scott Lahteine
parent 0a74774af1
commit 6a040a6967

View file

@ -1594,17 +1594,17 @@ void Temperature::isr() {
#endif #endif
#endif #endif
} }
else {
if (soft_pwm_0 <= pwm_count_tmp) WRITE_HEATER_0(0); if (soft_pwm_0 <= pwm_count_tmp) WRITE_HEATER_0(0);
#if HOTENDS > 1 #if HOTENDS > 1
if (soft_pwm_1 <= pwm_count_tmp) WRITE_HEATER_1(0); if (soft_pwm_1 <= pwm_count_tmp) WRITE_HEATER_1(0);
#endif
#if HOTENDS > 2 #if HOTENDS > 2
if (soft_pwm_2 <= pwm_count_tmp) WRITE_HEATER_2(0); if (soft_pwm_2 <= pwm_count_tmp) WRITE_HEATER_2(0);
#endif
#if HOTENDS > 3 #if HOTENDS > 3
if (soft_pwm_3 <= pwm_count_tmp) WRITE_HEATER_3(0); if (soft_pwm_3 <= pwm_count_tmp) WRITE_HEATER_3(0);
#endif #endif
#endif
#endif
#if HAS_HEATER_BED #if HAS_HEATER_BED
if (soft_pwm_BED <= pwm_count_tmp) WRITE_HEATER_BED(0); if (soft_pwm_BED <= pwm_count_tmp) WRITE_HEATER_BED(0);
@ -1621,6 +1621,7 @@ void Temperature::isr() {
if (soft_pwm_fan[2] <= pwm_count_tmp) WRITE_FAN2(0); if (soft_pwm_fan[2] <= pwm_count_tmp) WRITE_FAN2(0);
#endif #endif
#endif #endif
}
// SOFT_PWM_SCALE to frequency: // SOFT_PWM_SCALE to frequency:
// //