mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-27 13:56:24 +00:00
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:
parent
0a74774af1
commit
6a040a6967
@ -1594,33 +1594,34 @@ 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);
|
||||||
#if HOTENDS > 3
|
#endif
|
||||||
if (soft_pwm_3 <= pwm_count_tmp) WRITE_HEATER_3(0);
|
#if HOTENDS > 3
|
||||||
|
if (soft_pwm_3 <= pwm_count_tmp) WRITE_HEATER_3(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAS_HEATER_BED
|
||||||
|
if (soft_pwm_BED <= pwm_count_tmp) WRITE_HEATER_BED(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(FAN_SOFT_PWM)
|
||||||
|
#if HAS_FAN0
|
||||||
|
if (soft_pwm_fan[0] <= pwm_count_tmp) WRITE_FAN(0);
|
||||||
|
#endif
|
||||||
|
#if HAS_FAN1
|
||||||
|
if (soft_pwm_fan[1] <= pwm_count_tmp) WRITE_FAN1(0);
|
||||||
|
#endif
|
||||||
|
#if HAS_FAN2
|
||||||
|
if (soft_pwm_fan[2] <= pwm_count_tmp) WRITE_FAN2(0);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
}
|
||||||
|
|
||||||
#if HAS_HEATER_BED
|
|
||||||
if (soft_pwm_BED <= pwm_count_tmp) WRITE_HEATER_BED(0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(FAN_SOFT_PWM)
|
|
||||||
#if HAS_FAN0
|
|
||||||
if (soft_pwm_fan[0] <= pwm_count_tmp) WRITE_FAN(0);
|
|
||||||
#endif
|
|
||||||
#if HAS_FAN1
|
|
||||||
if (soft_pwm_fan[1] <= pwm_count_tmp) WRITE_FAN1(0);
|
|
||||||
#endif
|
|
||||||
#if HAS_FAN2
|
|
||||||
if (soft_pwm_fan[2] <= pwm_count_tmp) WRITE_FAN2(0);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// SOFT_PWM_SCALE to frequency:
|
// SOFT_PWM_SCALE to frequency:
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user