Fix for incorrect RPM reported.

pull/2737/head
Blaz Kristan 2021-10-03 14:00:29 +02:00
rodzic 62e7c861bd
commit 783a21d88d
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -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