Browse Source

Fix OCR / PWM calculation (#18094)

Fixes #17968
g3gg0.de 4 years ago
parent
commit
f776260d7a
No account linked to committer's email address
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      Marlin/src/HAL/AVR/fast_pwm.cpp

+ 1
- 1
Marlin/src/HAL/AVR/fast_pwm.cpp View File

@@ -274,7 +274,7 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255
274 274
     else
275 275
       top = *timer.ICRn; // top = ICRn
276 276
 
277
-    _SET_OCRnQ(timer.OCRnQ, timer.q, v * float(top / v_size)); // Scale 8/16-bit v to top value
277
+    _SET_OCRnQ(timer.OCRnQ, timer.q, v * float(top) / float(v_size)); // Scale 8/16-bit v to top value
278 278
   }
279 279
 }
280 280
 

Loading…
Cancel
Save