Browse Source

Use "& 0x3F" instead of "% 64"

Scott Lahteine 8 years ago
parent
commit
043be2856b
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      Marlin/temperature.cpp

+ 4
- 4
Marlin/temperature.cpp View File

1729
       #if HAS_FAN2
1729
       #if HAS_FAN2
1730
         if (soft_pwm_fan[2] <= pwm_count_tmp) WRITE_FAN2(0);
1730
         if (soft_pwm_fan[2] <= pwm_count_tmp) WRITE_FAN2(0);
1731
       #endif
1731
       #endif
1732
-    #endif //FAN_SOFT_PWM
1732
+    #endif // FAN_SOFT_PWM
1733
 
1733
 
1734
     // SOFT_PWM_SCALE to frequency:
1734
     // SOFT_PWM_SCALE to frequency:
1735
     //
1735
     //
1743
 
1743
 
1744
     // increment slow_pwm_count only every 64th pwm_count,
1744
     // increment slow_pwm_count only every 64th pwm_count,
1745
     // i.e. yielding a PWM frequency of 16/128 Hz (8s).
1745
     // i.e. yielding a PWM frequency of 16/128 Hz (8s).
1746
-    if (((pwm_count >> SOFT_PWM_SCALE) % 64) == 0) {
1746
+    if (((pwm_count >> SOFT_PWM_SCALE) & 0x3F) == 0) {
1747
       slow_pwm_count++;
1747
       slow_pwm_count++;
1748
-      slow_pwm_count &= 0x7f;
1748
+      slow_pwm_count &= 0x7F;
1749
 
1749
 
1750
       // EXTRUDER 0
1750
       // EXTRUDER 0
1751
       if (state_timer_heater_0 > 0) state_timer_heater_0--;
1751
       if (state_timer_heater_0 > 0) state_timer_heater_0--;
1761
       #if HAS_HEATER_BED
1761
       #if HAS_HEATER_BED
1762
         if (state_timer_heater_BED > 0) state_timer_heater_BED--;
1762
         if (state_timer_heater_BED > 0) state_timer_heater_BED--;
1763
       #endif
1763
       #endif
1764
-    } // (pwm_count % 64) == 0
1764
+    } // ((pwm_count >> SOFT_PWM_SCALE) & 0x3F) == 0
1765
 
1765
 
1766
   #endif // SLOW_PWM_HEATERS
1766
   #endif // SLOW_PWM_HEATERS
1767
 
1767
 

Loading…
Cancel
Save