Browse Source

Use right-shift instead of / 2, why not?

Scott Lahteine 8 years ago
parent
commit
d80a79eb77
1 changed files with 13 additions and 13 deletions
  1. 13
    13
      Marlin/temperature.cpp

+ 13
- 13
Marlin/temperature.cpp View File

234
 
234
 
235
     #if HAS_PID_FOR_BOTH
235
     #if HAS_PID_FOR_BOTH
236
       if (hotend < 0)
236
       if (hotend < 0)
237
-        soft_pwm_bed = bias = d = (MAX_BED_POWER) / 2;
237
+        soft_pwm_bed = bias = d = (MAX_BED_POWER) >> 1;
238
       else
238
       else
239
-        soft_pwm[hotend] = bias = d = (PID_MAX) / 2;
239
+        soft_pwm[hotend] = bias = d = (PID_MAX) >> 1;
240
     #elif ENABLED(PIDTEMP)
240
     #elif ENABLED(PIDTEMP)
241
-      soft_pwm[hotend] = bias = d = (PID_MAX) / 2;
241
+      soft_pwm[hotend] = bias = d = (PID_MAX) >> 1;
242
     #else
242
     #else
243
-      soft_pwm_bed = bias = d = (MAX_BED_POWER) / 2;
243
+      soft_pwm_bed = bias = d = (MAX_BED_POWER) >> 1;
244
     #endif
244
     #endif
245
 
245
 
246
     wait_for_heatup = true;
246
     wait_for_heatup = true;
964
       setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
964
       setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
965
     #endif
965
     #endif
966
     #if ENABLED(FAN_SOFT_PWM)
966
     #if ENABLED(FAN_SOFT_PWM)
967
-      soft_pwm_fan[0] = fanSpeedSoftPwm[0] / 2;
967
+      soft_pwm_fan[0] = fanSpeedSoftPwm[0] >> 1;
968
     #endif
968
     #endif
969
   #endif
969
   #endif
970
 
970
 
974
       setPwmFrequency(FAN1_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
974
       setPwmFrequency(FAN1_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
975
     #endif
975
     #endif
976
     #if ENABLED(FAN_SOFT_PWM)
976
     #if ENABLED(FAN_SOFT_PWM)
977
-      soft_pwm_fan[1] = fanSpeedSoftPwm[1] / 2;
977
+      soft_pwm_fan[1] = fanSpeedSoftPwm[1] >> 1;
978
     #endif
978
     #endif
979
   #endif
979
   #endif
980
 
980
 
984
       setPwmFrequency(FAN2_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
984
       setPwmFrequency(FAN2_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
985
     #endif
985
     #endif
986
     #if ENABLED(FAN_SOFT_PWM)
986
     #if ENABLED(FAN_SOFT_PWM)
987
-      soft_pwm_fan[2] = fanSpeedSoftPwm[2] / 2;
987
+      soft_pwm_fan[2] = fanSpeedSoftPwm[2] >> 1;
988
     #endif
988
     #endif
989
   #endif
989
   #endif
990
 
990
 
1444
 
1444
 
1445
       #if ENABLED(FAN_SOFT_PWM)
1445
       #if ENABLED(FAN_SOFT_PWM)
1446
         #if HAS_FAN0
1446
         #if HAS_FAN0
1447
-          soft_pwm_fan[0] = fanSpeedSoftPwm[0] / 2;
1447
+          soft_pwm_fan[0] = fanSpeedSoftPwm[0] >> 1;
1448
           WRITE_FAN(soft_pwm_fan[0] > 0 ? 1 : 0);
1448
           WRITE_FAN(soft_pwm_fan[0] > 0 ? 1 : 0);
1449
         #endif
1449
         #endif
1450
         #if HAS_FAN1
1450
         #if HAS_FAN1
1451
-          soft_pwm_fan[1] = fanSpeedSoftPwm[1] / 2;
1451
+          soft_pwm_fan[1] = fanSpeedSoftPwm[1] >> 1;
1452
           WRITE_FAN1(soft_pwm_fan[1] > 0 ? 1 : 0);
1452
           WRITE_FAN1(soft_pwm_fan[1] > 0 ? 1 : 0);
1453
         #endif
1453
         #endif
1454
         #if HAS_FAN2
1454
         #if HAS_FAN2
1455
-          soft_pwm_fan[2] = fanSpeedSoftPwm[2] / 2;
1455
+          soft_pwm_fan[2] = fanSpeedSoftPwm[2] >> 1;
1456
           WRITE_FAN2(soft_pwm_fan[2] > 0 ? 1 : 0);
1456
           WRITE_FAN2(soft_pwm_fan[2] > 0 ? 1 : 0);
1457
         #endif
1457
         #endif
1458
       #endif
1458
       #endif
1563
     #if ENABLED(FAN_SOFT_PWM)
1563
     #if ENABLED(FAN_SOFT_PWM)
1564
       if (pwm_count == 0) {
1564
       if (pwm_count == 0) {
1565
         #if HAS_FAN0
1565
         #if HAS_FAN0
1566
-          soft_pwm_fan[0] = fanSpeedSoftPwm[0] / 2;
1566
+          soft_pwm_fan[0] = fanSpeedSoftPwm[0] >> 1;
1567
           WRITE_FAN(soft_pwm_fan[0] > 0 ? 1 : 0);
1567
           WRITE_FAN(soft_pwm_fan[0] > 0 ? 1 : 0);
1568
         #endif
1568
         #endif
1569
         #if HAS_FAN1
1569
         #if HAS_FAN1
1570
-          soft_pwm_fan[1] = fanSpeedSoftPwm[1] / 2;
1570
+          soft_pwm_fan[1] = fanSpeedSoftPwm[1] >> 1;
1571
           WRITE_FAN1(soft_pwm_fan[1] > 0 ? 1 : 0);
1571
           WRITE_FAN1(soft_pwm_fan[1] > 0 ? 1 : 0);
1572
         #endif
1572
         #endif
1573
         #if HAS_FAN2
1573
         #if HAS_FAN2
1574
-          soft_pwm_fan[2] = fanSpeedSoftPwm[2] / 2;
1574
+          soft_pwm_fan[2] = fanSpeedSoftPwm[2] >> 1;
1575
           WRITE_FAN2(soft_pwm_fan[2] > 0 ? 1 : 0);
1575
           WRITE_FAN2(soft_pwm_fan[2] > 0 ? 1 : 0);
1576
         #endif
1576
         #endif
1577
       }
1577
       }

Loading…
Cancel
Save