瀏覽代碼

🏗️ Allow headless Flow Meter (#22234)

Mike La Spina 3 年之前
父節點
當前提交
c0ecc6625f
沒有連結到貢獻者的電子郵件帳戶。
共有 5 個檔案被更改,包括 19 行新增17 行删除
  1. 12
    11
      Marlin/src/feature/cooler.cpp
  2. 3
    3
      Marlin/src/feature/cooler.h
  3. 1
    1
      Marlin/src/gcode/gcode.cpp
  4. 1
    1
      Marlin/src/module/temperature.cpp
  5. 2
    1
      ini/features.ini

+ 12
- 11
Marlin/src/feature/cooler.cpp 查看文件

@@ -22,26 +22,27 @@
22 22
 
23 23
 #include "../inc/MarlinConfig.h"
24 24
 
25
-#if HAS_COOLER
25
+#if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER)
26 26
 
27 27
 #include "cooler.h"
28 28
 Cooler cooler;
29 29
 
30
-uint8_t Cooler::mode = 0;
31
-uint16_t Cooler::capacity;
32
-uint16_t Cooler::load;
33
-bool Cooler::enabled = false;
30
+#if HAS_COOLER
31
+  uint8_t Cooler::mode = 0;
32
+  uint16_t Cooler::capacity;
33
+  uint16_t Cooler::load;
34
+  bool Cooler::enabled = false;
35
+#endif
34 36
 
35 37
 #if ENABLED(LASER_COOLANT_FLOW_METER)
36 38
   bool Cooler::flowmeter = false;
37 39
   millis_t Cooler::flowmeter_next_ms; // = 0
38 40
   volatile uint16_t Cooler::flowpulses;
39 41
   float Cooler::flowrate;
42
+  #if ENABLED(FLOWMETER_SAFETY)
43
+    bool Cooler::flowsafety_enabled = true;
44
+    bool Cooler::flowfault = false;
45
+  #endif
40 46
 #endif
41 47
 
42
-#if ENABLED(FLOWMETER_SAFETY)
43
-  bool Cooler::flowsafety_enabled = true;
44
-  bool Cooler::fault = false;
45
-#endif
46
-
47
-#endif // HAS_COOLER
48
+#endif // HAS_COOLER || LASER_COOLANT_FLOW_METER

+ 3
- 3
Marlin/src/feature/cooler.h 查看文件

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

+ 1
- 1
Marlin/src/gcode/gcode.cpp 查看文件

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

+ 1
- 1
Marlin/src/module/temperature.cpp 查看文件

@@ -1608,7 +1608,7 @@ void Temperature::manage_heater() {
1608 1608
     #if ENABLED(FLOWMETER_SAFETY)
1609 1609
       if (cutter.enabled() && cooler.check_flow_too_low()) {
1610 1610
         cutter.disable();
1611
-        ui.flow_fault();
1611
+        TERN_(HAS_DISPLAY, ui.flow_fault());
1612 1612
       }
1613 1613
     #endif
1614 1614
   #endif

+ 2
- 1
ini/features.ini 查看文件

@@ -202,7 +202,8 @@ SDSUPPORT                              = src_filter=+<src/sd/cardreader.cpp> +<s
202 202
 HAS_MEDIA_SUBCALLS                     = src_filter=+<src/gcode/sd/M32.cpp>
203 203
 GCODE_REPEAT_MARKERS                   = src_filter=+<src/feature/repeat.cpp> +<src/gcode/sd/M808.cpp>
204 204
 HAS_EXTRUDERS                          = src_filter=+<src/gcode/units/M82_M83.cpp> +<src/gcode/temp/M104_M109.cpp> +<src/gcode/config/M221.cpp>
205
-HAS_COOLER                             = src_filter=+<src/feature/cooler.cpp> +<src/gcode/temp/M143_M193.cpp>
205
+HAS_COOLER                             = src_filter=+<src/gcode/temp/M143_M193.cpp>
206
+HAS_COOLER|LASER_COOLANT_FLOW_METER    = src_filter=+<src/feature/cooler.cpp>
206 207
 AUTO_REPORT_TEMPERATURES               = src_filter=+<src/gcode/temp/M155.cpp>
207 208
 INCH_MODE_SUPPORT                      = src_filter=+<src/gcode/units/G20_G21.cpp>
208 209
 TEMPERATURE_UNITS_SUPPORT              = src_filter=+<src/gcode/units/M149.cpp>

Loading…
取消
儲存