Add configurations for flowmeter

parent c8f7db18
...@@ -1061,6 +1061,26 @@ ...@@ -1061,6 +1061,26 @@
#define FILAMENT_RUNOUT_SCRIPT "M600" // Script execute when filament run out #define FILAMENT_RUNOUT_SCRIPT "M600" // Script execute when filament run out
/**********************************************************************************/ /**********************************************************************************/
/**************************************************************************
****************************** Flow sensor *******************************
**************************************************************************
* *
* Flow sensors for water circulators, usefull in case of coolers using *
* water or other liquid as heat vector *
* *
* Uncomment FLOWMETER_SENSOR to enable this feature *
* You also need to set FLOWMETER_PIN in Configurations_pins.h *
* *
**************************************************************************/
#define FLOMETER_SENSOR
#define FLOWMETER_MAXFLOW 6 // Liters per minute max
#define FLOWMETER_MAXFREQ 55 // frequency of pulses at max flow
// uncomment this to kill print job under the min flow rate, in liters/minute
#define MINFLOW_PROTECTION 4
/************************************************************************** /**************************************************************************
*********************** Power consumption sensor ************************* *********************** Power consumption sensor *************************
......
...@@ -115,6 +115,7 @@ ...@@ -115,6 +115,7 @@
***********************************************************************/ ***********************************************************************/
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=I^2/R //#define HOTEND_WATTS (12.0*12.0/6.7) // P=I^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=I^2/R //#define BED_WATTS (12.0*12.0/1.1) // P=I^2/R
//#define COOLER_WATTS 52 // Commonly available TEC wattage
/***********************************************************************/ /***********************************************************************/
...@@ -1062,6 +1063,28 @@ ...@@ -1062,6 +1063,28 @@
/**********************************************************************************/ /**********************************************************************************/
/**************************************************************************
****************************** Flow sensor *******************************
**************************************************************************
* *
* Flow sensors for water circulators, usefull in case of coolers using *
* water or other liquid as heat vector *
* *
* Uncomment FLOWMETER_SENSOR to enable this feature *
* You also need to set FLOWMETER_PIN in Configurations_pins.h *
* *
**************************************************************************/
//#define FLOMETER_SENSOR
#define FLOWMETER_MAXFLOW 6.0 // Liters per minute max
#define FLOWMETER_MAXFREQ 55 // frequency of pulses at max flow
// uncomment this to kill print job under the min flow rate, in liters/minute
//#define MINFLOW_PROTECTION 4
/************************************************************************** /**************************************************************************
*********************** Power consumption sensor ************************* *********************** Power consumption sensor *************************
************************************************************************** **************************************************************************
......
...@@ -140,6 +140,10 @@ ...@@ -140,6 +140,10 @@
#define FILWIDTH_PIN -1 #define FILWIDTH_PIN -1
#endif #endif
#if ENABLED(FLOWMETER_SENSOR)
#define FLOWMETER_PIN -1
#endif
#if ENABLED(POWER_CONSUMPTION) #if ENABLED(POWER_CONSUMPTION)
#define POWER_CONSUMPTION_PIN -1 #define POWER_CONSUMPTION_PIN -1
#endif #endif
......
/*
flowmeter.cpp - Flowmeter control library for Arduino - Version 1
Copyright (c) 2016 Franco (nextime) Lanza. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "../../base.h"
#include <Arduino.h>
#if ENABLED(FLOWMETER_SENSOR)
volatile byte flowrate_pulsecount; volatile byte flowrate_pulsecount;
float flowrate; float flowrate;
unsigned int flowml; unsigned int flowml;
...@@ -24,7 +49,7 @@ void flowrate_manage() { ...@@ -24,7 +49,7 @@ void flowrate_manage() {
flowml = (flowrate / 60) * 1000; flowml = (flowrate / 60) * 1000;
pulseCount = 0; pulseCount = 0;
attachInterrupt(FLOWMETER_INTERRUPT, flowrate_pulsecounter,, FALLING); attachInterrupt(FLOWMETER_INTERRUPT, flowrate_pulsecounter, FALLING);
} }
} }
...@@ -35,5 +60,5 @@ void flowrate_pulsecounter() ...@@ -35,5 +60,5 @@ void flowrate_pulsecounter()
flowrate_pulsecount++; flowrate_pulsecount++;
} }
#endif // FLOWMETER_SENSOR
/*
flowmeter.h - Flowmeter control library for Arduino - Version 1
Copyright (c) 2016 Franco (nextime) Lanza. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef FLOWMETER_H
#define FLOWMETER_H
#include <inttypes.h>
#include "../../base.h"
#define FLOWMETER_CALIBRATION (FLOWMETER_MAXFREQ/FLOWETER_MAXFLOW)
#if ENABLED(FLOWMETER_SENSOR)
void flowrate_manage();
#endif // FLOWMETER_SENSOR
#endif // FLOWMETER_H
...@@ -1844,6 +1844,10 @@ ...@@ -1844,6 +1844,10 @@
#error DEPENDENCY ERROR: You have to set FILWIDTH_PIN to a valid pin if you enable FILAMENT_SENSOR #error DEPENDENCY ERROR: You have to set FILWIDTH_PIN to a valid pin if you enable FILAMENT_SENSOR
#endif #endif
#if ENABLED(FILAMENT_SENSOR) && !PIN_EXISTS(FLOWMETER)
#error DEPENDENCY ERROR: You have to set FLOWMETER_PIN to a valid pin if you enable FLOWMETER_SENSOR
#endif
#if ENABLED(POWER_CONSUMPTION) && !PIN_EXISTS(POWER_CONSUMPTION) #if ENABLED(POWER_CONSUMPTION) && !PIN_EXISTS(POWER_CONSUMPTION)
#error DEPENDENCY ERROR: You have to set POWER_CONSUMPTION_PIN to a valid pin if you enable POWER_CONSUMPTION #error DEPENDENCY ERROR: You have to set POWER_CONSUMPTION_PIN to a valid pin if you enable POWER_CONSUMPTION
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment