瀏覽代碼

Add "P" parameter to M302

Scott Lahteine 9 年之前
父節點
當前提交
d4c68279c8
共有 3 個檔案被更改,包括 31 行新增3 行删除
  1. 28
    2
      Marlin/Marlin_main.cpp
  2. 1
    0
      Marlin/temperature.cpp
  3. 2
    1
      Marlin/temperature.h

+ 28
- 2
Marlin/Marlin_main.cpp 查看文件

5703
 #if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
5703
 #if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
5704
 
5704
 
5705
   /**
5705
   /**
5706
-   * M302: Allow cold extrudes, or set the minimum extrude S<temperature>.
5706
+   * M302: Allow cold extrudes, or set the minimum extrude temperature
5707
+   *
5708
+   *       S<temperature> sets the minimum extrude temperature
5709
+   *       P<bool> enables (1) or disables (0) cold extrusion
5710
+   *
5711
+   *  Examples:
5712
+   *
5713
+   *       M302         ; report current cold extrusion state
5714
+   *       M302 P0      ; enable cold extrusion checking
5715
+   *       M302 P1      ; disables cold extrusion checking
5716
+   *       M302 S0      ; always allow extrusion (disables checking)
5717
+   *       M302 S170    ; only allow extrusion above 170
5718
+   *       M302 S170 P1 ; set min extrude temp to 170 but leave disabled
5707
    */
5719
    */
5708
   inline void gcode_M302() {
5720
   inline void gcode_M302() {
5709
-    thermalManager.extrude_min_temp = code_seen('S') ? code_value_temp_abs() : 0;
5721
+    bool seen_S = code_seen('S');
5722
+    if (seen_S) {
5723
+      thermalManager.extrude_min_temp = code_value_temp_abs();
5724
+      thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0);
5725
+    }
5726
+
5727
+    if (code_seen('P'))
5728
+      thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0) || code_value_bool();
5729
+    else if (!seen_S) {
5730
+      // Report current state
5731
+      SERIAL_ECHO_START;
5732
+      SERIAL_ECHOPAIR("Cold extrudes are ", (thermalManager.allow_cold_extrude ? "en" : "dis"));
5733
+      SERIAL_ECHOPAIR("abled (min temp ", int(thermalManager.extrude_min_temp + 0.5));
5734
+      SERIAL_ECHOLNPGM("C)");
5735
+    }
5710
   }
5736
   }
5711
 
5737
 
5712
 #endif // PREVENT_DANGEROUS_EXTRUDE
5738
 #endif // PREVENT_DANGEROUS_EXTRUDE

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

107
 #endif
107
 #endif
108
 
108
 
109
 #if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
109
 #if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
110
+  bool Temperature::allow_cold_extrude = false;
110
   float Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
111
   float Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
111
 #endif
112
 #endif
112
 
113
 

+ 2
- 1
Marlin/temperature.h 查看文件

121
     #endif
121
     #endif
122
 
122
 
123
     #if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
123
     #if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
124
+      static bool allow_cold_extrude;
124
       static float extrude_min_temp;
125
       static float extrude_min_temp;
125
       static bool tooColdToExtrude(uint8_t e) {
126
       static bool tooColdToExtrude(uint8_t e) {
126
         #if HOTENDS == 1
127
         #if HOTENDS == 1
127
           UNUSED(e);
128
           UNUSED(e);
128
         #endif
129
         #endif
129
-        return degHotend(HOTEND_INDEX) < extrude_min_temp;
130
+        return allow_cold_extrude ? false : degHotend(HOTEND_INDEX) < extrude_min_temp;
130
       }
131
       }
131
     #else
132
     #else
132
       static bool tooColdToExtrude(uint8_t e) { UNUSED(e); return false; }
133
       static bool tooColdToExtrude(uint8_t e) { UNUSED(e); return false; }

Loading…
取消
儲存