Browse Source

🐛 Fix flowmeter calculation (#21959)

gjdodd 4 years ago
parent
commit
9398c43112
No account linked to committer's email address
1 changed files with 2 additions and 4 deletions
  1. 2
    4
      Marlin/src/feature/cooler.h

+ 2
- 4
Marlin/src/feature/cooler.h View File

@@ -78,10 +78,8 @@ public:
78 78
 
79 79
     // Get the total flow (in liters per minute) since the last reading
80 80
     static void calc_flowrate() {
81
-      //flowmeter_interrupt_disable();
82
-      //  const uint16_t pulses = flowpulses;
83
-      //flowmeter_interrupt_enable();
84
-      flowrate = flowpulses * 60.0f * (1000.0f / (FLOWMETER_INTERVAL)) * (1000.0f / (FLOWMETER_PPL));
81
+      // flowrate = (litres) * (seconds) = litres per minute
82
+      flowrate = (flowpulses / (float)FLOWMETER_PPL) * ((1000.0f / (float)FLOWMETER_INTERVAL) * 60.0f);
85 83
       flowpulses = 0;
86 84
     }
87 85
 

Loading…
Cancel
Save