From 043be2856b22e8209009c78e0a29b56d8d23bfb1 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Thu, 23 Mar 2017 04:20:25 -0500
Subject: [PATCH] Use "& 0x3F" instead of "% 64"

---
 Marlin/temperature.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp
index 83c5e71762..50a8f7b1d2 100644
--- a/Marlin/temperature.cpp
+++ b/Marlin/temperature.cpp
@@ -1729,7 +1729,7 @@ void Temperature::isr() {
       #if HAS_FAN2
         if (soft_pwm_fan[2] <= pwm_count_tmp) WRITE_FAN2(0);
       #endif
-    #endif //FAN_SOFT_PWM
+    #endif // FAN_SOFT_PWM
 
     // SOFT_PWM_SCALE to frequency:
     //
@@ -1743,9 +1743,9 @@ void Temperature::isr() {
 
     // increment slow_pwm_count only every 64th pwm_count,
     // i.e. yielding a PWM frequency of 16/128 Hz (8s).
-    if (((pwm_count >> SOFT_PWM_SCALE) % 64) == 0) {
+    if (((pwm_count >> SOFT_PWM_SCALE) & 0x3F) == 0) {
       slow_pwm_count++;
-      slow_pwm_count &= 0x7f;
+      slow_pwm_count &= 0x7F;
 
       // EXTRUDER 0
       if (state_timer_heater_0 > 0) state_timer_heater_0--;
@@ -1761,7 +1761,7 @@ void Temperature::isr() {
       #if HAS_HEATER_BED
         if (state_timer_heater_BED > 0) state_timer_heater_BED--;
       #endif
-    } // (pwm_count % 64) == 0
+    } // ((pwm_count >> SOFT_PWM_SCALE) & 0x3F) == 0
 
   #endif // SLOW_PWM_HEATERS
 
-- 
GitLab