瀏覽代碼

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

Scott Lahteine 8 年之前
父節點
當前提交
d80a79eb77
共有 1 個文件被更改,包括 13 次插入13 次删除
  1. 13
    13
      Marlin/temperature.cpp

+ 13
- 13
Marlin/temperature.cpp 查看文件

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

Loading…
取消
儲存