diff --git a/usermods/PWM_fan/usermod_PWM_fan.h b/usermods/PWM_fan/usermod_PWM_fan.h index 624534b1..97e7cd12 100644 --- a/usermods/PWM_fan/usermod_PWM_fan.h +++ b/usermods/PWM_fan/usermod_PWM_fan.h @@ -80,7 +80,8 @@ class PWMFanUsermod : public Usermod { // detach interrupt while calculating rpm detachInterrupt(digitalPinToInterrupt(tachoPin)); // calculate rpm - last_rpm = counter_rpm * (60 / numberOfInterrupsInOneSingleRotation); + last_rpm = (counter_rpm * 60) / numberOfInterrupsInOneSingleRotation; + last_rpm /= tachoUpdateSec; // reset counter counter_rpm = 0; // store milliseconds when tacho was measured the last time