From 9398c431128fc92dcd18ac8cf556e266e4692bf4 Mon Sep 17 00:00:00 2001 From: gjdodd <31553294+gjdodd@users.noreply.github.com> Date: Mon, 24 May 2021 07:54:10 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20flowmeter=20calculation=20?= =?UTF-8?q?(#21959)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/cooler.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Marlin/src/feature/cooler.h b/Marlin/src/feature/cooler.h index 1e24c729f3..9bd98d0b10 100644 --- a/Marlin/src/feature/cooler.h +++ b/Marlin/src/feature/cooler.h @@ -78,10 +78,8 @@ public: // Get the total flow (in liters per minute) since the last reading static void calc_flowrate() { - //flowmeter_interrupt_disable(); - // const uint16_t pulses = flowpulses; - //flowmeter_interrupt_enable(); - flowrate = flowpulses * 60.0f * (1000.0f / (FLOWMETER_INTERVAL)) * (1000.0f / (FLOWMETER_PPL)); + // flowrate = (litres) * (seconds) = litres per minute + flowrate = (flowpulses / (float)FLOWMETER_PPL) * ((1000.0f / (float)FLOWMETER_INTERVAL) * 60.0f); flowpulses = 0; }