🏗️ Allow headless Flow Meter (#22234)

This commit is contained in:
Mike La Spina
2021-07-12 00:22:08 -05:00
committed by Scott Lahteine
parent 8334e92b6f
commit 5026797310
5 changed files with 19 additions and 17 deletions

View File

@ -22,26 +22,27 @@
#include "../inc/MarlinConfig.h"
#if HAS_COOLER
#if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER)
#include "cooler.h"
Cooler cooler;
uint8_t Cooler::mode = 0;
uint16_t Cooler::capacity;
uint16_t Cooler::load;
bool Cooler::enabled = false;
#if HAS_COOLER
uint8_t Cooler::mode = 0;
uint16_t Cooler::capacity;
uint16_t Cooler::load;
bool Cooler::enabled = false;
#endif
#if ENABLED(LASER_COOLANT_FLOW_METER)
bool Cooler::flowmeter = false;
millis_t Cooler::flowmeter_next_ms; // = 0
volatile uint16_t Cooler::flowpulses;
float Cooler::flowrate;
#if ENABLED(FLOWMETER_SAFETY)
bool Cooler::flowsafety_enabled = true;
bool Cooler::flowfault = false;
#endif
#endif
#if ENABLED(FLOWMETER_SAFETY)
bool Cooler::flowsafety_enabled = true;
bool Cooler::fault = false;
#endif
#endif // HAS_COOLER
#endif // HAS_COOLER || LASER_COOLANT_FLOW_METER

View File

@ -94,12 +94,12 @@ public:
}
#if ENABLED(FLOWMETER_SAFETY)
static bool fault; // Flag that the cooler is in a fault state
static bool flowsafety_enabled; // Flag to disable the cutter if flow rate is too low
static bool flowfault; // Flag that the cooler is in a fault state
static bool flowsafety_enabled; // Flag to disable the cutter if flow rate is too low
static void flowsafety_toggle() { flowsafety_enabled = !flowsafety_enabled; }
static bool check_flow_too_low() {
const bool too_low = flowsafety_enabled && flowrate < (FLOWMETER_MIN_LITERS_PER_MINUTE);
if (too_low) fault = true;
flowfault = too_low;
return too_low;
}
#endif

View File

@ -292,7 +292,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#endif
#if ENABLED(FLOWMETER_SAFETY)
if (cooler.fault) {
if (cooler.flowfault) {
SERIAL_ECHO_MSG(STR_FLOWMETER_FAULT);
return;
}

View File

@ -1555,7 +1555,7 @@ void Temperature::manage_heater() {
#if ENABLED(FLOWMETER_SAFETY)
if (cutter.enabled() && cooler.check_flow_too_low()) {
cutter.disable();
ui.flow_fault();
TERN_(HAS_DISPLAY, ui.flow_fault());
}
#endif
#endif